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
# bunfig.toml — generated [jsx] runtime = "automatic" importSource = "react" [install] [test] [run]
{
"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
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
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
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
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
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?
What does the migration scanner detect?
Which script presets are available?
Does it send my data to a server?
Where do these files go?
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
- Open the Node to Bun Migration tab and paste a file or a concatenated codebase — it is analyzed in the page, never uploaded.
- Read the error / warning / info counts, then each finding's note, fix, and line numbers.
- Switch to the Config tab and pick a script preset (Node, Next, Vite, Astro, Express, or minimal).
- Toggle the runtime, install, test, and run options you need.
- Copy the generated
bunfig.tomland 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.