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 calledbun.
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 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.
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
Install Bun
Install Bun with a single command:Bun supports Linux (x64 & arm64), macOS (x64 & Apple Silicon), and Windows (x64 & arm64).
Create a new project
Initialize a new Bun project:This creates a minimal project structure with a
package.json and index.ts file.Example: HTTP Server
Create a high-performance HTTP server with just a few lines of code:server.ts
Why Bun?
Speed
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.
All-in-one toolkit
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.
Node.js compatibility
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.
Native TypeScript support
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.Built-in APIs
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.
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