Bundle, transpile, install and run JavaScript & TypeScript
projects — all in Bun. Bun is a new JavaScript runtime with a
native bundler, transpiler, task runner and npm client built-in.
Install Bun CLI
vXX.XX.X
(beta)
macOS x64 & Silicon, Linux x64, Windows Subsystem for
Linux
Bun is a modern JavaScript runtime like Node or Deno. It was built
from scratch to focus on three main things:
Start fast (it has the edge in mind).
New levels of performance (extending JavaScriptCore, the engine).
Being a great and complete tool (bundler, transpiler, package
manager).
Bun is designed as a drop-in replacement for your current JavaScript
& TypeScript apps or scripts — on your local computer, server or
on the edge. Bun natively implements hundreds of Node.js and Web
APIs, including ~90% of
Node-API
functions (native modules), fs, path, Buffer and more.
The goal of Bun is to run most of the world's JavaScript
outside of browsers, bringing performance and complexity
enhancements to your future infrastructure, as well as developer
productivity through better, simpler tooling.
node_modules
bun implements Node.js' module resolution algorithm, so you
can use npm packages in Bun. ESM and CommonJS are supported, but
Bun internally uses ESM
In Bun, every file is transpiled.
TypeScript
&
JSX just work
Bun supports "paths",
"jsxImportSource"and more from
tsconfig.json
files
Bun.Transpiler
Bun's JSX & TypeScript transpiler is available as an API
in Bun
use the fastest system calls available with
Bun.write
to write, copy, pipe, send and clone files
Bun automatically loads environment variables from
.env
files. No more
require("dotenv").config()
Bun ships with a fast SQLite3 client built-in
bun:sqlite
bun:ffi call
native code from JavaScript with Bun's low-overhead foreign
function interface
node:fsnode:path
Bun natively supports a growing list of Node.js core modules along
with globals like Buffer and process
How does Bun work?
Bun uses the
JavaScriptCore
engine, which tends
to start
and perform a little faster than more traditional choices
like V8. Bun is written in
, a low-level programming language with manual memory
management.
Most of Bun is written from scratch including
the JSX/TypeScript transpiler, npm client, bundler, SQLite client,
HTTP client, WebSocket client and more.
Why is Bun fast?
An enormous amount of time spent profiling, benchmarking and
optimizing things. The answer is different for every part of Bun,
but one general theme:
's low-level control over memory and lack of hidden control
flow makes it much simpler to write fast software.
Sponsor the Zig Software Foundation.
Getting started
To install Bun, run this
install script
in your terminal. It downloads Bun from GitHub.
curl https://bun.sh/install | bash
Bun's HTTP server is built on web standards like
Request
and
Response
// http.jsexportdefault { port:3000,fetch(request) {returnnewResponse("Welcome to Bun!"); },};