Bun v1.2 is here! Postgres, S3, better Node compatibility →

Bun
Bun v1.2.2 is here! →

Bun is a fast JavaScript
all-in-one toolkit|

Develop, test, run, and bundle JavaScript & TypeScript projects—all with Bun. Bun is an all-in-one JavaScript runtime & toolkit designed for speed, complete with a bundler, test runner, and Node.js-compatible package manager. Bun aims for 100% Node.js compatibility.

USED BY

What's different about Bun?

Bun provides extensive builtin APIs and tooling

Builtin Core Features

Bun
Bun
Node
Node.js compatibility
Web Standard APIs
Native Addons
TypeScript
JSX
Module loader plugins

Builtin APIs

Bun
Bun
Node
PostgresSQL driver
SQLite driver
S3 Cloud Storage driver
WebSocket server (including pub/sub)
HTTP server
Single-file executables

Builtin Tooling

Bun
Bun
Node
npm package management
Bundler
Cross-platform $ shell API
Jest-compatible test runner
Hot reloading (server)
Monorepo support
Frontend Development Server
Formatter & Linter

Builtin Utilities

Bun
Bun
Node
Password & Hashing APIs
String Width API
Glob API
Semver API
CSS color conversion API

$ bun run

Bun is a JavaScript runtime.

Bun is a new JavaScript runtime built from scratch to serve the modern JavaScript ecosystem. It has three major design goals:

Bun is designed as a drop-in replacement for Node.js. It natively implements hundreds of Node.js and Web APIs, including fs, path, Buffer and more.

The goal of Bun is to run most of the world's server-side JavaScript and provide tools to improve performance, reduce complexity, and multiply developer productivity.

Drop-in Node.js compatibility

Bun aims to be a drop-in replacement for Node.js. It implements Node's module resolution algorithm, globals like Buffer and process, and built-in modules like fs and path. Click to track Bun's progress towards full compatibility.

Fast running performance

Bun extends the JavaScriptCore engine—the performance-minded JS engine built for Safari—with native-speed functionality implemented in Zig.

Works with node_modules

With Bun, you still use package.json to manage your dependencies. Use Bun's native npm client to see just how fast installing dependencies can be.

No more module madness

Forget the complicated rules around CommonJS, ESM, file extensions, resolution priority, and package.json configurations. With Bun, it just works.

TypeScript

TypeScript is a first-class citizen in Bun. Directly execute .ts and .tsx files. Bun respects your settings configured in tsconfig.json, including "paths", "jsx", and more.

Web-standard APIs

Bun implements the Web-standard APIs you know and love, including fetch, ReadableStream, Request, Response, WebSocket, and FormData.

JSX

JSX just works. Bun internally transpiles JSX syntax to vanilla JavaScript. Like TypeScript itself, Bun assumes React by default but respects custom JSX transforms defined in tsconfig.json.

Watch mode

The bun run CLI provides a smart --watch flag that automatically restarts the process when any imported file changes.

Cross-platform shell scripts

The Bun.$ API implements a cross-platform bash-like interpreter, shell, and coreutils. This makes it easy to run shell scripts from JavaScript for devops tasks.

The APIs you need. Baked in.

Start an HTTP server

Start a WebSocket server

Read and write files

Hash a password

Bundle for the browser

Write a test

File system routing

Query a SQLite database

Run a shell script

Call a C function

index.tsx
const server = Bun.serve({
  port: 3000,
  fetch(request) {
    return new Response("Welcome to Bun!");
  },
});

console.log(`Listening on localhost:${server.port}`);
formerly Twitter
Production
"Bun is at the heart of one of our newest infrastructure projects [...]
in production, powering our sports and upcoming news products"
Avatar
Shlomi Atar
Engineering Team at X

$ bun install

Bun is an npm-compatible package manager.

Bun

pnpm

17x

npm

29x

Yarn

33x

Installing dependencies from cache for a Remix app.
View benchmark

Node.js compatible

Bun still installs your dependencies into node_modules like npm and other package managers—it just does it faster. You don't need to use the Bun runtime to use Bun as a package manager.

Crazy fast

Bun uses the fastest system calls available on each operating system to make installs faster than you'd think possible.

Workspaces

Workspaces are supported out of the box. Bun reads the workspaces key from your package.json and installs dependencies for your whole monorepo.

Global install cache

Download once, install anywhere. Bun only downloads a particular version of a package from npm once; future installations will copy it from the cache.

Security by default

Unlike other package managers, Bun doesn't execute postinstall scripts by default. Popular packages are automatically allow-listed; others can be added to the trustedDependencies in your package.json.

Cross-platform package.json scripts

On Windows, package.json scripts are powered by the Bun Shell. It's now safe to delete cross-env, rimraf and node-which.

Familiar API

Bun's CLI uses commands and flags that will feel familiar to any users of npm, pnpm, or yarn.

Reads .npmrc & package-lock.json

Migrate from npm without changing dependency versions. Try bun install secretly without telling your coworkers.

Replace yarn with bun install to get 30x faster package installs.

$ bun test

Bun is a test runner that makes the rest look like test walkers.

Bun

Vitest

5x slower

Jest+SWC

8x slower

Jest+tsjest

18x slower

Jest+Babel

20x slower

Running the test suite for Zod
View benchmark

Jest-compatible syntax

Bun provides a Jest-style expect() API. Switch to bun test with no code changes.

Crazy fast

Bun's fast startup times shine in the test runner. You won't believe how much faster your tests will run.

Lifecycle hooks

Run setup and teardown code per-test with beforeEach/afterEach or per-file with beforeAll/afterAll.

ESM, TypeScript & JSX just work

Zero configuration needed to test TypeScript, ESM, and JSX files.

Snapshot testing

Full support for on-disk snapshot testing with .toMatchSnapshot(). Overwrite snapshots with the --update-snapshots flag.

DOM APIs

Simulate DOM and browser APIs in your tests using happy-dom.

Watch mode

Use the --watch flag to re-run tests when files change using Bun's instantaneous watch mode.

Function mocks

Mock functions with mock() or spy on methods with spyOn().

Replace jest with bun test to run your tests 10-30x faster.

Bun is a complete JavaScript toolkitEverything you need to ship & maintain your app, built-in

Builtin Core Features

Essential runtime capabilities

Node.js compatibility
Web Standard APIs
TypeScript
JSX
Module loader plugins

Builtin APIs

Built-in performance and native APIs designed for production

PostgresSQL driver
SQLite driver
S3 Cloud Storage driver
WebSocket server
HTTP server
Single-file executables

Builtin Tooling

Built-in developer tooling

Package Manager
Bundler
Cross-platform shell API
Jest-compatible test runner
Hot reloading
Monorepo support

Builtin Utilities

APIs that make your life easier as a developer

Password & Hashing
String Width API
CSS color conversion
Glob API
Semver API
Foreign Function Interface

1

Install Bun

curl -fsSL https://bun.sh/install | bash

2

Write your code

index.tsx
const server = Bun.serve({
  port: 3000,
  fetch(request) {
    return new Response("Welcome to Bun!");
  },
});

console.log(`Listening on localhost:${server.port}`);

3

Run the file

bun index.tsx

Developers love Bun.

Sainder
Jan 17
@Sainder_Pradipt
Bun
Lic
Jan 18
@Lik228
bun
Martin Navrátil
Jan 17
@martin_nav_
Bun....
SaltyAom
Jan 17
@saltyAom
bun
reaxios
Jan 17
@reaxios
bun install bun
kyge
Jan 17
@0xkyge
bun
James Landrum
Jan 17
@JamesRLandrum
Node
orlowdev
Jan 17
@orlowdev
Yeah, bun, but my code does not have dependencies.
hola
Jan 17
@jdggggyujhbc
bun
std::venom
Jan 17
@std_venom
Bun
tiago
Jan 19
@tiagorangel23
should have used Bun instead of npm
46officials
Jan 19
@46officials
Bun
yuki
Jan 19
@staticdots
Bun
Stefan
Jan 17
@stefangarofalo
Bun
Samuel
Jan 17
@samueldans0
Bun always
Divin Prince
Jan 17
@divinprnc
Yeah Bun
Gibson
Jan 16
@GibsonSMurray
bun
Oggie Sutrisna
Jan 16
@oggiesutrisna
bun
emanon
Jan 16
@0x_emanon
✅ bun
yuki
Jan 16
@staticdots
bun
SpiritBear
Jan 16
@0xSpiritBear
bun
Ayu
Jan 12
@Ayuu2809
Bun good 🧅
Hirbod
Jan 19
@hirbod_dev
For everything. Yes. I even run with bunx expo run:ios etc
Luis Paolini
Jan 18
@DigitalLuiggi
Jus use @bunjavascript
buraks
Jan 18
@buraks____
I use bun patch and I love it!
fahadali
Jan 8
@fahadali503
Bun
Aiden Bai
Jan 1
@aidenybai
2025 will be the year of JS/TS and @bunjavascript is why
Catalin
Jan 1
@catalinmpit
Bun is goated
MadMax
Jan 3
@dr__madmax
@bunjavascript is yet to get enough appreciation it deserves.
Baggi/e
Jan 3
@ManiSohi
Performant TS/JS backend needs more love Elysia for the win
Michael Feldstein
Dec 18
@msfeldstein
holy shit bun is the solution to spending all day mucking around with typescript/module/commonjs/import bullshit and just running scripts
Sainder
Jan 17
@Sainder_Pradipt
Bun
Lic
Jan 18
@Lik228
bun
Martin Navrátil
Jan 17
@martin_nav_
Bun....
SaltyAom
Jan 17
@saltyAom
bun
reaxios
Jan 17
@reaxios
bun install bun
kyge
Jan 17
@0xkyge
bun
James Landrum
Jan 17
@JamesRLandrum
Node
orlowdev
Jan 17
@orlowdev
Yeah, bun, but my code does not have dependencies.
hola
Jan 17
@jdggggyujhbc
bun
std::venom
Jan 17
@std_venom
Bun
tiago
Jan 19
@tiagorangel23
should have used Bun instead of npm
46officials
Jan 19
@46officials
Bun
yuki
Jan 19
@staticdots
Bun
Stefan
Jan 17
@stefangarofalo
Bun
Samuel
Jan 17
@samueldans0
Bun always
Divin Prince
Jan 17
@divinprnc
Yeah Bun
Gibson
Jan 16
@GibsonSMurray
bun
Oggie Sutrisna
Jan 16
@oggiesutrisna
bun
emanon
Jan 16
@0x_emanon
✅ bun
yuki
Jan 16
@staticdots
bun
SpiritBear
Jan 16
@0xSpiritBear
bun
Ayu
Jan 12
@Ayuu2809
Bun good 🧅
Hirbod
Jan 19
@hirbod_dev
For everything. Yes. I even run with bunx expo run:ios etc
Luis Paolini
Jan 18
@DigitalLuiggi
Jus use @bunjavascript
buraks
Jan 18
@buraks____
I use bun patch and I love it!
fahadali
Jan 8
@fahadali503
Bun
Aiden Bai
Jan 1
@aidenybai
2025 will be the year of JS/TS and @bunjavascript is why
Catalin
Jan 1
@catalinmpit
Bun is goated
MadMax
Jan 3
@dr__madmax
@bunjavascript is yet to get enough appreciation it deserves.
Baggi/e
Jan 3
@ManiSohi
Performant TS/JS backend needs more love Elysia for the win
Michael Feldstein
Dec 18
@msfeldstein
holy shit bun is the solution to spending all day mucking around with typescript/module/commonjs/import bullshit and just running scripts

Learn by example.

Our guides break down how to perform common tasks with Bun.