Guide · Runtimes

Bun vs Node.js in production: when I choose each

I use both. Bun is fast and pleasant, with a test runner, bundler and package manager built in. Node.js is the battle-tested default. The right choice depends less on benchmarks and more on your dependencies and how you operate in production.

The short answer

  • New, small service with mainstream dependencies? Bun is a great choice.
  • Long-lived, business-critical service with native addons or an APM agent? Stay on Node.js unless you have a measured reason to move.
  • Not sure? Adopt Bun for tooling first (installs, tests, scripts) and keep Node.js in production.

Side by side

BunNode.js
Startup & cold startVery fastGood, slower
Package installsMuch fasternpm, pnpm, yarn
Built-in toolingTest runner, bundler, TS/JSXTest runner, watch mode, env files
npm compatibilityHigh, with edge casesThe reference implementation
Native addonsPartial, test each oneFull
Debugging & APMImprovingMature ecosystem
Release modelFast-movingLTS schedule

New service? Use Bun's native HTTP server, not Express

Bun ships its own HTTP server, Bun.serve, with routing built in. On a new project, it's my default instead of Express: zero dependencies, less code, and it's faster, because requests don't pass through the Node.js compatibility layer and Express's middleware stack.

JavaScript · server.js (Bun native)
const users = [];

const server = Bun.serve({
  port: 3000,
  routes: {
    "/health": new Response("ok"),

    "/api/users/:id": (req) => Response.json({ id: req.params.id }),

    "/api/users": {
      GET: () => Response.json(users),
      POST: async (req) => {
        const user = await req.json();
        users.push(user);
        return Response.json(user, { status: 201 });
      },
    },
  },

  // anything not matched above
  fetch() {
    return new Response("Not found", { status: 404 });
  },
});

console.log(`Listening on ${server.url}`);

It uses standard web Request and Response objects, the same ones as fetch(), so the code is portable and easy to test.

Existing Express app? Keep it, just change the runtime

On older projects, rewriting every route and middleware isn't worth the risk. Bun runs Express and most npm packages as they are, so you can get Bun's faster startup and installs without touching the application code:

JavaScript · server.js (Express, unchanged)
import express from "express";

const app = express();
app.use(express.json());

app.get("/health", (req, res) => res.send("ok"));
app.get("/api/users/:id", (req, res) => res.json({ id: req.params.id }));

app.listen(3000);
Shell
# same code, two runtimes
node server.js
bun server.js

Then, if a hot endpoint needs more speed later, move just that service to Bun.serve. No big-bang rewrite needed.

Where I use Bun

  • Dev and CI tooling: bun install and bun test cut feedback loops dramatically.
  • Scripts and internal tools: TypeScript and JSX run directly, with no build step.
  • New HTTP services on Bun.serve, where fast startup and zero dependencies help, such as serverless functions or containers that scale to zero.

Migration checklist

  • Audit native addons and packages that rely on Node internals.
  • Run your full test suite under Bun, then a load test with production-like traffic.
  • Compare memory over hours, not just requests per second in a short benchmark.
  • Check observability: logging, tracing, your APM agent and debugger.
  • Roll out gradually (canary or one service at a time) with an easy path back to Node.js.

Whichever runtime you pick, the biggest speed wins usually come from doing less: fewer dependencies and less work per request. See reducing npm dependencies.

FAQ

Is Bun ready for production?

For many workloads, yes, especially new services with mainstream pure-JavaScript dependencies. The risks are in compatibility edge cases, native addons, and tooling such as debuggers and APM agents, so test your real workload before switching.

Is Bun faster than Node.js?

Usually for startup time, package installs and some HTTP workloads. Whether that matters depends on your bottleneck: if your service waits on a database, a faster runtime changes little.

Should I use Express with Bun?

For new services, use Bun's built-in HTTP server (Bun.serve) instead: it has routing built in, needs no dependencies and is faster, because requests don't go through Node's compatibility layer and Express's middleware stack. For existing Express apps, keep Express. It runs on Bun as-is, so you can switch runtimes without rewriting your routes.

Can I use Bun without changing my production runtime?

Yes, and it's the lowest-risk way to start. Use bun install and bun test in development and CI for faster feedback, while still running the service on Node.js.

What usually breaks when migrating from Node.js to Bun?

Native addons, packages relying on Node internals, process management patterns like the cluster module, and observability agents. Audit those first.