Skip to main content

Bun

An all-in-one JavaScript runtime and toolkit designed for speed

Run, test, bundle, and manage your JavaScript and TypeScript projects with a single, fast executable

What is Bun?

Bun is a fast all-in-one toolkit for JavaScript and TypeScript apps. It ships as a single executable called bun. At its core is the Bun runtime, a fast JavaScript runtime designed as a drop-in replacement for Node.js. It’s written in Zig and powered by JavaScriptCore under the hood, dramatically reducing startup times and memory usage.
bun run index.tsx             # TS and JSX supported out-of-the-box
The bun command-line tool also implements a test runner, script runner, and Node.js-compatible package manager. Instead of 1,000 node_modules for development, you only need bun. Bun’s built-in tools are significantly faster than existing options and usable in existing Node.js projects with little to no changes.
bun test                      # run tests
bun run start                 # run the `start` script in `package.json`
bun install <pkg>             # install a package
bunx cowsay 'Hello, world!'   # execute a package

Key Features

Fast JavaScript Runtime

Powered by JavaScriptCore with dramatically faster startup times and lower memory usage than Node.js

Built-in Package Manager

npm-compatible package manager that’s significantly faster than npm, yarn, and pnpm

Bundler & Transpiler

Native bundler with tree-shaking, minification, and built-in support for TypeScript and JSX

Test Runner

Jest-compatible test runner with built-in mocking, snapshots, and code coverage

HTTP Server

High-performance HTTP server with WebSocket support built into the runtime

Database Integrations

Native support for SQLite, PostgreSQL, Redis, and S3 clients

TypeScript & JSX

Native TypeScript and JSX support with no configuration required

Shell Scripting

Cross-platform shell scripting with built-in shell interpreter

Quick Start

1

Install Bun

Install Bun with a single command:
curl -fsSL https://bun.sh/install | bash
Bun supports Linux (x64 & arm64), macOS (x64 & Apple Silicon), and Windows (x64 & arm64).
2

Create a new project

Initialize a new Bun project:
bun init
This creates a minimal project structure with a package.json and index.ts file.
3

Run your code

Run your TypeScript or JavaScript file directly:
bun run index.ts
Bun natively supports TypeScript and JSX without any configuration.

Example: HTTP Server

Create a high-performance HTTP server with just a few lines of code:
server.ts
Bun.serve({
  port: 3000,
  fetch(request) {
    return new Response("Hello from Bun!");
  },
});

console.log("Server running at http://localhost:3000");
Run the server:
bun run server.ts

Why Bun?

Bun is designed for speed from the ground up. Built with Zig and powered by JavaScriptCore, it starts up to 4x faster than Node.js and uses less memory. Package installation is 25x faster than npm, and the bundler is 100x faster than Webpack.
Stop managing multiple tools. Bun includes a runtime, package manager, bundler, and test runner—all in a single executable. No more juggling between npm, webpack, jest, and other tools.
Bun implements Node.js APIs and supports npm packages, making it easy to migrate existing projects. Most Node.js applications work with Bun with little to no changes required.
Run TypeScript files directly without transpiling. Bun’s native TypeScript support means you can use .ts and .tsx files everywhere without additional configuration.
Bun includes native implementations of common tasks like HTTP servers, WebSockets, file I/O, SQLite databases, and more. These APIs are faster and more ergonomic than their Node.js equivalents.

Platform Support

Bun runs on:
  • macOS: x64 (Intel) and arm64 (Apple Silicon)
  • Linux: x64 and arm64 (kernel 5.6+ recommended, minimum 5.1)
  • Windows: x64 and arm64
Linux users: Kernel version 5.6 or higher is strongly recommended, but the minimum is 5.1.
x64 users: If you see “illegal instruction” or similar errors, check the CPU requirements.

Next Steps

Installation

Detailed installation instructions for all platforms

Quickstart

Get up and running with your first Bun project

Runtime

Learn about the Bun runtime and its features

Package Manager

Explore Bun’s fast package manager

Build docs developers (and LLMs) love