Skip to content

Top 34 Bun Interview Questions and Answers [2026]

November 17, 2026 28 min read
Bun interview guide by Second Talent
TL;DR: Bun interviews in 2026 test whether a candidate can run a real service on Bun without surprises: lockfile and install security, the bundler and single-file executables, bun test mocking and concurrency, Bun.serve timeouts, and the Node.js APIs Bun still only partly implements. Candidates should know Bun 1.4.4 (October 22, 2026), the 1.4 release that moved Bun from Zig to Rust, and the 1.3 features (Bun.SQL for MySQL and SQLite, isolated installs, test.concurrent) that most codebases now use.

Bun 1.4 shipped on August 20, 2026 as the first release written in Rust instead of Zig, and its release post lists 1,517 more passing tests from the Node.js test suite and more than 2,900 fixed issues.

The current patch is Bun v1.4.4, which added the built-in bun fmt formatter. The questions below are for backend, full-stack and tooling engineers who will own a Bun service or migrate one from Node.js, with three find-the-bug rounds.

Key takeaways
  1. 1Bun.serve closes a connection after 10 seconds of inactivity by default, so long polls and server-sent events need server.timeout(req, 0).
  2. 2Bun does not run dependency lifecycle scripts unless the package is on its allow list or in trustedDependencies, and that field replaces the default list.
  3. 3Bun.SQL returns PostgreSQL int8 values as strings unless you pass bigint: true, and its pool defaults to 10 connections.
  4. 4In bun test, mock.restore() does not remove mocks made with mock.module(), so module mocks leak unless tests run with --isolate.

Runtime Fundamentals

1. What is Bun, and what ships in the one binary?

Bun is a JavaScript and TypeScript runtime built on JavaScriptCore, the engine from WebKit, packaged with a package manager (bun install), a bundler (bun build), a test runner (bun test), a script runner and bunx.

Since 1.4 the codebase is Rust; earlier releases were written in Zig. Anthropic acquired Bun in December 2025, and the project stayed MIT-licensed and developed in public on GitHub.

A strong candidate separates the pieces, because teams adopt them one at a time. Many Node.js shops use bun install and bun test for speed long before they run production traffic on the Bun runtime.

A weak answer treats Bun as "a faster Node" and cannot say which part of the toolchain they used.

2. How does Bun run TypeScript, and what does it not do?

Bun transpiles TypeScript and JSX on load, file by file, and strips the types. It does not type-check.

A project that runs fine under bun run can still have type errors, so CI needs a separate tsc --noEmit step, and the test suite does not replace it.

Follow-ups worth asking:

  • Types for Bun APIs come from @types/bun, which bun init adds along with a tsconfig.json.
  • Because transpiling is per file, features that need whole-program type information, such as const enum across files or emitted decorator metadata, deserve a check before a migration.
  • Path aliases in tsconfig.json paths resolve at runtime in Bun, which they do not in plain Node.js. Code that depends on that breaks when the same files run under Node.js.

3. How does Bun handle ESM and CommonJS together?

Bun accepts both module systems and lets them interoperate in either direction: require() can load an ES module, and import can load CommonJS.

That removes most of the "ERR_REQUIRE_ESM" friction Node.js teams know, and it is why many packages that need a build step under Node.js run directly in Bun.

The trap is portability. Code that leans on Bun's leniency, such as import and require() in the same file, or import.meta.dir and import.meta.main, fails when a library is published for Node.js consumers.

A senior candidate keeps library code to what Node.js accepts and allows Bun-only patterns only in application code that will always run on Bun.

4. What changes because Bun uses JavaScriptCore instead of V8?

Most application code behaves the same, but anything that touches the engine directly does not.

Per Bun's Node.js compatibility page, v8.serialize and v8.deserialize use JavaScriptCore's wire format, not V8's, and node:v8 lacks startCpuProfile, startHeapProfile and the Serializer classes.

  • Serialized data: a cache written by Node.js with v8.serialize cannot be read by Bun, and the reverse.
  • Profiling: since 1.4, --cpu-prof and --heap-prof write V8-compatible output, so Chrome DevTools can open the files, and --cpu-prof-md writes a Markdown report.
  • Native addons: Node-API addons load; addons built against an ABI version need a build for the value Bun reports in process.versions.modules, which 1.4 set to 147.
  • Performance profile: JIT warm-up, regex and GC behavior differ, so benchmark the real workload instead of quoting a hello-world number.

5. How do Bun.file and Bun.write differ from node:fs?

Bun.file(path) returns a lazy BunFile, a Blob that reads nothing until you call text(), json(), bytes(), arrayBuffer() or stream(). Bun.write(dest, data) writes a string, buffer, Blob or Response and resolves to the number of bytes written.

const config = Bun.file("./config.json");
if (await config.exists()) {
  const data = await config.json();
  console.log(config.size, data.name);
}

// copies with the fastest syscall the OS offers
await Bun.write("./backup/config.json", config);

A strong candidate adds that BunFile is also what Bun.serve streams efficiently when returned in a Response, and that node:fs still works for code that must stay portable.

A weak answer calls Bun.file() and expects it to throw on a missing file; it does not until something reads it.

6. Which .env files does Bun load, and in what order?

Bun loads .env files without a dotenv package.

Per the environment variables docs, in increasing precedence: .env, then .env.production, .env.development or .env.test based on NODE_ENV, then .env.local (skipped when NODE_ENV=test), then the matching .env.*.local.

Bun.env and import.meta.env are aliases of process.env.

Senior details: --env-file overrides which files load, --no-env-file or env = false in bunfig.toml turns automatic loading off, and since 1.4 Bun invoked under the name node no longer loads .env files, to match Node.js.

A candidate who has hit this in production mentions that a stray .env.local in a Docker build context silently overrides production values, so it belongs in .dockerignore.

Package Manager and Lockfile

7. What is bun.lock, and how should CI install from it?

bun.lock is a text lockfile, the default since Bun 1.2, which replaced the binary bun.lockb. It belongs in git, diffs in code review like any JSON-like file, and since 1.4 records SHA-512 hashes for GitHub and tarball dependencies.

The lockfile docs give the migration from the old format: bun install --save-text-lockfile --frozen-lockfile --lockfile-only, then delete bun.lockb.

In CI, use bun ci or bun install --frozen-lockfile, which fail instead of rewriting the lockfile when package.json and bun.lock disagree.

A strong candidate also knows that Bun can migrate an existing npm, Yarn or pnpm lockfile on first install, and that 1.4.4 added migration from Yarn Berry's yarn.lock.

8. Why did a package's postinstall script not run after bun install?

Bun does not run dependency lifecycle scripts by default. The lifecycle docs say it runs them only for packages on a built-in allow list of known npm packages, or for packages named in trustedDependencies in package.json.

{
  "name": "api",
  "dependencies": { "sharp": "^0.34.0", "my-native-lib": "^2.1.0" },
  "trustedDependencies": ["my-native-lib"]
}

The detail most candidates miss: defining trustedDependencies replaces the default list instead of extending it, so the file above stops scripts for every allow-listed package except my-native-lib.

An empty array disables scripts for all packages.

The default list covers only npm-registry packages, so file:, link:, git: and github: dependencies must be listed explicitly. --ignore-scripts or install.ignoreScripts = true turns scripts off entirely.

9. What is the difference between the hoisted and isolated linkers?

The hoisted linker flattens dependencies into one node_modules, as npm does, so code can import packages it never declared.

The isolated linker gives each package only its declared dependencies through symlinks into a store, as pnpm does, which turns phantom dependencies into errors.

Bun 1.3 made isolated installs the default for projects with workspaces, and the 1.4 post states that new monorepos use linker: "isolated" while existing lockfiles keep the linker they were created with.

1.4 also added an opt-in global virtual store for the isolated linker, which the post says makes warm CI installs up to 7x faster. To opt out, use bun install --linker=hoisted or linker = "hoisted" under [install] in bunfig.toml.

A strong candidate treats the first isolated install as an audit: every new "cannot find module" error is a missing dependency declaration.

10. Which supply chain controls does bun install offer?

Four, and a senior candidate should name at least three:

  • minimumReleaseAge under [install] in bunfig.toml, in seconds, refuses versions published more recently than the window, which blocks most hijacked releases that npm pulls within hours. 1.4.4 added minimumReleaseAgeExcludes for packages you need on release day.
  • bun audit, added in 1.3, checks dependencies against the same advisory database as npm audit, with --severity and --json. 1.4 added bun audit fix.
  • The security scanner API, configured with [install.security] scanner, lets a scanner package report fatal findings that stop the install or warn findings.
  • Lifecycle scripts off by default (question 8), plus nativeDependencies in 1.4, which links per-platform optional binaries instead of running a postinstall.

11. How do workspaces and catalogs work in a Bun monorepo?

Workspaces are declared in the root package.json workspaces field, and packages reference each other with "workspace:*".

Catalogs, added in 1.3, put shared versions in one place: the root defines a catalog (or named catalogs), and each package writes "react": "catalog:" instead of a version.

{
  "name": "monorepo",
  "workspaces": {
    "packages": ["apps/*", "packages/*"],
    "catalog": { "react": "^19.2.0", "zod": "^4.1.0" }
  }
}

bun run --filter 'apps/*' build runs a script across matching packages, and 1.4 extended --filter to add, remove and update, with bun add --catalog writing the catalog: reference.

A candidate who has run a monorepo adds that catalogs stop the slow drift where three apps pin three React minors.

12. Find the bug: a Dockerfile for a Bun API.

FROM oven/bun:1.4
WORKDIR /app
COPY package.json ./
RUN bun install
COPY . .
ENV NODE_ENV=production
CMD ["bun", "run", "src/server.ts"]

Bugs:

  • No lockfile: bun.lock is never copied, so the image resolves fresh versions on every build and can ship code nobody reviewed.
  • Not frozen: even with the lockfile, plain bun install may rewrite it. Use bun install --frozen-lockfile or bun ci.
  • Dev dependencies installed: add --production to skip devDependencies in the runtime image.
  • Build context: COPY . . pulls in a local node_modules and any .env.local, which Bun then loads automatically (question 6), unless .dockerignore excludes them.

Fix: COPY package.json bun.lock ./, then RUN bun install --frozen-lockfile --production, and a .dockerignore with node_modules and .env*.

A strong candidate may also suggest a bun build --compile stage and a small runtime image (question 14).

Bundler and Executables

13. What are the defaults of Bun.build, and how does it report failure?

Per the bundler docs, target defaults to "browser", format to "esm", splitting and minify to false, and sourcemap to "none". Setting format: "cjs" changes the default target to "node", and the cjs and iife formats are marked experimental.

try {
  const result = await Bun.build({
    entrypoints: ["./src/index.ts"],
    outdir: "./dist",
    target: "bun",
    minify: true,
    sourcemap: "linked",
    env: "PUBLIC_*",
  });
  for (const out of result.outputs) console.log(out.path, out.size);
} catch (err) {
  // throw defaults to true: failures reject with an AggregateError
  console.error(err);
  process.exit(1);
}

The detail that separates candidates: throw defaults to true, so a failed build rejects with an AggregateError. Older scripts that only check result.success never see that branch; they need throw: false to keep their logic.

A strong answer also explains env: "PUBLIC_*", which inlines only variables with that prefix so secrets never land in a browser bundle.

14. How do you ship a Bun app as a single-file executable?

bun build --compile bundles the code with a copy of the Bun runtime into one binary, and --target cross-compiles for another platform:

bun build ./src/server.ts --compile --minify --sourcemap \
  --target=bun-linux-x64-musl --outfile dist/server

Points a senior candidate covers:

  • The binary contains the runtime, so it is tens of megabytes; the gain is a deploy with no node_modules and no install step.
  • -musl targets suit Alpine images; the glibc targets suit Debian-based ones. Since 1.4, x64 releases ship only the baseline build, so there is no separate AVX2 variant to choose.
  • --bytecode precompiles to cut startup time, and 1.4 extended it to ES modules with --format=esm. 1.4 also added --asset to embed files and directories.
  • Since 1.4, compiled executables no longer auto-load tsconfig.json or package.json from the working directory at runtime, which breaks binaries that relied on that.

15. How do HTML imports and the full-stack dev server work?

You can import an .html file and pass it to Bun.serve as a route. Bun scans the HTML, bundles the referenced scripts and stylesheets, and serves them, with hot reloading in development.

Bun 1.3 also made bun ./index.html run a dev server directly.

import homepage from "./index.html";

Bun.serve({
  routes: {
    "/": homepage,
    "/api/health": new Response("ok"),
  },
  development: process.env.NODE_ENV !== "production",
});

Production behavior is the follow-up. Since 1.4, HTML routes with development: false no longer emit sourcemap comments, and [serve.static] in bunfig.toml restores them.

A strong candidate decides whether the frontend should be bundled at startup this way, or prebuilt with bun build and served from a CDN, and can name the latency and caching cost of each.

16. What are Bun macros and compile-time feature flags?

A macro is a function imported with with { type: "macro" } that runs at bundle time, and its return value is inlined into the output. It suits values such as a git commit hash or a build timestamp.

Macro code runs on the build machine, so importing one is code execution in CI. Bun does not let code inside node_modules invoke macros, and --no-macros turns them off for a build that must not run any.

// build-info.ts
export function commit() {
  return Bun.spawnSync(["git", "rev-parse", "--short", "HEAD"]).stdout.toString().trim();
}

// app.ts
import { commit } from "./build-info.ts" with { type: "macro" };
console.log(`build ${commit()}`); // the string is inlined at build time

1.4 added feature("FLAG") from bun:bundle, set with --feature or features: [...], which lets the bundler drop disabled branches entirely.

A candidate should note that compile-time flags need a rebuild to change, so they fit edition or platform splits, not runtime experiments.

17. When would you not use bun build for a frontend?

This is a design-tradeoff question with no single right answer. bun build is fast and has no dependencies, and 1.4 added React Compiler support (--react-compiler), optimizeImports for barrel files, and esbuild-format metafile output.

A strong candidate still weighs what a framework toolchain such as Vite or Next.js gives that the bundler alone does not: a plugin ecosystem, framework conventions for routing and data loading, and a deploy story the team already runs.

Good answers name a concrete deciding factor: a library or internal tool with a few entry points fits bun build; an app built on a framework keeps the framework's bundler and uses Bun as the runtime and package manager.

A weak answer picks the faster tool on benchmark speed alone.

Test Runner

18. How compatible is bun test with Jest and Vitest?

bun:test provides describe, test, expect, lifecycle hooks, snapshots and mocks with a Jest-compatible API, and the mocks docs say jest.fn() "behaves identically" to Jest. vi.fn() and vi.spyOn() follow Vitest semantics, so mockReset() restores the original implementation.

Differences a candidate should know before migrating a suite:

  • Top-level jest.mock() and vi.mock() are hoisted above imports; mock.module() is not (question 19).
  • vi.mock() mocks only your own code, not modules in node_modules, while jest.mock() and mock.module() mock every importer.
  • Since 1.3, in CI bun test fails on test.only() and on new snapshots written without --update-snapshots, so a forgotten .only cannot pass a pipeline.
  • For DOM tests, preload a DOM implementation such as happy-dom through [test] preload in bunfig.toml.

19. Find the bug: a module mock that leaks between files.

// billing.test.ts
import { test, expect, mock, afterAll } from "bun:test";
import { charge } from "./billing";

mock.module("./stripe-client", () => ({
  createCharge: async () => ({ id: "ch_test", status: "succeeded" }),
}));

afterAll(() => {
  mock.restore();
});

test("charges the card", async () => {
  expect((await charge(500)).status).toBe("succeeded");
});

Bug: mock.restore() restores function mocks and spies, but the docs state it "doesn't remove module mocks".

The fake ./stripe-client stays in place for every test file that runs later in the same process, so an integration test of the real client passes against the fake.

Also: mock.module() is not hoisted, so ./billing was imported first and any side effects of the real client already ran. Bun does update live bindings of already-imported modules, which is why the test passes and the problem stays hidden.

Fix: register module mocks in a preload file or before the import with a dynamic await import(), and run files with --isolate (each file gets a fresh module registry) or keep module-mocking tests in their own run.

20. How do concurrency, isolation and sharding work in bun test?

By default bun test runs all files in one process and tests in sequence.

1.3 added test.concurrent and describe.concurrent with a default maximum of 20 concurrent tests, changed by --max-concurrency, plus test.serial and --randomize with --seed. 1.4 added the process-level options:

  • --isolate gives each file a fresh global object and module registry and cleans up timers and handles.
  • --parallel[=N] runs files across worker processes, implies --isolate, and merges coverage and JUnit output. Workers expose JEST_WORKER_ID and BUN_TEST_WORKER_ID, which a test database setup can use to pick a schema per worker.
  • --shard=M/N splits files across CI machines, and --timings with --update-timings balances them by duration.
  • --changed[=ref] runs only the tests whose import graph touches changed files.

A strong candidate turns on --randomize in CI for a while before enabling --parallel, so order-dependent tests surface one at a time.

21. What does this test print, and why is it flaky?

import { test, expect } from "bun:test";

let calls: string[] = [];

test.concurrent("a", async () => {
  calls = [];
  calls.push("a");
  await Bun.sleep(10);
  expect(calls).toEqual(["a"]);
});

test.concurrent("b", async () => {
  calls = [];
  calls.push("b");
  await Bun.sleep(5);
  expect(calls).toEqual(["b"]);
});

Answer: test a fails. Both tests start before either finishes, so b resets calls and pushes "b" while a sleeps. b passes because it wakes first and nothing has changed calls since its own reset; a then sees ["b"].

Change the sleep lengths and the result flips.

Fix: declare calls inside each test. The lesson an interviewer wants is that test.concurrent shares the module scope, so any module-level state, mock or database row becomes shared mutable state.

Only tests that own all their state are safe to mark concurrent.

22. How do you configure coverage and enforce a threshold?

Run bun test --coverage, or set it in bunfig.toml. Per the coverage docs, coverageThreshold takes a number or a table of lines and functions, and the run exits non-zero below it.

[test]
coverage = true
coverageThreshold = { lines = 0.85, functions = 0.85 }
coverageReporter = ["text", "lcov"]
coveragePathIgnorePatterns = ["src/generated/**"]

Details a candidate should know: the reporters are text (the default) and lcov, reports go to coverage by default, test files are excluded by default (coverageSkipTestFiles = true), and the statements key is accepted but not enforced.

A senior answer adds that line coverage on generated code inflates the number, which is what the ignore patterns are for.

23. How do fake timers work in bun test?

As of 1.4, jest.useFakeTimers(), jest.advanceTimersByTime() and jest.setSystemTime() work in bun:test, and Testing Library's waitFor respects fake timers. setSystemTime is also exported from bun:test for code that only needs a fixed clock.

import { test, expect, jest } from "bun:test";
import { createTokenCache } from "./token-cache";

test("token expires after 60 seconds", () => {
  jest.useFakeTimers();
  const cache = createTokenCache({ ttlMs: 60_000 });
  cache.set("t1");
  jest.advanceTimersByTime(59_999);
  expect(cache.valid()).toBe(true);
  jest.advanceTimersByTime(1);
  expect(cache.valid()).toBe(false);
  jest.useRealTimers();
});

A strong candidate restores real timers in an afterEach instead of at the end of the test body, because a failed assertion skips the last line and leaves fake timers on for the rest of the file.

Under --isolate, Bun also resets fake timers between files.

Bun.serve and Built-in Clients

24. How do you define routes in Bun.serve?

Pass a routes object. Per the HTTP server docs, values can be a static Response, a handler, or an object keyed by HTTP method, with :param segments read from req.params and /* wildcards.

An optional fetch handler serves anything the routes miss.

const server = Bun.serve({
  routes: {
    "/health": new Response("ok"),
    "/users/:id": {
      GET: async (req) => Response.json(await getUser(req.params.id)),
      DELETE: async (req) => {
        await deleteUser(req.params.id);
        return new Response(null, { status: 204 });
      },
    },
    "/api/*": Response.json({ error: "not found" }, { status: 404 }),
  },
  fetch() {
    return new Response("not found", { status: 404 });
  },
});

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

Defaults to know: the port comes from $BUN_PORT, $PORT or $NODE_PORT, otherwise 3000, and the hostname is 0.0.0.0. server.reload() swaps fetch, error, routes and websocket without a restart. server.stop() lets in-flight requests finish, while stop(true) closes everything, which matters for graceful shutdown on SIGTERM.

25. Find the bug: a server-sent events endpoint that drops clients.

Bun.serve({
  routes: {
    "/events": () => {
      const stream = new ReadableStream({
        async start(controller) {
          for await (const event of subscribe("orders")) {
            controller.enqueue(`data: ${JSON.stringify(event)}\n\n`);
          }
        },
      });
      return new Response(stream, {
        headers: { "Content-Type": "text/event-stream" },
      });
    },
  },
});

Bug: Bun.serve closes connections after 10 seconds of inactivity by default. A quiet 10 seconds with no order makes the server drop the connection, and clients reconnect in a loop.

It works in a busy staging environment and fails on a quiet night in production.

Fix: take the server as the second handler argument and call server.timeout(req, 0) for this request, or raise idleTimeout (maximum 255 seconds) and send a comment line such as : ping more often than the timeout.

A strong candidate also cancels the subscription when the client disconnects, through the stream's cancel() callback or req.signal, so the server does not leak one subscriber per dropped client.

26. How do WebSockets and pub/sub work in Bun.serve?

Call server.upgrade(req, { data }) inside a handler, and supply a websocket object with open, message and close handlers. upgrade returns a boolean, and a handler that upgrades returns nothing.

Per-connection state goes in data, which is available as ws.data.

const server = Bun.serve({
  fetch(req, server) {
    const room = new URL(req.url).searchParams.get("room") ?? "lobby";
    if (server.upgrade(req, { data: { room } })) return;
    return new Response("upgrade failed", { status: 400 });
  },
  websocket: {
    open(ws) {
      ws.subscribe(ws.data.room);
    },
    message(ws, message) {
      server.publish(ws.data.room, message);
    },
  },
});

A senior candidate knows topic pub/sub runs inside one process. Across several instances it needs Redis or another broker, and Bun's built-in Redis client can fill that role.

Upgrades work only over HTTP/1.1, and since 1.4.4 the close event fires only after the closing handshake, which changes the timing of cleanup code.

27. Find the bug: a search endpoint on Bun.SQL.

import { sql } from "bun";

export async function searchOrders(customerId: string, sort: string) {
  const rows = await sql.unsafe(
    `SELECT id, total FROM orders WHERE customer_id = '${customerId}' ORDER BY ${sort}`
  );
  return rows.map((r) => ({ id: r.id, total: r.total + 0 }));
}

Bugs:

  • SQL injection: sql.unsafe runs the string as given. Both customerId and sort come from the request.
  • Column name from input: a tagged template binds values, not identifiers, so sort needs an allow list.
  • Type surprise: if total is bigint (int8), the Bun.SQL docs say PostgreSQL returns it as a string by default, so r.total + 0 concatenates to "12500".
const SORTS = { newest: sql`created_at DESC`, total: sql`total DESC` } as const;

export async function searchOrders(customerId: string, sort: keyof typeof SORTS) {
  return sql`
    SELECT id, total::numeric::float8 AS total
    FROM orders WHERE customer_id = ${customerId}
    ORDER BY ${SORTS[sort] ?? SORTS.newest}`;
}

Values in a tagged template are bound as parameters. A candidate may also choose new SQL({ bigint: true }) and return BigInt, which is safer for money in minor units.

28. How do Bun.SQL connections, transactions and adapters work?

import { sql, SQL } from "bun" gives a default client configured from the environment and a constructor for others.

The URL protocol picks the adapter: postgres:// for PostgreSQL, mysql:// for MySQL, mariadb:// for MariaDB, and sqlite:// or :memory: for SQLite.

A plain filename such as "app.db" needs { adapter: "sqlite" }, or Bun reads it as a PostgreSQL host.

await sql.begin(async (tx) => {
  const [order] = await tx`INSERT INTO orders ${sql({ customer_id: id, total })} RETURNING id`;
  await tx.savepoint(async (sp) => {
    await sp`UPDATE inventory SET qty = qty - 1 WHERE sku = ${sku}`;
  });
  return order;
});

Defaults worth knowing: max is 10 connections, connectionTimeout 30 seconds, idleTimeout and maxLifetime off, and no connection opens until the first query.

If the callback throws, Bun rolls back and sql.begin rejects. sql.reserve() takes a dedicated connection for session-level work such as advisory locks.

A strong candidate sizes max against the database's connection limit times the number of instances, and runs migrations with .simple(), which allows several statements but no parameters.

29. How does Bun's S3 client work, and where does it fit?

Bun.s3 is a default S3Client configured from the environment, and s3.file(key) returns a lazy S3File that extends Blob.

Per the S3 docs, credentials come from S3_ACCESS_KEY_ID, S3_SECRET_ACCESS_KEY, S3_REGION, S3_ENDPOINT and S3_BUCKET, falling back to the AWS_ names.

It works with AWS S3, Cloudflare R2, Google Cloud Storage, MinIO and other S3-compatible stores.

import { s3 } from "bun";

const report = s3.file(`reports/${id}.csv`);
await report.write(csv, { type: "text/csv" });

// presigned GET URL; the default expiry is 24 hours
const url = report.presign({ expiresIn: 900 });

// large uploads stream as multipart
const writer = s3.file("exports/big.ndjson").writer({ partSize: 5 * 1024 * 1024, retry: 3 });
for await (const line of rows()) writer.write(line + "\n");
await writer.end();

A strong candidate sets expiresIn on every presigned URL instead of accepting the 24-hour default, and returns presigned PUT URLs so browsers upload straight to the bucket.

They also know the limits: the client covers objects and listing (up to 1,000 keys per list call), not bucket policies or lifecycle rules, which still need the AWS SDK or infrastructure code.

Node.js Compatibility and Migration

30. Which Node.js APIs are still incomplete in Bun?

Bun's compatibility page tracks Node.js v26 and marks several modules partial. The ones that break real code:

  • node:async_hooks: createHook, executionAsyncId and triggerAsyncId are stubs and async IDs are always 0. AsyncLocalStorage works, but APM agents built on raw hooks lose context.
  • node:test: no reporters, snapshots, mock.module() or coverage, and most run() options throw. Bun points users to bun:test.
  • node:inspector: Runtime.evaluate, the HeapProfiler domain and Network are missing.
  • node:cluster: each worker binds its own socket, so HTTP load balancing across processes works only on Linux through SO_REUSEPORT.
  • node:v8: see question 4. node:wasi also lacks getImportObject() and initialize().

A weak answer says "Bun is a drop-in replacement". A strong one names the module the team's stack depends on and how they would check it, usually by running the existing test suite under Bun first.

31. How would you move a production Node.js service to Bun?

In stages, each reversible. A senior plan looks like this:

  1. Package manager first: switch to bun install with a committed bun.lock, audit trustedDependencies for packages whose postinstall scripts stopped running, and keep running the service on Node.js.
  2. Tests next: run the suite with bun test or keep the existing runner on the Bun runtime; Bun 1.4 lists Vitest, including --coverage, among the tools that now work.
  3. Runtime in staging: check native addons, APM and tracing agents (async_hooks), and any v8 or inspector use. Load-test with production-shaped traffic and compare p99 latency and memory, not only throughput.
  4. Canary in production: route a share of traffic to Bun instances, watch error rates and memory over days, and keep the Node.js image ready to roll back.

The tradeoff question to ask the candidate: which Bun-only APIs (Bun.serve, Bun.SQL, Bun.s3) would they adopt, and when?

Adopting them early is what makes the move hard to reverse, so a strong candidate waits until the runtime has proven itself on the existing Node.js-compatible code.

What Changed Recently

Oct 10, 2025
Bun 1.3: full-stack dev server, Bun.SQL for MySQL and SQLite, Bun.redis, isolated installs for workspaces, test.concurrent
Dec 2025
Anthropic acquires Bun; the project stays MIT-licensed and open source
May 13, 2026
Bun 1.3.14, the last 1.3 patch release
Aug 20, 2026
Bun 1.4: rewritten in Rust, bun test --parallel and --isolate, experimental HTTP/3 in Bun.serve
Oct 22, 2026
Bun 1.4.4 adds bun fmt, Yarn Berry lockfile migration and Bun.SQL COPY streaming

32. What did Bun 1.3 add that a team should know?

The Bun 1.3 post (October 10, 2025) moved Bun toward a full-stack runtime:

  • Full-stack dev server: run HTML files with bun, with hot reloading and browser console logs echoed to the terminal.
  • Bun.SQL grew from PostgreSQL to one API for PostgreSQL, MySQL, MariaDB and SQLite.
  • Bun.redis, a built-in Redis and Valkey client that reads REDIS_URL.
  • Package manager: isolated installs by default for workspaces, catalogs, bun audit, minimumReleaseAge and the security scanner API.
  • Tests: test.concurrent, test.serial, --randomize, expectTypeOf() and stricter CI behavior for .only and new snapshots.
  • Security APIs: Bun.secrets for the OS credential store and Bun.CSRF.

33. What changed in Bun 1.4, and what breaks on upgrade?

1.4 (August 20, 2026) is the Rust rewrite, with performance numbers in the release post such as Linux startup going from 10.9 ms to 5.1 ms and peak memory under load 13% to 48% lower.

It also added built-ins such as Bun.Image, Bun.cron(), Bun.markdown and URLPattern, directory serving in Bun.serve routes, and experimental HTTP/3.

Upgrade notes a candidate who did the upgrade should name:

  • Bun.connect, Bun.listen with requestCert, and socket.upgradeTLS() now default to rejectUnauthorized: true, so connections to self-signed or private-CA servers can fail.
  • fetch() network errors reject with a TypeError, which changes instanceof checks in retry code.
  • bun build --compile binaries stop auto-loading tsconfig.json and package.json at runtime.
  • Bun.YAML treats yes, no, on and off as strings, and Bun.TOML and bunfig.toml throw on invalid input they used to accept.
  • New monorepos default to the isolated linker, and x64 releases ship only the baseline build.

34. What did the 1.4.x patch releases add?

Bun v1.4.4 (October 22, 2026) is the largest of them.

It added bun fmt, a Prettier-compatible formatter with --check, --staged and --changed that reads Prettier configs; query.cancel(), COPY streaming and transform: SQL.camel in Bun.SQL; user-defined functions and update hooks in bun:sqlite; and install retries with backoff, --libc and bun publish --recursive.

It also changed behavior: the WebSocket close event waits for the closing handshake, the ws default maxPayload rose from 16 MiB to 100 MiB, package manager commands and bunx reject unknown flags instead of ignoring them, and TLS servers request client certificates only when requestCert: true is set.

A candidate who pins the Bun version in CI and Docker, for example oven/bun:1.4.4, avoids picking these up mid-sprint.

Signs of a Strong Answer

  • They name which part of Bun they used (runtime, installer, bundler or test runner) and what they kept on Node.js tooling.
  • They run tsc --noEmit in CI and do not treat a successful bun run as a type check.
  • They install with a frozen lockfile and can explain why trustedDependencies replaces the default list.
  • They know the 10-second idleTimeout and set timeouts per route for streaming responses.
  • They keep module mocks contained with preload files or --isolate, and keep shared state out of concurrent tests.
  • They check the Node.js compatibility page for the modules their APM, tracing and native dependencies use before a runtime migration.

Hiring Bun Developers

Engineers who have run Bun in production, not only installed packages with it, are hard to find on job boards, and most come from Node.js backgrounds.

Second Talent helps US startups hire vetted AI-Native Engineers from Asia, including Node.js developers and TypeScript developers who work across Bun and Node.js, screened with questions like these.

For the Node.js side of the stack, see our Node.js and TypeScript interview guides.

Rates run $23 to $39 USD an hour, billed monthly, with matches in 24 hours and a 90-day one-time replacement guarantee. Compare budgets on the cost to hire a Node.js developer page, or tell us what you need.

Get developers who ship with AI agents. Starts at $25/Hour.

Start Hiring $0 cost until you hire