GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing bun.com — Bun — A fast all-in-one JavaScript runtime NEWBun v1.4.4 released→ Bun is a fast JavaScript runtime & toolkit. All in one.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.4 $ curl -fsSL https://bun.sh/install | bash> powershell -c "irm bun.sh/install.ps1|iex"Installing a Next.js appwarm cache · seconds (lower is better) bun v1.4 0.21s yarn v1.22.22 1.76s pnpm v11.21.0 1.92s npm v12.0.2 4.45s 0s1s2s3s4s5s T3-stack app, 25 direct dependencies, ~220 packages in the lockfile · warm cache · lockfile present · node_modules removed · Linux x64, EPYC 9R14 · every package manager at defaults · medians of 3reproduce
Serving Express over HTTPShello-world app · requests per second (higher is better) req/s peak RAM Bun v1.4 48,243 105 MB Node.js v26.7.0 25,181 142 MB Deno v2.9.5 19,243 176 MB hello-world app · express 5.2.1 · bombardier -c 50 -d 5s · TLS 1.3 · Linux x64, EPYC 9R14 · medians of 3reproduce
Querying Postgres100 rows × 100 queries in flight · queries per second (higher is better) queries/s peak RAM Bun v1.4 20,243 80 MB Deno v2.9.5 10,406 181 MB Node.js v26.7.0 10,000 168 MB SELECT 100 rows · 100 queries in flight · 100k queries total · localhost PostgreSQL 18.3 · Bun.sql vs postgres.js 3.4.9 · Linux x64, EPYC 9R14 · medians of 3reproduce
Running a WebSocket chat server32 clients broadcasting · messages per second (higher is better) msgs/s peak RAM Bun (publish) v1.4 4.17M 51 MB Bun (send) v1.4 159K 37 MB Deno v2.9.5 124K 1.2 GB ws (Node.js) v26.7.0 123K 78 MB 32 closed-loop clients broadcasting, delivery confirmed per message · ws 8.21.3 on Node.js · Linux x64, EPYC 9R14 · medians of 3reproduce
Used by Four tools, designed together. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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: "[email protected]" })}
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 Aiming to be a drop-in replacement for Node.js apps | |||
Web Standard APIsfetch, URL, EventTarget, Headers, streams… | Powered by WebCore (from WebKit/Safari) | ||
| TypeScript First-class, including "paths", enum, namespace | |||
| JSX First-class support without configuration | |||
| Native addons Call C-compatible native code from JavaScript | bun:ffi, N-API, partial V8 C++ API | ||
| Module loader plugins Import custom file types | Bun.plugin works in browsers & Bun | 3 different loader APIs, server-side only | |
| Built-in APIs | |||
| PostgreSQL, MySQL & SQLite drivers One fast, unified SQL API | Fastest available, with query pipelining | ||
| S3 client Upload and download from S3-compatible storage | Fastest available | ||
| Redis client With Pub/Sub | |||
| HTTP server & router Dynamic routes and wildcards in Bun.serve() | Bun.serve({ routes }) | Server, no router | Server, no router |
| WebSocket server with pub/sub Built into Bun.serve() with backpressure | |||
| Single-file executables Compile to a standalone binary that runs anywhere | Cross-compilation, embedded files, bytecode & code signing | No native addons, embedded files, cross-compilation or bytecode | No native addons, no cross-compilation |
| YAML, TOML, Markdown First-class parsers and imports | |||
| Cookies & CSRF Map-like cookies API, CSRF tokens | |||
| Encrypted secrets storage OS keychain / libsecret / Credential Manager | |||
| Tooling | |||
| Package manager Install, manage & publish npm packages | Catalogs, isolated installs, audit, why | Limited features | |
| Bundler Production builds for frontend & backend | |||
| Frontend dev server HMR, browser → terminal logs | |||
| Jest-compatible test runner With VS Code integration & concurrent execution | node:test, not Jest-compatible | Deno.test, not Jest-compatible | |
| Cross-platform $ shell bash-like scripting on every OS | Requires dax | ||
| Server hot reloading Reload code without dropping connections | |||
| Monorepo support Workspaces, --filter, catalogs | Workspaces only | ||
| Formatter & linter Built in | |||
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 | bashpowershell -c "irm bun.sh/install.ps1|iex"