bun
Original:🇺🇸 English
Translated
Use Bun instead of Node.js, npm, pnpm, or vite. Provides command mappings, Bun-specific APIs, and development patterns.
3installs
Sourcebrianlovin/claude-config
Added on
NPX Install
npx skill4agent add brianlovin/claude-config bunTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →Bun Runtime
Use Bun as the default JavaScript/TypeScript runtime and package manager.
Command Mappings
| Instead of | Use |
|---|---|
| |
| |
| |
| |
| |
| |
Bun automatically loads files - don't use dotenv.
.envBun-Specific APIs
Prefer these over Node.js equivalents:
| API | Purpose | Don't use |
|---|---|---|
| HTTP server with WebSocket, HTTPS, routes | express |
| SQLite database | better-sqlite3 |
| Redis client | ioredis |
| Postgres client | pg, postgres.js |
| File operations | node:fs readFile/writeFile |
| Shell commands | execa |
| WebSocket client (built-in) | ws |
Testing
Use for tests:
bun:testts
import { test, expect } from "bun:test";
test("description", () => {
expect(1).toBe(1);
});Run with .
bun testFrontend Development
Use HTML imports with instead of Vite. Supports React, CSS, Tailwind.
Bun.serve()Server:
ts
import index from "./index.html"
Bun.serve({
routes: {
"/": index,
"/api/users/:id": {
GET: (req) => Response.json({ id: req.params.id }),
},
},
development: { hmr: true, console: true }
})HTML file:
html
<html>
<body>
<script type="module" src="./app.tsx"></script>
</body>
</html>Bun's bundler transpiles , , automatically. CSS is bundled via tags.
.tsx.jsx.js<link>Run with for HMR.
bun --hot ./server.tsDocumentation
For detailed API docs, see .
node_modules/bun-types/docs/**.md