Practical Bun Docs
A bilingual, task-oriented Bun knowledge base for newcomers and AI agents
Last updated on
Bun is a JavaScript and TypeScript toolchain. One executable provides a runtime, package manager, test runner, and bundler. This field guide complements the official Bun API reference with shorter learning paths, explicit decision boundaries, and context that agents can consume directly.
Pick a reading path
I am new to Bun
Install it, build the mental model, and finish a small project.
I am migrating a Node.js project
Adopt one boundary at a time and verify compatibility.
I am an AI agent
Route the task first, then load only the pages you need.
I am deploying to cloud
Distinguish the real runtime across containers, serverless, and edge.
I am building an AI app
Streaming, tool safety, RAG, observability, and evaluations.
I need data and storage
Bun.SQL, Redis, S3, Drizzle, and production connection boundaries.
I need a production baseline
TypeScript, CI, supply chain, environment, and release gates.
I need a command
A compact map of commands, config files, and diagnostics.
Capability and task map
| Goal | First command | Guide |
|---|---|---|
Execute .js, .ts, or .tsx | bun run <file> | Runtime |
| Install npm packages | bun install / bun add | Package manager |
| Run Jest-style tests | bun test | Test runner |
| Produce browser or server artifacts | bun build | Bundler |
| Organize applications and shared packages | bun --filter | Monorepos and workspaces |
| Use SQL, Redis, or S3 | Bun.SQL / RedisClient / S3Client | Data and storage |
| Establish reproducible release gates | bun ci | Production engineering baseline |
| Choose frameworks, ORMs, and tooling | List constraints first | Ecosystem decisions |
Version language
These guides use 1.x for the stable major line instead of baking a fast-expiring patch number into examples. Run bun --version and consult the matching official release notes when behavior depends on a precise version.
Two audiences, one source of truth
- Newcomer pages explain intent and mental models before commands, expected results, and common failure modes.
- Agent pages keep stable headings, explicit prerequisites, decision tables, and clear “do not guess” boundaries.
- Append
.mdto any docs URL for Markdown. The site also publishes/en/llms.txtand/en/llms-full.txt.