| [ Web Proxy ] |
| Viewing: https://bun.com | [Back] [Original] |
Runtime, package manager, test runner and bundler in a single binary. Use bun install or bun test in an existing Node.js project, or run the whole thing on Bun.
Install Bun v1.4.2
curl -fsSL https://bun.sh/install | bashwarm cache seconds (lower is better)
| runtime | version | install time | peak RAM |
|---|---|---|---|
| bun | v1.4 | 210 s | 12 MB |
| yarn | v1.22.22 | 1,760 s | 205 MB |
| pnpm | v11.21.0 | 1,920 s | 1.4 GB |
| npm | v12.0.2 | 4,450 s | 698 MB |
hello-world app requests per second (higher is better)
| runtime | version | requests/sec | peak RAM |
|---|---|---|---|
| Bun | v1.4 | 48,243 req/s | 105 MB |
| Node.js | v26.7.0 | 25,181 req/s | 142 MB |
| Deno | v2.9.5 | 19,243 req/s | 176 MB |
100 rows 100 queries in flight queries per second (higher is better)
| runtime | version | queries/sec | peak RAM |
|---|---|---|---|
| Bun | v1.4 | 20,243 queries/s | 80 MB |
| Deno | v2.9.5 | 10,406 queries/s | 181 MB |
| Node.js | v26.7.0 | 10,000 queries/s | 168 MB |
32 clients broadcasting messages per second (higher is better)
| runtime | version | messages/sec | peak RAM |
|---|---|---|---|
| Bun (publish) | v1.4 | 4,170,027 msgs/s | 51 MB |
| Bun (send) | v1.4 | 159,379 msgs/s | 37 MB |
| Deno | v2.9.5 | 124,088 msgs/s | 1.2 GB |
| ws (Node.js) | v26.7.0 | 123,486 msgs/s | 78 MB |
Used by
bun install and bun test drop into existing Node.js projects. No runtime switch required.
replaces Node.js
Runs JavaScript & TypeScript on JavaScriptCore. Node.js APIs, node_modules and your framework work as-is.
$ bun run index.tsxreplaces npm yarn pnpm
npm-compatible, up to 30 faster. Workspaces, catalogs, overrides, patches and a lockfile you can read.
$ bun installreplaces Jest Vitest
Jest-compatible expect(), mocks, snapshots, DOM and coverage starting in milliseconds.
$ bun testreplaces esbuild Vite webpack
TS, JSX, CSS & HTML for browsers and servers. Dev server with HMR. Single-file executables.
$ bun build ./app.tsxA minute with Bun
Install, develop, run, test and ship with the same tool. Every step below is a real command with real output click one, or just watch.
$ bun installReads your package.json, migrates your lockfile, and installs from a global cache up to 30 faster than npm. Docs$ bun ./index.htmlPoint Bun at an HTML file: React, TypeScript, Tailwind and CSS just work, with hot reloading that keeps state. Docs$ bun run server.tsNo build step, no ts-node. Bun.serve() handles HTTP, routing and WebSockets; SQL, Redis and S3 clients are built in. Docs$ bun testJest-compatible expect(), mocks, snapshots and DOM testing starting in milliseconds instead of seconds. Docs$ bun build ./cli.ts --compile --outfile todoBundle your app and the Bun runtime into one executable. Cross-compile for Linux, macOS and Windows from any machine. Docs$ bun installbun install v1.4.2 (0aa2b1cd)Resolving [712/712]+ react@19.1.0+ react-dom@19.1.0+ next@15.4.1+ tailwindcss@4.1.11+ typescript@5.9.2 (+ 706 more)712 packages installed [1.18s]$
v1.4.2Latest release September 2026
Bun 1.4.2 fixes 7 issues, including two v1.4.1 regressions: a bun build rename bug impacting Elysia apps and an AsyncLocalStorage memory leak. It also fixes worker_threads 'online' ordering, GC and JIT crashes, CMYK JPEG decoding in Bun.Image and a bun install lockfile panic, and upgrades JavaScriptCore.
$ bun upgradebun buildno longer renames a var onto a let in the same block (v1.4.1 regression that broke Elysia)AsyncLocalStorageexit() and nested run() no longer retain the outer storeworker_threads'online' arrives before the worker's first messages, unblocking @discordjs/wsBun.Imagedecodes CMYK and YCCK JPEGs.json()rejects invalid JSON with the same SyntaxError as JSON.parsebun installno longer panics on a lockfile with a mismatched package-name hashIn production
Claude Code ships to millions of developers as a Bun executable. Midjourney pushes every image notification through Bun's WebSocket server. Railway runs its serverless functions on it. Hear it from them:
[]Boris ChernyHead of Claude Code, AnthropicClaude Code
Claude Code is a single file with Bun inside it. Users download it and run it. There is no install step and no startup lag.
[]Cheng LouEngineer, MidjourneyMidjourney
Pub/sub, backpressure and per-message compression are built into Bun.serve() no ws, no socket.io, no sidecar.
[]Jake CooperFounder, RailwayRailway
A Railway Function is a TypeScript file. Bun runs it as-is, so a deploy skips the build and a cold start takes milliseconds.
[]Lee RobinsonVP of Developer Experience, CursorFrameworks
Node.js compatibility means your framework already works. Swap npm run dev for bun --bun run dev and keep shipping with Bun's SQL, S3 and shell APIs available right inside your route handlers.
import { s3, $, sql } from "bun";export default async function BlogPage({ params }) {const [post] = await sql`SELECT * FROM posts WHERE slug = ${params.slug}`;const img = s3.file(post.imageKey).presign();const words = await $`wc -w < ${post.file}`.text();return <Article post={post} img={img} words={words} />;}
bun install
Cold cache, warm cache, CI, a no-op reinstall one T3-stack Next.js app, 25 direct dependencies, ~220 packages in the lockfile, measured six ways against npm, pnpm and yarn at their defaults.
Linux x64, EPYC 9R14 bench/install in oven-sh/bun each package manager with its own lockfile and node_modules, state prepared per scenario before every run, every package manager at defaults medians of 3, peak memory is the largest of the 3 runsreproduce the benchmark
| scenario | bun | npm | pnpm | yarn |
|---|---|---|---|---|
| First install, ever (no cache no lockfile no node_modules) | 1.41s | 18.12s | 13.49s | 20.51s |
| Fresh checkout, warm cache (no lockfile yet every package already in the cache) | 251ms | 7.61s | 2.38s | 1.83s |
| CI without a cache (lockfile committed every tarball fetched from the registry) | 951ms | 4.92s | 11.69s | 17.61s |
| CI with a warm cache (lockfile committed dependency cache restored node_modules rebuilt) | 210ms | 4.45s | 1.92s | 1.76s |
| node_modules there, cache gone (already installed only the dependency cache was cleared) | 12ms | 384ms | 399ms | 212ms |
| Everything already up to date (the reinstall after nothing changed) | 12ms | 337ms | 400ms | 211ms |
All-in-one usually means heavier. Bun goes the other way: the same runs as the benchmarks above, measured by peak resident memory, come in under Node.js and Deno while doing more work per second. One binary, more throughput, less RAM.
Linux x64, AMD EPYC 9R14 (64 vCPU), kernel 6.1 medians of 3 full methodology in each benchmark's README.
Batteries included
Most servers need an HTTP stack, a database client, Redis, S3, hashing and a way to shell out. Bun ships all of them, so that is a stack of packages you never install or patch.
Bun.serve() with routes, params and static responses.
Docsserver.ts
import { serve, sql } from "bun";
const server = serve({
port: 3000,
routes: {
"/": new Response("Welcome to Bun!"),
"/api/users/:id": async req => {
const [user] = await sql`SELECT * FROM users WHERE id = ${req.params.id}`;
return Response.json(user);
},
},
});
console.log(`Listening on ${server.url}`);Pub/sub WebSocket server, built into Bun.serve().
Docschat.ts
Bun.serve({
fetch(req, server) {
if (server.upgrade(req, { data: { room: "lobby" } })) return;
return new Response("Expected a WebSocket", { status: 400 });
},
websocket: {
open(ws) {
ws.subscribe(ws.data.room);
},
message(ws, message) {
// broadcast to everyone in the room
ws.publish(ws.data.room, message);
},
},
});Bun.sql tagged templates, pipelining, transactions.
Docsdb.ts
import { sql } from "bun";
// Parameters are escaped automatically
const active = await sql`
SELECT * FROM users
WHERE active = ${true}
LIMIT 10
`;
// Insert with object notation
const [user] = await sql`
INSERT INTO users ${sql({ name: "Alice", email: "alice@example.com" })}
RETURNING *
`;A fast Redis client with Pub/Sub no driver to install.
Docscache.ts
import { redis } from "bun";
await redis.set("greeting", "Hello from Bun!");
const greeting = await redis.get("greeting");
await redis.hset("user:1", { name: "Alice", plan: "pro" });
await redis.expire("user:1", 3600);
const subscriber = redis.duplicate();
await subscriber.subscribe("events", message => {
console.log("event:", message);
});Read, write and presign objects on any S3-compatible store.
Docsstorage.ts
import { s3 } from "bun";
const file = s3.file("uploads/avatar.png");
await file.write(await Bun.file("./avatar.png").bytes(), {
type: "image/png",
});
const url = file.presign({ expiresIn: 3600 });
const exists = await file.exists();Bun.$ cross-platform bash-like scripting with JS interop.
Docsdeploy.ts
import { $ } from "bun";
// Works the same on macOS, Linux and Windows
const branch = await $`git rev-parse --abbrev-ref HEAD`.text();
await $`bun run build`;
// Pipe a fetch() Response straight through gzip
const res = await fetch("https://example.com/data.json");
await $`gzip -9 < ${res} > data.json.gz`;
console.log(`deployed ${branch.trim()}`);bun test Jest-compatible, concurrent, instant startup.
Docsmath.test.ts
import { describe, expect, mock, test } from "bun:test";
describe("math", () => {
test("addition", () => {
expect(2 + 2).toBe(4);
});
test.concurrent("fetches a user", async () => {
const res = await fetch("https://api.example.com/users/1");
expect(res.status).toBe(200);
});
test("mocks", () => {
const fn = mock(() => 42);
fn();
expect(fn).toHaveBeenCalledTimes(1);
});
});argon2 & bcrypt hashing without native addons.
Docsauth.ts
const password = "super-secure-pa$$word";
const hash = await Bun.password.hash(password);
// => $argon2id$v=19$m=65536,t=2,p=1$tFq+9AVr1bf...
const ok = await Bun.password.verify(password, hash);
// => true
const legacy = await Bun.password.hash(password, {
algorithm: "bcrypt",
cost: 12,
});Import an HTML file and you have a full-stack dev server.
Docsapp.ts
import { serve } from "bun";
import homepage from "./index.html";
import dashboard from "./dashboard.html";
serve({
routes: {
"/": homepage,
"/dashboard": dashboard,
"/api/health": () => Response.json({ ok: true }),
},
development: {
hmr: true, // hot module reloading
console: true, // stream browser logs to this terminal
},
});Call into C, Rust or Zig shared libraries.
Docssqlite-version.ts
import { dlopen, FFIType, suffix } from "bun:ffi";
// "dylib" on macOS, "so" on Linux, "dll" on Windows
const lib = dlopen(`libsqlite3.${suffix}`, {
sqlite3_libversion: {
args: [],
returns: FFIType.cstring,
},
});
console.log(`SQLite ${lib.symbols.sqlite3_libversion()}`);Frontend
Point Bun at an HTML file and you get a dev server with instant hot reloading, then bun build --production for optimized bundles. React, TypeScript, Tailwind and CSS imports work out of the box.
bun init --reactScaffold a React app (or add index.html to any project).
bun ./index.htmlDev server with HMR that preserves state; browser logs stream to your terminal.
bun build ./index.html --productionTree-shaken, minified, code-split bundles.
| Feature | Node.js | Deno | |
|---|---|---|---|
| Runtime | |||
| Node.js compatibility | |||
| Web Standard APIs | |||
| TypeScript | |||
| JSX | |||
| Native addons | |||
| Module loader plugins | |||
| Built-in APIs | |||
| PostgreSQL, MySQL & SQLite drivers | |||
| S3 client | |||
| Redis client | |||
| Tooling | |||
Install Bun, open the project you were already working on, and run bun install. Your code, dependencies and scripts stay exactly as they are.
curl -fsSL https://bun.sh/install | bashProduct
DocumentationGuidesAPI ReferenceBlogInstallToolkit
RuntimePackage managerTest runnerBundlerCommunity
GitHubDiscordX (Twitter)MerchCompany
Bun AnthropicPress kitLicenseBaked with in San Francisco 2026 Anthropic, PBC
| Web Proxy Viewer | New URL | Original Page |