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
origin:ECC
New~636
v1.2Saved Jul 14, 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

78/100

Grade

B

Good

Safety

82

Quality

76

Clarity

82

Completeness

70

Summary

This skill provides guidance on using Bun as a JavaScript runtime, package manager, bundler, and test runner. It explains when to choose Bun over Node, includes migration patterns, and documents Bun's API with practical examples for running scripts, tests, and servers.

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

file readenvironment variable accessscript executionpackage managementtest executioncode transpilation

Trigger Keywords

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

adopt bun runtimemigrate to bunbun install setupbun test runnerbun deploy vercelbun vs node

Risk Signals

INFO

Reference to .env file access via --env-file parameter

SKILL.md: 'bun run --env-file=.env dev'

Use Cases

  • Adopt Bun for new JavaScript/TypeScript projects
  • Migrate existing Node projects to Bun runtime
  • Configure Bun builds and deployments on Vercel
  • Write and debug tests using Bun's Jest-like test runner
  • Use Bun's native TypeScript and server APIs for application development
  • Optimize install and runtime performance with Bun's all-in-one toolchain

Quality Notes

  • Skill provides clear guidance on when to use Bun vs Node, supporting decision-making
  • Practical examples for common workflows (install, run scripts, testing, Vercel deployment)
  • Best practices section emphasizes lockfile commitment and keeping dependencies updated
  • Runtime API examples show practical patterns for file and server operations
  • Migration guidance is concrete and actionable with specific command patterns
  • Documentation could be enhanced with troubleshooting section for common compatibility issues
  • No explicit mention of performance metrics or benchmark comparisons to support claims
  • Env file handling example is shown as a Bun feature, not a security concern
Model: claude-haiku-4-5-20251001Analyzed: Jul 14, 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.2

Content updated

2026-07-14

Latest
v1.1

Content updated

2026-04-20

v1.0

No changelog

2026-04-12

Use affaan-m/bun-runtime in your dev environment

Command Palette

Search for a command to run...

affaan-m/bun-runtime | SkillRepo