The app is a fully static site. There is no server. All data is pre-fetched at build time by a GitHub Action and baked into public/data.json. Users load that single file — no API calls happen in their browser.
git init
git add .
git commit -m "Initial commit"
# Create the repo on GitHub (replace with your username/repo name)
gh repo create your-username/npm-visualizer --public --source=. --pushOr create the repo manually on github.com and push:
git remote add origin https://github.com/your-username/npm-visualizer.git
git push -u origin main- Go to your repo on GitHub → Settings → Pages
- Under Source, select GitHub Actions
- Save
That's it. The workflow handles everything else.
The workflow runs automatically on every push to main. Your initial push in step 1 will trigger it.
You can also trigger it manually:
- Go to Actions → Fetch data & deploy to GitHub Pages → Run workflow
The workflow will:
- Fetch download stats from the npm API (last 18 months)
- Fetch package metadata from the npm registry
- Fetch GitHub star counts (authenticated via the built-in
GITHUB_TOKEN— no setup needed) - Write everything to
public/data.json - Build the Vite app
- Deploy to
https://your-username.github.io/npm-visualizer/
First deploy takes ~1 minute. After that it auto-refreshes every 6 hours.
Edit one file:
// src/constants/packages.ts
export const PACKAGES = [
'@your-org/package-one',
'@your-org/package-two',
// ...
] as const;Commit and push — the Action will re-fetch and redeploy automatically.
To see real data locally, run the fetch script first:
bun run fetch-data # writes public/data.json
bun run dev # starts at http://localhost:5173Without running fetch-data, the app loads with empty data (skeletons).
| Step | Where |
|---|---|
| Package list | src/constants/packages.ts |
| Data fetch script | scripts/fetch-data.ts |
| GitHub Actions workflow | .github/workflows/deploy.yml |
| Data refresh schedule | Every 6 hours (cron 0 */6 * * *) |
| Data served from | public/data.json → dist/data.json |
| GitHub API auth | Auto via secrets.GITHUB_TOKEN (built-in, no setup) |