Sign inGet started
–

Guidance on using Bun as a JavaScript runtime, package manager, bundler, and test runner, including when to choose it over Node and how to migrate.

Lift · GLM-5.3-flash+14ppdirectional · all models →
89
Trustsecurity · quality · license · upkeep
Scan Saferisk 0/100
LicenseMITserved via MCP
Claude Haiku 5.5 · GPT-6 Luna — not run yet
Pass-rate Lift+14pp95% CI [0, +43] · CI includes zero
screen tier · directionalchat harness (v2)
−100pp+100pp

Pass rate with the skill minus without, same tasks, same model.

baseline
86%
with skill
100%
forced
100%
Content Lift forced arm
+25pp [0, +63]
Trigger rate
100%
Trials
23 · 7 tasks
Model
GLM-5.3-flash
Measured
2026-10-15

Content Lift = the skill's instructions injected into the system prompt, so it measures what the content does once loaded, apart from whether the agent chooses to load it. Method →

Embed this score · live badge for your README
SkillzBench badge preview

The badge shows the real benchmark number and updates itself when we re-bench — including the honest states (“did not trigger”, “not benched yet”). All badge options →

Markdown[![SkillzBench](https://skillzbench.com/api/badge/bun-runtime.svg)](https://skillzbench.com/skills/bun-runtime)
+ cost/task[![SkillzBench](https://skillzbench.com/api/badge/bun-runtime.svg?cost=1)](https://skillzbench.com/skills/bun-runtime)
HTML<a href="https://skillzbench.com/skills/bun-runtime"><img src="https://skillzbench.com/api/badge/bun-runtime.svg" alt="SkillzBench benchmark" height="20"></a>

A/B outputs — median trial per arm

Chat harness (v2): the agent's final message without the skill (left) vs with it (right).

bun-runtime--m1
baseline · 0.85

Recommendation: Stay with Node (with TypeScript), keep Bun as an experiment

For your specific constraints — npm packages, Windows developers, and Vercel deployment — Node.js is the safer choice today. Here's the practical reasoning:

Why Node wins for your case

1. Vercel deployment

  • Vercel's serverless functions run on Node.js. Bun isn't a supported runtime for Vercel Functions.
  • You can use Bun locally as a package manager/runner while deploying Node code, but then you're maintaining two toolchains — added complexity with no deploy-side payoff.
  • Edge runtime and Node middleware on Vercel are mature; the Bun path would be nonstandard.

2. Windows support

  • Bun's Windows support is significantly newer and less battle-tested than its macOS/Linux support. Some packages and Bun APIs have historically had Windows-specific gaps or performance differences.
  • Your team is on Windows, so you'd be the ones hitting those rough edges first.

3. npm ecosystem compatibility

  • Both handle npm packages, but Node has 15+ years of compatibility. Native modules, packages that poke at Node internals, or packages relying on subtle Node behaviors occasionally break under Bun. With a team project, "occasionally" is enough to matter.

4. Team familiarity

  • Your team already knows Node's debugging, profiling, and operational quirks. That knowledge transfers directly to production incidents.

What you'd actually give up by skipping Bun

  • Speed: Bun's startup and runtime speed is real, but for a typical REST API behind Vercel serverless functions, cold-start differences are modest and often dominated by your dependencies, not the runtime.
  • Bundler/test runner: You don't need Bun for these. Good Node-native options:
    • Tests: Vitest (fast, TS-native, great DX) or Node's built-in test runner
    • Bundling: Usually unnecessary for a Vercel-deployed API; esbuild or tsup if you need it
    • TypeScript: tsx for dev, tsc for build — no compile step friction

Suggested stack

  • Runtime: Node 20+ (LTS)
  • Framework: Express (or consider Fastify/Hono — Hono in particular is runtime-agnostic and runs great on Vercel)
  • Package manager: pnpm (fast, strict, disk-efficient)
  • Dev: tsx watch, Tests: Vitest, Deploy: Vercel Node functions

When to revisit Bun

  • If you later deploy to a Bun-friendly host (Fly.io, Railway, your own servers)
  • If Bun's Windows support matures and you want a unified toolchain
  • If you build a CLI or script-heavy tooling where Bun's startup speed genuinely pays off

Bottom line: Bun is a great tool, but it's not the right default for a Windows + Vercel + npm team project in production. Choose Node now, and adopt Bun opportunistically where it fits (e.g., as a faster local script runner) without betting your deployment on it.

with skill · 0.85

Recommendation: Use Bun — with a Node escape hatch

For your specific constraints (new project, TypeScript, npm packages, Windows devs, Vercel), Bun fits well, and here's the practical reasoning:

Why Bun works for you

  • New project = lowest migration cost. The riskiest part of adopting Bun is migrating existing Node code. You have none, so you get the benefits without the pain.
  • TypeScript runs natively. bun run src/index.ts just works — no ts-node, no build step for local dev. That's a real DX win for an Express + TS team.
  • One toolchain. bun install (fast, lockfile-aware), bun test (Jest-like API, no Jest/Vitest config), and bun build replace three separate tools. Less config drift across the team.
  • npm packages work. Bun is largely Node-compatible; standard Express and most middleware install and run fine. Commit bun.lock for reproducible installs.
  • Windows is supported. Bun has first-class Windows builds now, so your Windows developers are fine.
  • Vercel supports Bun natively. Set bunVersion: "1.4.x" in vercel.json, use bun install --frozen-lockfile in the build, and you're done.

Caveats to plan for

  • Not 100% Node-compatible. Native addons and packages relying on Node internals can break. Since you're greenfield, vet dependencies early — if a critical package misbehaves, swap it or fall back.
  • Express on Bun is fine, but consider whether you actually need Express: Bun's built-in Bun.serve (fetch-style handlers) is faster and zero-dependency. If the team prefers Express's middleware ecosystem, that's a legitimate reason to keep it — it works on Bun.

Suggested setup

// vercel.json
{ "bunVersion": "1.4.x" }
bun init
bun add express
bun run src/index.ts   # dev, TS runs directly
bun test               # built-in test runner
bun install --frozen-lockfile  # CI/Vercel

When I'd say "stay with Node" instead

Only if you know you'll depend on native addons (e.g., certain DB drivers, sharp, bcrypt variants) or Node-specific tooling your team can't change. Otherwise, for a fresh Express/TS API on Vercel, Bun is the pragmatic choice — and since your code is standard Node-compatible TS, switching back to Node later is trivial if you ever hit a wall.

bun-runtime--m2
baseline · 1.00

Migration steps

1. Update package.json

{
  "name": "api",
  "scripts": {
    "start": "bun src/index.js"
  },
  "dependencies": {
    "express": "^4.18.0",
    "dotenv": "^16.0.0",
    "node-fetch": "^2.6.0"
  }
}

2. Install dependencies

bun install

This creates a bun.lockb (binary lockfile) and installs into node_modules — no other changes needed.

3. Start the app

bun start        # or directly: bun run src/index.js

Code changes (mostly optional)

  • CommonJS require: Works as-is. Bun supports require() natively in .js files, so no rewrite is required. You can migrate to ESM later at your own pace.
  • dotenv: Bun automatically loads .env files (and .env.local, .env.production, etc.) at startup. You can delete require('dotenv').config() entirely. If you keep it, it's harmless — it just re-reads the file.
  • node-fetch: Bun has native fetch built in (global). You can drop node-fetch and use fetch() directly, or keep node-fetch v2 — it works fine.

Compatibility gotchas

  1. Express generally works on Bun, but a few middleware patterns hit rough edges:
    • Middleware relying on undocumented req/res internals or monkey-patching the response object can misbehave.
    • Some native addons (e.g., bcrypt, sharp, canvas) need Bun-compatible builds; pure-JS alternatives (bcryptjs) are safer.
  2. node-fetch v2 vs v3: v2 is CJS and works; if you ever bump to v3 (ESM-only), make sure your file is loaded as ESM or use native fetch instead.
  3. Env var precedence: Bun's built-in .env loading sets variables before your code runs, so process.env is already populated — but it won't override variables already set in the shell unless you use --env-file semantics carefully. If you relied on dotenv's override: true option, test that behavior.
  4. Hot reloading: bun --hot src/index.js gives you hot reload during dev — a nice bonus, but it's not identical to nodemon semantics (it keeps the process alive and reloads modules).
  5. Lockfile: bun install ignores package-lock.json and generates bun.lockb. If you need reproducible CI builds, commit the Bun lockfile.
  6. Node version-specific APIs: Anything using node: prefixed imports (node:fs, etc.) is fully supported; very new or experimental Node APIs (e.g., some node:test features) may lag behind.

Minimal path: change the start script, run bun install, run bun start — most Express + CJS apps run unmodified.

with skill · 1.00

Migration steps

  1. Install Bun (if not already): curl -fsSL https://bun.sh/install | bash

  2. Install dependencies (in your project root):

    bun install
    

    This reads your existing package.json and creates bun.lock (commit it).

  3. Update the start script in package.json:

    "scripts": {
      "start": "bun src/index.js"
    }
    

    Then run:

    bun start
    

    (Or just bun src/index.js directly — no script change strictly required.)

  4. .env loading — Bun auto-loads .env files from the project root, so dotenv becomes optional. You can remove it:

    bun remove dotenv
    

    If you use a differently-named env file (e.g. .env.production), pass it explicitly:

    bun run --env-file=.env.production src/index.js
    

    Note: Bun's auto-loading respects NODE_ENV (loads .env.development/.env.production accordingly). If your code calls require('dotenv').config() with a custom path, keep dotenv — it works fine under Bun.

  5. CommonJS require — no changes needed. Bun supports CommonJS and ESM natively, including require in .js files, and even mixing the two.

Compatibility gotchas

  • node-fetch v2: works under Bun, but it's largely unnecessary — Bun has native fetch as a global. You can delete require('node-fetch') and use fetch(...) directly, then bun remove node-fetch. If you keep it, pin awareness: node-fetch v3 is ESM-only and can trip up CJS require.
  • Express: fully supported; no changes needed.
  • Native addons: packages with Node C++ addons (.node files) may fail under Bun. Your deps here are pure JS, so you're fine — but check any transitive deps if you add more.
  • Not 100% Node-compatible: some less-common node: APIs or packages relying on Node internals can still break. Test your app's full request paths before switching production traffic.
  • Lockfile: bun install generates bun.lock; you can delete package-lock.json after verifying everything works.
  • Version check: run bun --version — behavior/flags can differ between releases (guidance above targets Bun 1.4.x).

Quick summary of commands

bun install
bun remove dotenv node-fetch   # optional cleanups
bun start                      # or: bun src/index.js
bun-runtime--m4
baseline · 0.85

bunfig.toml

Bun's bunfig.toml doesn't have a dedicated "test runner" section for enabling tests — running bun test picks up *.test.ts automatically. But you can configure useful test and install behavior:

# bunfig.toml

[install]
# Lock the package manager behavior; avoid surprises in CI
exact = true          # save exact versions in package.json
frozenLockfile = true # fail if bun.lock is out of sync (good for CI)

[test]
# Files matching these patterns are included (defaults are usually fine)
preload = ["./tests/setup.ts"]   # optional global setup file
root = "src"                     # or wherever your tests live
coverage = false                 # flip to true if you want coverage reports
coverageThreshold = 0.8

Notes:

  • preload replaces things like jest.setup.js. If you use Testing Library, put import '@testing-library/jest-dom' (via @testing-library/jest-dom/bun or the standard entry) in your preload file.
  • There's no [test] flag to "enable" the runner — it's always built in.

package.json

{
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "test": "bun test",
    "test:ci": "bun test --coverage"
  }
}

CI (GitHub Actions example)

name: CI
on: [push, pull_request]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: oven-sh/setup-bun@v2
        with:
          bun-version: latest
      - run: bun install --frozen-lockfile
      - run: bun test

Vercel gotchas

  1. Vercel doesn't run tests during builds. Vercel runs bun install and your build command only. If you want tests to gate deploys, run them in CI (GitHub Actions) and require that check to pass before merge — don't try to shoehorn bun test into the Vercel build command (it slows every deploy and a flaky test blocks shipping).

  2. Set the Bun version explicitly. Vercel auto-detects Bun if bun.lockb/bun.lock exists, but pin the version to match CI. Add to package.json:

    { "packageManager": "bun@1.1.x" }
    

    or set the BUN_VERSION env var in your Vercel project settings. Version drift between local/CI/Vercel is the #1 source of "works locally" bugs.

  3. Install command: Vercel detects Bun from the lockfile and runs bun install automatically. If it doesn't, set Install Command to bun install. Don't mix npm/yarn artifacts — delete package-lock.json/yarn.lock or Vercel may pick the wrong package manager.

  4. Build command stays next build. Bun runs it fine, but if you hit edge-case issues with Next.js + Bun (some plugins/turbopack combos have had rough edges), you can set Build Command to bun run build — same thing, just explicit.

  5. bun:test imports won't leak into production as long as they're only in *.test.ts files — Next's build ignores those. But make sure no production module imports from a test file or a bun:test-dependent helper.

  6. Native modules / postinstall: Bun's install handles postinstall scripts, but scripts for packages not on Bun's allowlist are skipped by default in newer versions. If a build fails with a missing binary (e.g., sharp, esbuild), add the package to trustedDependencies in package.json:

    { "trustedDependencies": ["sharp"] }
    
  7. jsdom/DOM tests: bun test has no built-in DOM. If your components tests need a DOM, use happy-dom with a preload file:

    // tests/setup.ts
    import { GlobalRegistrator } from '@happy-dom/global-registrator'
    GlobalRegistrator.register()
    

    and set preload = ["./tests/setup.ts"] in bunfig.toml.

TL;DR: bunfig.toml mostly configures install + preload behavior; run tests in GitHub Actions with oven-sh/setup-bun, pin the Bun version everywhere, and let Vercel just do bun install + next build.

with skill · 1.00

bunfig.toml

# bunfig.toml — project root
[test]
# files matching these are picked up by `bun test`
preload = ["./tests/setup.ts"]   # optional: global test setup

[install]
# exact versions from bun.lock; good for reproducible CI/Vercel builds
exact = true
frozenLockfile = true

Notes:

  • Bun auto-discovers *.test.ts / *.spec.ts files — no glob config needed for src/utils/format.test.ts.
  • bun:test imports work out of the box; no extra dependency.
  • frozenLockfile = true in [install] makes CI/Vercel installs fail if bun.lock is out of sync (safer than relying on a CLI flag). Locally you can override with bun install --no-frozen-lockfile.

package.json scripts

{
  "scripts": {
    "test": "bun test",
    "build": "next build"
  }
}

Vercel setup

In vercel.json:

{
  "bunVersion": "1.4.x"
}

Vercel auto-detects Bun if a bun.lock is present and uses bun install + bun run build for the build command.

CI (GitHub Actions)

- uses: oven-sh/setup-bun@v2
  with:
    bun-version: 1.4.x
- run: bun install --frozen-lockfile
- run: bun test --parallel
- run: bun run build

Gotchas

  1. Tests don't run on Vercel deploys — Vercel only builds, it doesn't run your test suite. Run bun test in CI (GitHub Actions etc.) and gate merges there; Vercel deploys should be triggered only after CI passes (branch protection / merge checks).
  2. Pin the Bun version everywhere — bunVersion in vercel.json, bun-version in CI, and ideally packageManager/engines in package.json. Mismatches between local, CI, and Vercel cause subtle failures.
  3. Commit bun.lock (text lockfile on Bun 1.4+). Without it, --frozen-lockfile installs fail and builds aren't reproducible. If you have an old binary bun.lockb, migrate by running bun install once with a recent Bun.
  4. bun test is not Jest — the API is Jest-like but not identical. bun:test mocks, snapshot format, and some matchers differ; also bun test runs everything in a single process by default (use --isolate or --parallel if tests leak globals or share state).
  5. Node-only native modules — if any dependency (or Next.js plugin) relies on Node internals or native addons, verify it works under Bun before relying on it in the build. next build under Bun is generally fine, but test it once locally with bun run build.
  6. Don't set installCommand/buildCommand manually unless needed — Vercel's zero-config detection handles Bun; overriding can bypass Bun detection.
  7. Env vars in tests — bun test loads .env automatically; be careful not to let test env leak into production builds, and remember Vercel env vars are injected at build/runtime, not from .env files.
bun-runtime--m5
baseline · 1.00

Run it with Bun like this:

API_KEY=abc123 bun --hot scripts/check.ts

Notes:

  • No ts-node needed — Bun runs TypeScript natively, so bun scripts/check.ts just works.
  • Env var: API_KEY=abc123 before the command sets it for that process. Alternatively, put it in a .env file in the project root — Bun automatically loads .env files, so API_KEY=abc123 in .env works with no extra code.
  • Restart on edit: --hot enables hot reloading — Bun restarts the file when you save changes. (There's also --watch, which fully restarts the process; --hot keeps the process alive and re-evaluates the file, which is usually what you want for scripts.)

If your script reads the key via process.env.API_KEY, it'll pick it up automatically.

with skill · 1.00

Bun runs TypeScript natively — no ts-node needed. Just:

API_KEY=abc123 bun --watch scripts/check.ts
  • bun scripts/check.ts — runs the .ts file directly (no transpile step, no ts-node).
  • API_KEY=abc123 — same inline env var syntax as Node. Alternatively put it in a .env file and run bun --env-file=.env --watch scripts/check.ts (Bun also auto-loads .env by default).
  • --watch — restarts the process whenever the file (or its imports) change. If you want hot reloading that preserves state where possible, use --hot instead (mainly useful for servers).

In your script, read the key as usual:

const apiKey = process.env.API_KEY;
if (!apiKey) {
  console.error("API_KEY is not set");
  process.exit(1);
}
console.log("Key loaded:", apiKey ? "yes" : "no");

One tip: avoid printing the actual key value in logs, even in dev scripts — print a masked version or just whether it's present.

Limitations
  • Results are for the SkillzBench reference agent on GLM-5.3-flash. Switch models above — a skill can help one model and not another.
  • Screen tier (1 trial per arm) is directional. Verified needs a full-tier run (≥ 8 tasks, ≥ 3 trials per arm) with the CI excluding zero.
  • Task coverage: 7 generated tasks for this skill's category; a skill can shine elsewhere.