Setup Steps
1. Install Bun:
curl -fsSL https://bun.sh/install | bash2. Reload your shell:
source ~/.bashrc3. Check version:
bun --version4. Create a new project:
bun init5. Install packages (npm compatible):
bun install express
bun add react react-dom6. Run a TypeScript file:
bun run index.ts7. Run scripts:
bun run dev
bun run build8. Bun's built-in test runner:
bun test9. Use as a package manager (much faster):
bun install # instead of npm install
bun add package # instead of npm install package10. HTTP server (built-in):
typescript
Bun.serve({
port: 3000,
fetch(req) {
return new Response("Hello Bun!")
}
})