Bun as Package Manager
Bun includes a built-in package manager that's significantly faster than npm, yarn, or pnpm. It's compatible with npm packages and uses the same package.json format.
Speed Advantage
Bun's package manager is fast because:
- Native Code: Written in Zig for maximum performance
- Parallel Downloads: Fetches packages concurrently
- Global Cache: Shares packages across projects
- Symlinks: Uses hard links instead of copying files
Loading Bun Playground...
Package.json Compatibility
Bun uses standard package.json:
Loading Bun Playground...
Workspaces
Bun supports workspaces for monorepos:
Loading Bun Playground...
Lockfile (bun.lockb)
Bun uses a binary lockfile for speed:
Loading Bun Playground...
Running Scripts
Execute scripts with bun run:
Loading Bun Playground...
Exercise: Package Manager Quiz
Test your knowledge of Bun's package manager:
Loading Bun Exercise...
Exercise: Package.json Generator
Create a function to generate a basic package.json:
Loading Bun Exercise...

