| name | bun-development |
| description | Fast, modern JavaScript/TypeScript development with the Bun runtime, inspired by [oven-sh/bun](https://github.com/oven-sh/bun). |
| category | Document Processing |
| source | antigravity |
| tags | ["javascript","typescript","react","node","api","ai","template","document","rag","cro"] |
| url | https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/bun-development |
⚡ Bun Development
Fast, modern JavaScript/TypeScript development with the Bun runtime, inspired by oven-sh/bun.
When to Use This Skill
Use this skill when:
- Starting new JS/TS projects with Bun
- Migrating from Node.js to Bun
- Optimizing development speed
- Using Bun's built-in tools (bundler, test runner)
- Troubleshooting Bun-specific issues
1. Getting Started
1.1 Installation
brew install oven-sh/bun/bun
tmpdir="$(mktemp -d)"
trap 'rm -rf "$tmpdir"' EXIT
curl -fsSLo "$tmpdir/bun-install.sh" https://bun.sh/install
cat "$tmpdir/bun-install.sh"
bash "$tmpdir/bun-install.sh"
powershell -NoProfile -Command "Invoke-WebRequest https://bun.sh/install.ps1 -OutFile $env:TEMP\\bun-install.ps1; Get-Content $env:TEMP\\bun-install.ps1 -TotalCount 120; powershell -ExecutionPolicy Bypass -File $env:TEMP\\bun-install.ps1"
brew tap oven-sh/bun
brew install bun
npm install -g bun
bun upgrade
1.2 Why Bun?
| Feature | Bun | Node.js |
|---|
| Startup time | ~25ms | ~100ms+ |
| Package install | 10-100x faster | Baseline |
| TypeScript | Native | Requires transpiler |
| JSX | Native | Requires transpiler |
| Test runner | Built-in | External (Jest, Vitest) |
| Bundler | Built-in | External (Webpack, esbuild) |
2. Project Setup
2.1 Create New Project
bun init
bun create <template> <project-name>
bun create react my-app
bun create next my-app
bun create vite my-app
bun create elysia my-api
2.2 package.json
{
"name": "my-bun-project",
"version": "1.0.0",
"module": "index.ts",
"type": "module",
"scripts": {
"dev": "bun run --watch index.ts",
"start": "bun run index.ts",
"test": "bun test",
"build": "bun build ./index.ts --outdir ./dist",
"lint": "bunx eslint ."
},
"devDependencies": {
"@types/bun": "latest"
},
"peerDependencies": {
"typescript": "^5.0.0"
}
}
2.3 tsconfig.json (Bun-optimized)
{
"compilerOptions": {
"lib": ["ESNext"],
"module": "esnext",
"target": "esnext",
"moduleResolution": "bundler",
"moduleDetection": "force",
"allowImportingTsExtensions": true,
"noEmit": true,
"composite": true,
"strict": true,
"downlevelIteration": true,
"skipLibCheck": true,
"jsx": "react-jsx"
3. Package Management
3.1 Installing Packages
bun install
bun add express
bun add -d typescript
bun add -D @types/node
bun add --optional pkg
bun add lodash --registry https://registry.npmmirror.com
bun add react@18.2.0
bun add react@latest
bun add react@next
bun add github:user/repo
bun add git+https://github.com/user/repo.git
3.2 Removing & Updating
bun remove lodash
bun update
bun update lodash
bun update --latest
bun outdated
3.3 bunx (npx equivalent)
bunx prettier --write .
bunx tsc --init
bunx create-react-app my-app
bunx -p typescript@4.9 tsc --version
bunx cowsay "Hello from Bun!"
3.4 Lockfile
bun install --yarn
bun install --frozen-lockfile
4. Running Code
4.1 Basic Execution
bun run index.ts
bun run index.js
bun run server.ts --port 3000
bun run dev
bun run build
bun dev
bun build
4.2 Watch Mode
bun --watch run index.ts
bun --hot run server.ts
4.3 Environment Variables