> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/oven-sh/bun/llms.txt
> Use this file to discover all available pages before exploring further.

# Introduction

> Bun is an all-in-one JavaScript and TypeScript toolkit — runtime, package manager, bundler, and test runner in a single fast binary.

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](https://ziglang.org) and powered by [JavaScriptCore](https://developer.apple.com/documentation/javascriptcore) — the engine Apple builds for Safari — which gives it dramatically faster startup times and lower memory usage compared to Node.js.

```bash theme={null}
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.

<CardGroup cols={2}>
  <Card title="Runtime" icon="bolt" href="/runtime/overview">
    Execute JavaScript and TypeScript files with near-zero overhead. Drop-in replacement for Node.js with full compatibility for built-in modules and globals.
  </Card>

  <Card title="Package manager" icon="box" href="/pm/install">
    Install packages up to 30x faster than npm using a global cache. Supports workspaces, overrides, and lockfiles.
  </Card>

  <Card title="Bundler" icon="layer-group" href="/bundler/overview">
    Bundle TypeScript, JSX, CSS, and HTML for browsers and servers. Tree-shaking, code splitting, and plugins included.
  </Card>

  <Card title="Test runner" icon="flask" href="/test/overview">
    Jest-compatible test runner with TypeScript support, snapshots, mocks, DOM testing, and watch mode built in.
  </Card>
</CardGroup>

## Common commands

```bash theme={null}
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.

| Command         | Startup time |
| --------------- | ------------ |
| `bun hello.js`  | 5.2ms        |
| `node hello.js` | 25.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.

<Note>
  Node.js compatibility is an ongoing effort. Check the [compatibility page](/runtime/nodejs-compat) for the current status of individual APIs and modules.
</Note>

## Next steps

<CardGroup cols={2}>
  <Card title="Installation" icon="download" href="/installation">
    Install Bun on macOS, Linux, or Windows.
  </Card>

  <Card title="Quickstart" icon="bolt" href="/quickstart">
    Build a working HTTP server in under 5 minutes.
  </Card>

  <Card title="TypeScript" icon="file-code" href="/typescript">
    Learn how Bun handles TypeScript natively.
  </Card>

  <Card title="Runtime overview" icon="circle-play" href="/runtime/overview">
    Explore what the Bun runtime can do.
  </Card>
</CardGroup>
