npm/Yarn Package Download Bandwidth
Calculate bandwidth and time for npm install, yarn install, or pnpm install. Covers node_modules sizes, cold vs warm cache, and registry performance.
Detailed Explanation
npm Package Download Bandwidth
The npm install command can download hundreds of megabytes of packages, especially for large projects. Understanding these transfer sizes helps with CI/CD planning and developer onboarding.
Typical node_modules Download Sizes
| Project Type | Packages | Download Size | Installed Size |
|---|---|---|---|
| Minimal API | 50-100 | 20-50 MB | 50-150 MB |
| React App (CRA) | 800-1200 | 150-250 MB | 300-500 MB |
| Next.js App | 500-800 | 100-200 MB | 200-400 MB |
| Enterprise Monorepo | 2000-5000 | 300-800 MB | 1-3 GB |
Transfer Time Calculation
Installing a Next.js project (~150 MB download) over different connections:
3G (5 Mbps): 150 * 8 / 5 = 240 seconds = 4 minutes
4G (50 Mbps): 150 * 8 / 50 = 24 seconds
WiFi (100 Mbps): 150 * 8 / 100 = 12 seconds
Fiber (1 Gbps): 150 * 8 / 1000 = 1.2 seconds
npm Registry Performance
The npm registry serves packages from a CDN (Cloudflare):
- Average latency: 50-200 ms per request
- Throughput: Typically 50-200 Mbps per client
- Rate limits: 500 requests per minute (unauthenticated)
- Package tarball download: Limited by CDN and client bandwidth
Reducing Install Bandwidth
- Package lockfiles:
package-lock.jsonoryarn.lockensure reproducible installs - pnpm: Content-addressable storage saves ~60% disk and network
- Caching: CI caches save re-downloading unchanged dependencies
- Verdaccio/Artifactory: Private registry proxy caches packages locally
npm ci: Faster thannpm installfor CI (skips resolution)
Monorepo Considerations
For monorepos with shared dependencies:
Without hoisting: 5 packages * 200 MB = 1 GB total
With hoisting: Shared deps + unique = ~300 MB total
Savings: ~70%
Tools like pnpm, Yarn workspaces, and Turborepo optimize this automatically.
Use Case
Frontend developers estimating project setup times, DevOps engineers sizing CI runner caches, engineering leads planning developer onboarding workflows, and teams evaluating pnpm vs npm vs yarn for bandwidth-constrained environments.