Home › Bun › Bun runtime CLAUDE.md
Bun runtime CLAUDE.md
CLAUDE.md for TypeScript projects on Bun 1.2+: bun test, Bun.serve, built-in SQLite/Postgres, and bundling.
Claude Code (CLAUDE.md)Bun
How to use
Save this as CLAUDE.md in your repository root, commit it, and your agent will pick it up automatically. Edit the commands to match your project.
CLAUDE.mdDownload # CLAUDE.md: Bun project
## Commands
- Install: `bun install` (lockfile `bun.lock`) · Run: `bun run dev` · Test: `bun test` · Types: `bunx tsc --noEmit`
## Use Bun's built-ins first
- HTTP: `Bun.serve({ routes: {...}, fetch })` instead of adding Express.
- Files: `Bun.file(path)` / `Bun.write`. Shell scripts: `import { $ } from "bun"`.
- SQLite via `bun:sqlite`; Postgres via `Bun.sql` if the project uses it. Use parameterized queries (tagged templates), never string concatenation.
- Env vars load from `.env` automatically; read with `Bun.env` or `process.env`. Don't add `dotenv`.
- Password hashing: `Bun.password.hash/verify`.
- Tests: `import { test, expect, mock } from "bun:test"`. Don't add Jest or Vitest.
## Rules
- Keep code Node-compatible only if `package.json` says the package must run on Node too.
- Use `bun add` / `bun add -d` so the lockfile stays in sync; never edit `bun.lock` by hand.
- TypeScript runs directly; no build step for scripts. Use `bun build` only for shipping bundles.
## Don't
- Don't use `npm`/`yarn`/`pnpm` commands in this repo.
## Done when
`bun test` and `bunx tsc --noEmit` pass.