Bun adalah JavaScript runtime baru yang jauh lebih cepat dari Node.js. ## Apa itu Bun?
Bun adalah all-in-one toolkit:
- JavaScript/TypeScript runtime
- Package manager (pengganti npm/yarn)
- Bundler
- Test runner
Instalasi
curl -fsSL https://bun.sh/install | bash
Penggunaan Dasar
# Install dependencies (2-10x lebih cepat dari npm)
bun install
# Run script
bun run dev
# Run TypeScript langsung (tanpa compile)
bun index.ts
# Run tests
bun test
# Init project
bun init
Bun vs Node.js
- Install speed: Bun 10x lebih cepat
- Runtime speed: Bun 3-5x lebih cepat untuk banyak use case
- TypeScript: Bun native support, Node perlu compiler
- Compatibility: Bun compatible dengan sebagian besar npm packages
Dengan Next.js
Next.js sudah support Bun:
bun create next-app my-app
cd my-app
bun run dev
Kapan Pakai Bun?
- Project baru → Langsung pakai Bun
- Project existing → Pertimbangkan migrasi kalau tidak ada blocker
- Production → Sudah stable untuk production use
Bun bukan cuma hype — ini improvement nyata untuk developer experience.