ScriptsApr 3, 2026·2 min read

Bun — All-in-One JavaScript Runtime

Fast JavaScript runtime, bundler, test runner, and package manager in one tool. Drop-in Node.js replacement. 88K+ GitHub stars.

SC
Script Depot · Community
Quick Use

Use it first, then decide how deep to go

This block should tell both the user and the agent what to copy, install, and apply first.

curl -fsSL https://bun.sh/install | bash
# Run any JavaScript/TypeScript file
bun run app.ts

# Install packages (25x faster than npm)
bun install express

# Run tests
bun test

# Bundle for production
bun build ./src/index.ts --outdir ./dist

# Start a project
bun init
// server.ts - HTTP server in Bun
const server = Bun.serve({
    port: 3000,
    fetch(req) {
        return new Response("Hello from Bun!");
    },
});
console.log(`Listening on http://localhost:${server.port}`);
bun run server.ts
# Server starts in ~6ms

Intro

Bun is an all-in-one JavaScript/TypeScript runtime with 88,700+ GitHub stars that replaces Node.js, npm, webpack, and Jest in a single tool. Written in Zig and powered by JavaScriptCore (Safari's engine), Bun starts 4x faster than Node.js, installs packages 25x faster than npm, and bundles code 1.5x faster than esbuild. It runs TypeScript and JSX natively without configuration, includes a built-in test runner, and is compatible with most Node.js packages. For AI developers, Bun means faster API servers, instant package installs, and zero-config TypeScript for AI application backends.

Works with: JavaScript, TypeScript, JSX, Node.js packages (npm compatible), any JS framework. Best for developers who want a faster, simpler alternative to Node.js + npm + webpack + Jest. Setup time: under 1 minute.


Bun Performance

Benchmark Node.js Bun Speedup
Startup ~25ms ~6ms 4x
npm install ~10s ~0.4s 25x
HTTP requests/sec ~65K ~105K 1.6x
Bundle (esbuild equiv) 1.0x 1.5x 1.5x
TypeScript Needs ts-node Native Zero config

Package Manager

# Install all dependencies (lockfile-aware)
bun install          # 25x faster than npm install

# Add a package
bun add openai
bun add -d typescript

# Remove
bun remove express

# Compatible with package.json and node_modules

Native TypeScript

// No tsconfig needed, no ts-node, no build step
const response: Response = await fetch("https://api.openai.com/v1/models");
const data: { data: Array<{ id: string }> } = await response.json();
console.log(data.data.map(m => m.id));
bun run app.ts  # Just works

Built-in Test Runner

// app.test.ts
import { expect, test } from "bun:test";

test("2 + 2 = 4", () => {
    expect(2 + 2).toBe(4);
});

test("fetch works", async () => {
    const res = await fetch("https://httpbin.org/get");
    expect(res.status).toBe(200);
});
bun test  # Runs all .test.ts files

Built-in Bundler

bun build ./src/index.ts --outdir ./dist --target browser

SQLite Built-in

import { Database } from "bun:sqlite";

const db = new Database("mydb.sqlite");
db.run("CREATE TABLE IF NOT EXISTS chats (id INTEGER PRIMARY KEY, prompt TEXT, response TEXT)");
db.run("INSERT INTO chats (prompt, response) VALUES (?, ?)", ["Hello", "Hi there!"]);

FAQ

Q: What is Bun? A: Bun is an all-in-one JavaScript/TypeScript runtime with 88,700+ GitHub stars. It replaces Node.js (runtime), npm (package manager), webpack (bundler), and Jest (test runner) in a single fast tool.

Q: Is Bun compatible with Node.js? A: Yes, Bun is largely compatible with Node.js APIs and npm packages. Most Express, Fastify, and Next.js apps work with Bun with minimal changes.

Q: Is Bun free? A: Yes, open-source under MIT license.


🙏

Source & Thanks

Created by Oven. Licensed under MIT.

bun — ⭐ 88,700+

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets