# Bun vs pnpm
## Versions
- **Bun**: 1.2.18 (Latest)
- **pnpm**: 10.x (Latest)
## Comparison (Summarized Table Format)
| Aspect | Bun (v1.2.18) | pnpm (v10.x) |
| ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Installation Speed** | - Blazing-fast installs (20–30× npm speed)<br>- \~15× faster than pnpm (from Bun's blog) | - Very fast (parallel fetch and linking; up to \~2× npm speed)<br>- Not as fast as Bun on cold installs |
| **Disk Space Usage** | - Efficient global cache with hardlinks/clones (each package stored once) | - Content-addressable store; packages hardlinked globally<br>- Virtually no duplicates |
| **Performance** | - Extremely fast JS runtime (JSC); often beats Node.js on CPU tasks<br>- Slower cold starts, higher memory usage | - No runtime overhead (uses Node for scripts)<br>- CLI performance decent but Node-based overhead exists |
| **node\_modules Structure** | - Standard `node_modules` layout (uses global cache to hardlink/clone files) | - Non-flat layout: `node_modules/.pnpm` with hard-linked packages and symlinks forming dep graph |
| **Monorepo Support** | - Supports npm-style workspaces in package.json (can install all workspaces, use filters) <br>- Feature set still maturing (basic use works well) | - Mature workspace support with `pnpm-workspace.yaml`, `workspace:` protocol, linking, etc. (used in large repos) |
| **Compatibility** | - Aims for full Node/npm compatibility; most packages and frameworks work<br>- Some Node APIs or native modules are missing (e.g. build scripts) | - Fully compatible with npm registry and Node (it *is* Node under the hood), runs any standard npm package |
| **Lockfile Format** | - Uses `bun.lock` (JSON/text format) by default (replaced old binary `bun.lockb`) | - Uses `pnpm-lock.yaml` (YAML) – human-readable, diff-friendly, portable |
| **Ecosystem & Stability** | - Newer (launched 2022); rapidly evolving. Gaining popularity but less battle-tested<br>- Early adopters report occasional bugs (especially on Windows) | - Established (since 2017), widely used in production by teams of all sizes (including Microsoft/Rush)<br>- Considered stable and mature |
| **Extra Features** | - All-in-one toolkit: includes built-in bundler (`bun build`), test runner (`bun test`), Node-compatible APIs, SQLite, HTTP/WebSocket, dev server, etc.<br>- Universal plugin API for bundler and runtime | - Focused on package management. Offers Node version management (`pnpm env`), `pnpm dlx`, workspaces support, hooks, etc.<br>- No built-in bundler or test runner. |
| **Developer Experience** | - Single unified CLI (`bun`) for install, add, run, build, etc.<br>- Does *not* run arbitrary lifecycle scripts by default (safer), which can break some packages (e.g. native addons) <br>- Error output from Bun’s runtime (still maturing) | - Familiar npm-like CLI (`pnpm install`, `add`, `run`, etc.); full support for pre/post install scripts (npm-compatible)<br>- Well-established CLI with `pnpmfile.js` hooks, `.npmrc` config, and detailed diagnostics |
| **Documentation & Community** | - Official docs (bun.com/bun.sh) cover key features but are still growing (some sections in progress)<br>- Active GitHub/Discord community but smaller user base. | - Extensive docs (pnpm.io) in multiple languages with guides and benchmarks.<br>- Large community, frequent releases, many sponsors (Battle-tested; used in production). |