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

# Bun - Fast all-in-one JavaScript runtime

> An all-in-one JavaScript runtime and toolkit with bundler, test runner, and Node.js-compatible package manager.

<div className="flex flex-col items-center justify-center py-12">
  <div className="max-w-4xl mx-auto text-center">
    <h1 className="text-5xl font-bold mb-6" style={{ color: '#af484b' }}>
      Bun
    </h1>

    <p className="text-xl text-gray-600 mb-8">
      An all-in-one JavaScript runtime and toolkit designed for speed
    </p>

    <p className="text-lg text-gray-500 mb-12">
      Run, test, bundle, and manage your JavaScript and TypeScript projects with a single, fast executable
    </p>
  </div>
</div>

## 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.

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

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

<CardGroup cols={2}>
  <Card title="Fast JavaScript Runtime" icon="bolt" href="/runtime/index">
    Powered by JavaScriptCore with dramatically faster startup times and lower memory usage than Node.js
  </Card>

  <Card title="Built-in Package Manager" icon="box" href="/cli/install">
    npm-compatible package manager that's significantly faster than npm, yarn, and pnpm
  </Card>

  <Card title="Bundler & Transpiler" icon="layer-group" href="/bundler/index">
    Native bundler with tree-shaking, minification, and built-in support for TypeScript and JSX
  </Card>

  <Card title="Test Runner" icon="flask" href="/cli/test">
    Jest-compatible test runner with built-in mocking, snapshots, and code coverage
  </Card>

  <Card title="HTTP Server" icon="server" href="/api/http">
    High-performance HTTP server with WebSocket support built into the runtime
  </Card>

  <Card title="Database Integrations" icon="database" href="/api/sqlite">
    Native support for SQLite, PostgreSQL, Redis, and S3 clients
  </Card>

  <Card title="TypeScript & JSX" icon="code" href="/runtime/typescript">
    Native TypeScript and JSX support with no configuration required
  </Card>

  <Card title="Shell Scripting" icon="terminal" href="/runtime/shell">
    Cross-platform shell scripting with built-in shell interpreter
  </Card>
</CardGroup>

## Quick Start

<Steps>
  <Step title="Install Bun">
    Install Bun with a single command:

    <CodeGroup>
      ```bash macOS/Linux theme={null}
      curl -fsSL https://bun.sh/install | bash
      ```

      ```powershell Windows theme={null}
      powershell -c "irm bun.sh/install.ps1 | iex"
      ```

      ```bash npm theme={null}
      npm install -g bun
      ```

      ```bash Homebrew theme={null}
      brew tap oven-sh/bun
      brew install bun
      ```
    </CodeGroup>

    Bun supports Linux (x64 & arm64), macOS (x64 & Apple Silicon), and Windows (x64 & arm64).
  </Step>

  <Step title="Create a new project">
    Initialize a new Bun project:

    ```bash theme={null}
    bun init
    ```

    This creates a minimal project structure with a `package.json` and `index.ts` file.
  </Step>

  <Step title="Run your code">
    Run your TypeScript or JavaScript file directly:

    ```bash theme={null}
    bun run index.ts
    ```

    Bun natively supports TypeScript and JSX without any configuration.
  </Step>
</Steps>

## Example: HTTP Server

Create a high-performance HTTP server with just a few lines of code:

```typescript server.ts theme={null}
Bun.serve({
  port: 3000,
  fetch(request) {
    return new Response("Hello from Bun!");
  },
});

console.log("Server running at http://localhost:3000");
```

Run the server:

```bash theme={null}
bun run server.ts
```

## Why Bun?

<AccordionGroup>
  <Accordion title="Speed">
    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.
  </Accordion>

  <Accordion title="All-in-one toolkit">
    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.
  </Accordion>

  <Accordion title="Node.js compatibility">
    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.
  </Accordion>

  <Accordion title="Native TypeScript support">
    Run TypeScript files directly without transpiling. Bun's native TypeScript support means you can use `.ts` and `.tsx` files everywhere without additional configuration.
  </Accordion>

  <Accordion title="Built-in APIs">
    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.
  </Accordion>
</AccordionGroup>

## 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

<Note>
  **Linux users**: Kernel version 5.6 or higher is strongly recommended, but the minimum is 5.1.
</Note>

<Note>
  **x64 users**: If you see "illegal instruction" or similar errors, check the [CPU requirements](https://bun.sh/docs/installation#cpu-requirements-and-baseline-builds).
</Note>

## Next Steps

<CardGroup cols={2}>
  <Card title="Installation" icon="download" href="/installation">
    Detailed installation instructions for all platforms
  </Card>

  <Card title="Quickstart" icon="rocket" href="/quickstart">
    Get up and running with your first Bun project
  </Card>

  <Card title="Runtime" icon="cog" href="/runtime/index">
    Learn about the Bun runtime and its features
  </Card>

  <Card title="Package Manager" icon="box" href="/cli/install">
    Explore Bun's fast package manager
  </Card>
</CardGroup>
