Catalog
affaan-m/bun-runtime

affaan-m

bun-runtime

Bun as runtime, package manager, bundler, and test runner. When to choose Bun vs Node, migration notes, and Vercel support.

global
0installs0uses~636
v1.1Saved Apr 20, 2026

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 install is significantly faster than npm/yarn. Lockfile is bun.lock (text) by default in current Bun; older versions used bun.lockb (binary).
  • Bundler: Built-in bundler and transpiler for apps and libraries.
  • Test runner: Built-in bun test with 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.lock or bun.lockb) for reproducible installs.
  • Prefer bun run for scripts. For TypeScript, Bun runs .ts natively.
  • Keep dependencies up to date; Bun and the ecosystem evolve quickly.
Files1
1 files · 1.0 KB

Select a file to preview

Overall Score

82/100

Grade

B

Good

Safety

95

Quality

80

Clarity

85

Completeness

75

Summary

Educational reference skill covering Bun as a JavaScript runtime, package manager, bundler, and test runner. Provides guidance on when to choose Bun over Node, migration strategies, Vercel deployment configuration, and practical examples for common tasks like running scripts, testing, and using Bun's native APIs.

Static Analysis Findings

1 finding

Patterns detected by deterministic static analysis before AI scoring. Hover over any finding code for detailed information and remediation guidance.

Credential Exposure
SEC-020Direct .env File Access

Direct .env file access

SKILL.md.env

Detected Capabilities

Runtime selection guidance (Bun vs Node comparison)Package manager usage (bun install, dependency management)Script execution and environment variable handlingTest runner configuration and examplesBun API usage (Bun.file, Bun.serve)Vercel deployment configuration for BunMigration strategies from Node to Bun

Trigger Keywords

Phrases that MCP clients use to match this skill to user intent.

adopt bunmigrate to bunbun testvercel bun deploymentbun package managerbun vs node

Risk Signals

INFO

Reference to .env file in example command (bun run --env-file=.env dev)

SKILL.md | Examples > Scripts and env section

Use Cases

  • Decide whether to adopt Bun for a new project
  • Migrate an existing Node.js project to Bun
  • Configure Bun deployment on Vercel
  • Write and run tests using Bun's test runner
  • Use Bun's native APIs for file I/O and server creation

Quality Notes

  • Clear decision framework: 'When to Use' section explicitly contrasts Bun vs Node with specific scenarios
  • Good practical examples covering core use cases: installation, script execution, testing, and API usage
  • Helpful migration guidance with concrete command replacements (e.g., node → bun, npm install → bun install)
  • Includes Vercel-specific configuration (runtime setting, build command, frozen lockfile for reproducibility)
  • Best practices section covers lockfile management and dependency updates
  • Could enhance: no error handling guidance (e.g., what to do if a package has known Bun incompatibility), no troubleshooting section for common migration issues
  • Could enhance: no discussion of performance benchmarks or trade-offs beyond 'significantly faster'
Model: claude-haiku-4-5-20251001Analyzed: Apr 20, 2026

Reviews

Add this skill to your library to leave a review.

No reviews yet

Be the first to share your experience.

Version History

v1.1

Content updated

2026-04-20

Latest
v1.0

No changelog

2026-04-12

Add affaan-m/bun-runtime to your library

Command Palette

Search for a command to run...