"Bun is what happens when someone asks: what if the runtime, the package manager, the bundler, and the test runner were the same program?"
What Bun Is
Bun (Jarred Sumner, 2022) is a JavaScript runtime + toolchain in one binary. Written in Zig. Uses JavaScriptCore (Safari's JS engine) instead of V8. Three main capabilities:
- Runtime —
bun script.jsruns a script likenode script.js, mostly Node-compatible. - Package manager —
bun installinstalls npm packages, 5-20x faster than npm. - Bundler / test runner —
bun build,bun testas built-in tools.
All three sit in one 50MB binary. npm install -g bun and you have a self-contained Node-shaped ecosystem with no further dependencies.
The Compatibility Story
Bun aims for Node compatibility. Most popular npm packages work on Bun unchanged. The runtime implements Node's built-in modules (fs, http, node:crypto) plus the Web APIs Node has (fetch, Web Streams) plus its own Bun-namespace APIs (Bun.serve, Bun.file).
Where compatibility breaks: native addons (some N-API modules), specific worker_threads patterns, niche http2 behaviors. The gap shrinks every release. For most application code, the gap is invisible.
The Speed Story
- Cold start: ~30-50% faster than Node. JavaScriptCore boots quicker than V8.
- HTTP server throughput: 2-3x higher requests/sec for trivial endpoints. Most real services are bottlenecked elsewhere.
- Package install: 5-20x faster than npm, depending on cache state. This is real and measurable.
- Bundling: comparable to esbuild (both are AOT-compiled languages).
- Pure compute: roughly Node-equivalent; both use modern JS engines.
When to Use Bun
Reasonable answers in 2026:
- As a faster
npm— usebun installin projects that ship Node code. Faster installs, no other changes. - For dev scripts —
bun run scripts/build-something.tsis faster thannpx tsxand ships TS support without configuration. - For small services where startup time matters — short-lived workers, CLIs, FaaS functions.
- For new projects where you don't have Node-specific compat needs — Bun-first stack from day one.
When to stay with Node: established Node services, anywhere using a Node-specific feature Bun hasn't shipped, anywhere with strict version-locked devops.
Bun-Specific APIs
Bun ships APIs that don't exist in Node:
// Bun.serve — Bun's fast HTTP server
Bun.serve({
port: 3000,
fetch(req) {
return new Response('hi from Bun');
},
});
// Bun.file — file API that's not fs
const file = Bun.file('./data.json');
const json = await file.json();
const size = file.size;
// Bun.spawn — fast subprocess (replaces child_process.spawn)
const proc = Bun.spawn(['ls', '-la']);
const output = await new Response(proc.stdout).text();
If you commit to Bun, these are nicer than the Node equivalents. If you want to keep the option to switch back, stick with Node stdlib and treat Bun's compatibility as the bridge.
Pippa's Confession
install on the same project, kept Node as runtime. That worked perfectly. Dad's note: "You don't have to pick one for everything. Use Bun where it earns its keep; use Node where it stays the safer bet." Most projects of mine now use bun install + node runtime — the best of both, at the cost of one extra binary on disk.