Bun is designed to start fast and run fast. It's transpiler and runtime are written in Zig, a modern, high-performance language. On Linux, this translates into startup times 4x faster than Node.js. Performance sensitive APIs like
Bun natively supports TypeScript and JSX out of the box.
Source files can import a
import pkg from "./package.json"; import bunfig from "./bunfig.toml";
As of v0.5.2, experimental support has been for the WebAssembly System Interface (WASI), you can run
# if the filename doesn't end with ".wasm"
bun run ./my-wasm-app.whatever
Note — WASI support is based on wasi-js. Currently, it only supports WASI binaries that use the
wasi_unstable APIs. Bun's implementation is not optimized for performance, but if this feature gets popular, we'll definitely invest time in making it faster.
Support for additional file types can be implemented with Plugins.
Long-term, Bun aims for complete Node.js compatibility. Most Node.js packages already work with Bun out of the box, but certain low-level APIs like
dgram are still unimplemented. Track the current compatibility status at Ecosystem > Node.js.
Bun implements the Node.js module resolution algorithm, so dependencies can still be managed with
node_modules, and CommonJS-style imports.
Note — We recommend using Bun's built-in package manager for a performance boost over other npm clients.
Some Web APIs aren't relevant in the context of a server-first runtime like Bun, such as the DOM API or History API. Many others, though, are broadly useful outside of the browser context; when possible, Bun implements these Web-standard APIs instead of introducing new APIs.
The following Web APIs are partially or completely supported.
|Encoding and decoding|
Bun exposes a set of Bun-specific APIs on the
Bun global object and through a number of built-in modules. These APIs represent the canonical "Bun-native" way to perform some common development tasks. They are all heavily optimized for performance. Click the link in the left column to view the associated documentation.