bun-runtime
affaan-m/ecc
Fast all-in-one JavaScript runtime with built-in package manager, bundler, and test runner.
What is bun-runtime?
Bun is a Node-compatible JavaScript runtime and toolkit that combines package management, bundling, and testing in a single tool. Use it for new projects, performance-critical scripts, or when migrating from Node to a faster, unified toolchain.
- Drop-in Node-compatible runtime built on JavaScriptCore and Zig
- Fast package manager with `bun install` significantly faster than npm/yarn
- Built-in bundler and transpiler for applications and libraries
- Jest-like test runner with `bun test` and TypeScript support
- Native TypeScript execution without separate transpilation
- Bun-specific APIs (Bun.file, Bun.serve) for better performance
How to install bun-runtime
npx skills add null --skill bun-runtime- Bun installed on your system
How to use bun-runtime
- 1.Run `bun install` to install dependencies (creates bun.lock or bun.lockb lockfile)
- 2.Replace `node script.js` with `bun run script.js` or `bun script.js`
- 3.Use `bun run` for npm scripts defined in package.json
- 4.Run `bun test` to execute tests with Jest-like syntax
- 5.For Vercel: set runtime to Bun in project settings and use `bun install --frozen-lockfile` in build step
- 6.Commit the lockfile (bun.lock or bun.lockb) for reproducible installs
Use cases
- Migrating Node.js projects to Bun by replacing `node script.js` with `bun run script.js`
- Setting up new JavaScript/TypeScript projects with unified toolchain
- Deploying applications to Vercel using Bun runtime
- Writing and running tests with Jest-compatible API
- Creating fast build pipelines with native bundler and transpiler
- JavaScript/TypeScript developers starting new projects
- Teams prioritizing installation and runtime speed
- Developers migrating from Node.js to Bun
- Vercel platform users seeking faster deployments
- Full-stack developers wanting a single toolchain for run, install, test, and build
bun-runtime FAQ
Replace `node script.js` with `bun run script.js`, run `bun install` instead of `npm install`, and use `bun run` for npm scripts. Most packages work out of the box; check for known Bun compatibility issues with specific dependencies.
Current Bun versions use `bun.lock` (text format) by default, while older versions used `bun.lockb` (binary format). Both serve the same purpose of ensuring reproducible installs.
Prefer Bun for new projects, performance-critical scripts, and unified toolchain needs. Prefer Node for maximum ecosystem compatibility, legacy tooling, or when dependencies have known Bun issues.
Yes, Bun runs `.ts` files natively without separate transpilation. Use `bun run script.ts` or `bun script.ts` directly.
Set the runtime to Bun in Vercel project settings, use `bun install --frozen-lockfile` for reproducible installs, and run `bun run build` or `bun build` in your build command.
Full instructions (SKILL.md)
Source of truth, from affaan-m/ecc.
name: bun-runtime description: Bun as runtime, package manager, bundler, and test runner. When to choose Bun vs Node, migration notes, and Vercel support. metadata: origin: ECC
Bun Runtime
Bun is a fast all-in-one JavaScript runtime and toolkit: runtime, package manager, bundler, and test runner.
When to Use
- Prefer Bun for: new JS/TS projects, scripts where install/run speed matters, Vercel deployments with Bun runtime, and when you want a single toolchain (run + install + test + build).
- Prefer Node for: maximum ecosystem compatibility, legacy tooling that assumes Node, or when a dependency has known Bun issues.
Use when: adopting Bun, migrating from Node, writing or debugging Bun scripts/tests, or configuring Bun on Vercel or other platforms.
How It Works
- Runtime: Drop-in Node-compatible runtime (built on JavaScriptCore, implemented in Zig).
- Package manager:
bun installis significantly faster than npm/yarn. Lockfile isbun.lock(text) by default in current Bun; older versions usedbun.lockb(binary). - Bundler: Built-in bundler and transpiler for apps and libraries.
- Test runner: Built-in
bun testwith Jest-like API.
Migration from Node: Replace node script.js with bun run script.js or bun script.js. Run bun install in place of npm install; most packages work. Use bun run for npm scripts; bun x for npx-style one-off runs. Node built-ins are supported; prefer Bun APIs where they exist for better performance.
Vercel: Set runtime to Bun in project settings. Build: bun run build or bun build ./src/index.ts --outdir=dist. Install: bun install --frozen-lockfile for reproducible deploys.
Examples
Run and install
# Install dependencies (creates/updates bun.lock or bun.lockb)
bun install
# Run a script or file
bun run dev
bun run src/index.ts
bun src/index.ts
Scripts and env
bun run --env-file=.env dev
FOO=bar bun run script.ts
Testing
bun test
bun test --watch
// test/example.test.ts
import { expect, test } from "bun:test";
test("add", () => {
expect(1 + 2).toBe(3);
});
Runtime API
const file = Bun.file("package.json");
const json = await file.json();
Bun.serve({
port: 3000,
fetch(req) {
return new Response("Hello");
},
});
Best Practices
- Commit the lockfile (
bun.lockorbun.lockb) for reproducible installs. - Prefer
bun runfor scripts. For TypeScript, Bun runs.tsnatively. - Keep dependencies up to date; Bun and the ecosystem evolve quickly.
Related skills
More from affaan-m/ecc and the wider catalog.
canary-watch
Monitor deployed URLs for regressions—checks endpoints, assets, performance, and console errors after releases.
carrier-relationship-management
Manage carrier portfolios, negotiate rates, and track performance with transportation expertise frameworks.
cisco-ios-patterns
Cisco IOS/IOS-XE review patterns for config, ACLs, wildcard masks, and safe change verification.
ck
Persistent per-project memory for Claude Code with auto-loaded context and git-aware session tracking.
claude-api
Agent skill from affaan-m/ecc.
claude-devfleet
Orchestrate parallel Claude Code agents on coding tasks with dependency chains and isolated worktrees.