Skip to content

Bun Config Builder

Bun Config Builder

Build bunfig.toml plus Bun-flavored package.json scripts, with a Node.js to Bun migration assistant.

Runtime

JSX

Install

Test Runner

Scripts Preset

Custom additions
bunfig.toml
# bunfig.toml — generated

[jsx]
runtime = "automatic"
importSource = "react"

[install]

[test]

[run]
package.json
{
  "name": "my-bun-app",
  "version": "0.1.0",
  "type": "module",
  "scripts": {
    "dev": "bun run --hot src/index.ts",
    "start": "bun run src/index.ts",
    "test": "bun test"
  },
  "dependencies": {},
  "devDependencies": {
    "@types/bun": "latest"
  }
}

What This Tool Does

The Bun Config Builder generates a bunfig.toml and Bun-flavored package.json scripts from toggles for the runtime, install, test, and run sections, with presets for Node, Next, Vite, Astro, and Express. A second tab scans pasted Node.js source for the APIs that behave differently under Bun. It all runs in your browser. Note: the coverage threshold is written as a 0-to-1 fraction, not a percentage.

Last updated:

This tool is provided as-is for convenience. Output should be verified before use in any production or critical context.

Agent Invocation

Best Path For Builders

Browser workflow

Runs instantly in the browser with private local processing and copy/export-ready output.

Browser Workflow

This tool is optimized for instant in-browser execution with local data handling. Run it here and copy/export the output directly.

/bun-config-builder/

For automation planning, fetch the canonical contract at /api/tool/bun-config-builder.json.

How to Use Bun Config Builder

  1. 1

    Set runtime options

    Choose smol mode for low-memory environments, set logLevel, and add preload scripts. Configure JSX runtime for React, Preact, or other JSX import sources.

  2. 2

    Configure install behavior

    Set the registry, lockfile mode (binary, text, or none), frozen lockfile for CI, peer dependency installation, and production-only flags for deployment images.

  3. 3

    Tune the test runner

    Enable coverage with a percent threshold and reporter (text or lcov), set the per-test timeout, and add preload files like ./happydom.ts for DOM testing under bun:test.

  4. 4

    Pick a scripts preset

    Choose minimal, node, next, vite, astro, or express. Each preset wires a Bun-flavored set of dev, start, build, and test scripts. Add custom scripts for project-specific workflows.

  5. 5

    Run the migration scan

    Switch to the Migration tab and paste your Node source. The scanner flags vm, cluster, sqlite3, V8 internals, and other APIs that diverge under Bun, with a fix recommendation per finding.

Frequently Asked Questions

What is Bun Config Builder?
A generator for bunfig.toml plus a Bun-friendly package.json scripts block. It also includes a migration scanner that flags Node APIs known to diverge under Bun's runtime.
What does the migration scanner detect?
It pattern-matches the known ~5% incompatibility surface: node:vm, node:cluster, node:v8, node:perf_hooks edges, native .node addons, sqlite3 vs bun:sqlite, ts-node redundancy, and global.gc usage.
Which script presets are available?
Six: minimal, node (with biome), next (bunx --bun), vite, astro, and express. Each wires Bun-flavored dev/start/build/test commands. Custom scripts can be appended to any preset.
Does it send my data to a server?
No. The configuration builder and the migration scanner both run client-side. Your pasted source code stays in your browser memory and is never transmitted.
Where do these files go?
Save bunfig.toml at your project root (or in $HOME for global defaults). Merge the scripts block into your existing package.json. Bun reads bunfig.toml automatically on every command.

How do I migrate a Node.js project to Bun?

Most Node.js code runs unchanged under Bun; the friction is a small set of APIs that behave differently or are missing. Paste your source into the migration tab and it scans for that surface, grading each hit as error, warning, or info with a concrete fix. On the config tab, generate the bunfig.toml and package.json scripts to complete the switch.

Step by step

  1. Open the Node to Bun Migration tab and paste a file or a concatenated codebase — it is analyzed in the page, never uploaded.
  2. Read the error / warning / info counts, then each finding's note, fix, and line numbers.
  3. Switch to the Config tab and pick a script preset (Node, Next, Vite, Astro, Express, or minimal).
  4. Toggle the runtime, install, test, and run options you need.
  5. Copy the generated bunfig.toml and package.json into your project.

Node APIs that differ under Bun (what this tool flags)

Node API / module Severity Under Bun
node:cluster error Not implemented; use Bun.serve with reusePort or multiple processes
node:vm error Partial; contextification incomplete
node:v8 error Unimplemented — Bun runs JavaScriptCore, not V8
process.binding error Internal Node binding not exposed; update the dependency
child_process.fork warn IPC-based fork partially implemented; prefer Bun.spawn
global.gc / --expose-gc warn No --expose-gc flag; use Bun.gc()
native .node addons warn N-API works; a few V8-internal addons will not load
worker_threads info Supported, with slightly different threading semantics

Rules as this tool's analyzer implements them (13 checks across core modules, runtime, globals, tooling, and wasm). Bun's compatibility moves fast, so always re-run your test suite after switching.

What does the bunfig.toml builder cover?

It writes the sections you toggle: [jsx] runtime and import source; [install] registry, lockfile, frozen lockfile, and auto-install mode; [test] coverage, threshold, reporter, and timeout; and [run] hot reload, shell, and silent. Only non-default values are emitted, so the file stays minimal.

How does the migration scanner work?

It strips comments and string literals — but keeps import and require specifiers — then matches your source against a rule set for the APIs that diverge under Bun, reporting matches with line numbers. It is a static scan, not an execution, so treat it as a checklist of things to verify rather than a guarantee.

Is my source code uploaded?

No. Both the config generation and the migration scan run entirely in your browser; the source you paste never leaves the tab. That lets you check a private or proprietary codebase for Bun compatibility without sending any of it to a server.