This project is a high-performance, static-first replica of the ESM.sh package browser. It allows users to search NPM packages, view details, and generate ES Module import URLs.
The architecture is designed to be serverless and static, meaning it can be hosted on any static file server or CDN without a backend runtime (like Node.js or Python).
HashRouter for compatibility with all static hosts (no server-side redirects required).localStorage caching to minimize API calls to NPM registries.To run the project locally on your machine:
Install Dependencies
npm install
Start Development Server
npm run dev
Open your browser to http://localhost:5173 (or the port shown in your terminal).
Since this app removes backend dependencies (like the Gemini API), it can be deployed to any static hosting provider.
Run the build command to generate the static files:
npm run build
This will create a dist (or build) folder containing:
index.htmlassets/ (JavaScript and CSS files)npm i -g vercelvercel in the project root.GitHub Actions or Deploy from branch.dist folder content is uploaded to the gh-pages branch.
HashRouter, you do not need a 404.html hack.dist folder into the Netlify Dashboard.npm run build and directory to dist.Upload the contents of the dist folder to your web root (e.g., /var/www/html).
Nginx Configuration:
Because we use Hash Routing (/#/package/react), no special try_files configuration is needed! The default static file serving is sufficient.
server { listen 80; server_name example.com; root /var/www/html; index index.html; location / { try_files $uri $uri/ =404; } }
This application uses HashRouter (e.g., domain.com/#/package/react) instead of BrowserRouter (domain.com/package/react).
index.html, and the client-side router handles the rest via the URL hash.The application fetches data directly from the client browser using registry.npmmirror.com.
To improve performance and reduce API limits during static hosting:
localStorage for 1 hour.