Bun
Overview
Bun is an all-in-one toolkit for JavaScript and TypeScript apps, designed as a drop-in replacement for Node.js. It ships as a single dependency-free executable that bundles a runtime, package manager, bundler, and test runner. Written in Zig and powered by JavaScriptCore, it targets fast startup and install times. Read this when you want a single fast tool covering run, install, build, and test.
Official sources
Install / setup
macOS & Linux (from the official installation page):
curl -fsSL https://bun.com/install | bash
Windows (PowerShell):
powershell -c "irm bun.sh/install.ps1|iex"
Verify the install:
bun --version
bun --revision
Core concepts
- Single executable provides runtime, package manager (
bun install), bundler (bun build), and test runner (bun test).
- Native TypeScript and JSX support — run
.ts/.tsx directly without a separate transpile step.
- Node.js compatibility layer aims for drop-in replacement of
node, including many built-in modules and npm packages.
- Bun-specific APIs (e.g.
Bun.serve, Bun.file) offer optimized I/O and HTTP serving.
bun.lockb/lockfile and a fast, npm-compatible install resolve dependencies from the npm registry.
- The binary upgrades itself via
bun upgrade.
Best practices
- Verify after install and add
~/.bun/bin to PATH if bun is not found (per the installation docs).
- Use
bun install to leverage the integrated, fast package manager and its lockfile.
- Pin to stable releases; canary builds are untested and upload crash reports (installation docs).
- Run TypeScript directly with
bun run instead of adding a separate transpiler step.
Common pitfalls
- Assuming 100% Node.js parity → check the Node compatibility docs for unsupported APIs before migrating.
- On Linux, missing
unzip breaks the install script → install unzip first (installation docs).
- Using a baseline build on a modern CPU unnecessarily → only use baseline builds when you hit "Illegal Instruction" errors.
Examples
const server = Bun.serve({
port: 3000,
fetch(req) {
return new Response('Hello from Bun');
},
});
console.log(`listening on ${server.url}`);
Further reading
Related skills
- ../node — the runtime Bun aims to replace
- ../deno — alternative secure JS/TS runtime
1---2name: bun3description: Bun — fast all-in-one JS/TS runtime, bundler, test runner, and package manager; a Node.js drop-in. Consult for fast JS/TS dev and tooling.4domain: stack5category: runtime6tags: [bun, javascript, typescript, runtime, bundler, package-manager]7official_sources:8 - https://bun.com/docs9 - https://github.com/oven-sh/bun10verified: 2026-06-1611metadata:12 source: https://skillmd.com/skills/gabriel7silva/bun13---1415# Bun1617## Overview18Bun is an all-in-one toolkit for JavaScript and TypeScript apps, designed as a drop-in replacement for Node.js. It ships as a single dependency-free executable that bundles a runtime, package manager, bundler, and test runner. Written in Zig and powered by JavaScriptCore, it targets fast startup and install times. Read this when you want a single fast tool covering run, install, build, and test.1920## Official sources21- Docs: https://bun.com/docs22- Repo: https://github.com/oven-sh/bun23- Install / download: https://bun.com/docs/installation2425## Install / setup26macOS & Linux (from the official installation page):2728```bash29curl -fsSL https://bun.com/install | bash30```3132Windows (PowerShell):3334```powershell35powershell -c "irm bun.sh/install.ps1|iex"36```3738Verify the install:3940```bash41bun --version42bun --revision43```4445## Core concepts46- Single executable provides runtime, package manager (`bun install`), bundler (`bun build`), and test runner (`bun test`).47- Native TypeScript and JSX support — run `.ts`/`.tsx` directly without a separate transpile step.48- Node.js compatibility layer aims for drop-in replacement of `node`, including many built-in modules and npm packages.49- Bun-specific APIs (e.g. `Bun.serve`, `Bun.file`) offer optimized I/O and HTTP serving.50- `bun.lockb`/lockfile and a fast, npm-compatible install resolve dependencies from the npm registry.51- The binary upgrades itself via `bun upgrade`.5253## Best practices54- Verify after install and add `~/.bun/bin` to `PATH` if `bun` is not found (per the installation docs).55- Use `bun install` to leverage the integrated, fast package manager and its lockfile.56- Pin to stable releases; canary builds are untested and upload crash reports (installation docs).57- Run TypeScript directly with `bun run` instead of adding a separate transpiler step.5859## Common pitfalls60- Assuming 100% Node.js parity → check the Node compatibility docs for unsupported APIs before migrating.61- On Linux, missing `unzip` breaks the install script → install `unzip` first (installation docs).62- Using a baseline build on a modern CPU unnecessarily → only use baseline builds when you hit "Illegal Instruction" errors.6364## Examples65```ts66const server = Bun.serve({67 port: 3000,68 fetch(req) {69 return new Response('Hello from Bun');70 },71});7273console.log(`listening on ${server.url}`);74```7576## Further reading77- Documentation index: https://bun.com/docs78- Runtime / Node compatibility: https://bun.com/docs/runtime/nodejs-apis7980## Related skills81- ../node — the runtime Bun aims to replace82- ../deno — alternative secure JS/TS runtime