Skip to main content
Bun is an 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 — the engine Apple builds for Safari — which gives it dramatically faster startup times and lower memory usage compared to Node.js.
bun run index.tsx  # TypeScript and JSX supported out of the box

What’s in the box

bun is a single binary that replaces an entire toolchain. Use it to run, install, build, and test your JavaScript and TypeScript projects.

Runtime

Execute JavaScript and TypeScript files with near-zero overhead. Drop-in replacement for Node.js with full compatibility for built-in modules and globals.

Package manager

Install packages up to 30x faster than npm using a global cache. Supports workspaces, overrides, and lockfiles.

Bundler

Bundle TypeScript, JSX, CSS, and HTML for browsers and servers. Tree-shaking, code splitting, and plugins included.

Test runner

Jest-compatible test runner with TypeScript support, snapshots, mocks, DOM testing, and watch mode built in.

Common commands

bun run index.tsx         # run a TypeScript or JavaScript file
bun run start             # run the "start" script from package.json
bun install               # install all dependencies
bun add figlet            # add a package
bun build ./index.tsx     # bundle a project for the browser
bun test                  # run tests
bunx cowsay 'Hello!'      # execute a package without installing it

Performance

Bun processes start 4x faster than Node.js on Linux. This is a direct result of using JavaScriptCore instead of V8, and writing the runtime in Zig — a systems language that compiles to tight, predictable machine code with no hidden allocations.
CommandStartup time
bun hello.js5.2ms
node hello.js25.1ms
Benchmark: simple Hello World script on Linux.

What is a runtime?

JavaScript (ECMAScript) is a specification, not an implementation. A JavaScript engine ingests a valid JS program and executes it. The two most popular engines today are V8 (used by Node.js and Chrome) and JavaScriptCore (used by Safari and Bun). Both are open source. A runtime wraps an engine and adds APIs that let programs interact with the outside world — the file system, network, environment variables, and so on. Node.js pioneered JavaScript on the server by adding APIs like fs, net, http, and the process global. Bun is a modern replacement: it implements those same Node.js APIs for compatibility, while also exposing the standard Web APIs (fetch, WebSocket, ReadableStream) that browsers use.

Design goals

Bun is designed from the ground up with today’s JavaScript ecosystem in mind.
  • Speed. Startup is 4x faster than Node.js. Package installs are up to 30x faster than npm.
  • TypeScript and JSX out of the box. You can execute .ts, .tsx, and .jsx files directly. Bun’s transpiler converts them to plain JavaScript before execution — no tsc or Babel required.
  • ESM and CommonJS compatibility. Bun recommends ES modules, but fully supports CommonJS. You can import and require in the same file.
  • Web-standard APIs. fetch, WebSocket, URL, Headers, ReadableStream — all built in, using Safari’s own WebCore implementations where possible.
  • Node.js compatibility. Bun implements Node.js built-in modules (path, fs, http, crypto, etc.) and globals (process, Buffer, __dirname) so existing Node.js projects run with little or no changes.
Node.js compatibility is an ongoing effort. Check the compatibility page for the current status of individual APIs and modules.

Next steps

Installation

Install Bun on macOS, Linux, or Windows.

Quickstart

Build a working HTTP server in under 5 minutes.

TypeScript

Learn how Bun handles TypeScript natively.

Runtime overview

Explore what the Bun runtime can do.

Build docs developers (and LLMs) love