# Bun
Bun is an all-in-one [[JavaScript]] and [[TypeScript]] runtime, bundler, package manager, and test runner. Created by Jarred Sumner and released in 2022, it aims to be a drop-in replacement for [[Node.js]] with dramatically better performance. Bun uses the JavaScriptCore engine (from WebKit) instead of V8, and implements many Node.js and Web APIs natively for speed.
Bun was originally written in Zig and C++. Since v1.4 (August 2026), it is written in [[Rust]].
Bun's package manager (`bun install`) is significantly faster than npm, [[pnpm]], or Yarn because it uses a global module cache, hardlinks, and a binary lockfile. It also natively supports [[TypeScript]] and JSX without transpilation, includes a built-in SQLite driver, and offers a fast test runner (`bun test`). It's compatible with most of the Node.js ecosystem.
## Bun v1.4
Released on 2026-08-20. The headline change is that Bun has been rewritten from Zig to [[Rust]]; [[Claude Code]] had been running on the Rust port for months before the release. But the more interesting story is how much of a standard library Bun now ships. Fifteen things you used to install from npm are now built in.
### New built-in APIs
- `Bun.Image`: resize, rotate, and encode images with no native dependencies
- `Bun.WebView`: browser automation driving system WebKit or an installed Chrome/Edge over CDP, without Playwright or an npm install. Clicks arrive as trusted input
- `Bun.markdown`: Markdown parser with GFM tables and task lists
- `Bun.cron()`: scheduled jobs registered at the OS level (crontab, launchd, Task Scheduler)
- `Bun.Terminal`: native pseudo-terminal for driving interactive CLI tools
- `Bun.Archive`: create and extract tarballs
- Parsers for JSON5, JSONL, JSONC, XML, and TOML
- Terminal text helpers: `Bun.sliceAnsi()`, `Bun.wrapAnsi()`, `Bun.stringWidth()`
- Web APIs: `URLPattern`, `CompressionStream` and `DecompressionStream` (gzip, brotli, zstd)
### Performance
- 5x lower CPU on idle workloads; p99 CPU in production halved, from 24% to 10%
- 13-48% less memory for HTTP servers
- Startup 50% faster on Linux, 2.5x faster on Windows
- Binary size down by up to 17%
- Streams rewritten natively, with backpressure handling that prevents memory exhaustion
- Native FFI 3x faster through JavaScriptCore integration
- URL parsing 4.6x faster; RegExp 138-200x faster on some patterns
### Package manager
- 15-33x faster installs than npm, pnpm, and Yarn depending on the scenario
- An opt-in global virtual store gives roughly 7x faster warm CI installs
- New commands: `bun audit fix`, `bun dedupe`, `bun prune`, `bun pm licenses`, `bun pm ls --trusted`
- `bun update` now handles transitive dependencies, and nested dependency overrides are supported
- `trustedDependencies` entries now match the exact package name instead of a truncated hash, and only auto-trust packages coming from the npm registry
### Testing
- `--parallel` runs tests across worker processes
- `--shard=M/N` splits a suite across CI machines
- `--changed` runs only the tests affected by the current git diff
- `--isolate` gives each file fresh globals
- `--timings` balances parallel and sharded runs by wall time
### Build
- React Compiler built in and running in Rust, 19x faster than the Babel plugin
- Barrel import optimization for better tree-shaking
- `--asset` embeds files into compiled binaries
- `--metafile-md` writes a readable bundle analysis report
- TC39 decorators support
### HTTP
- Experimental HTTP/3 in `Bun.serve()`, and HTTP/2 plus HTTP/3 in `fetch()` with explicit protocol selection
- Static file serving from `Bun.serve()` routes, with range requests and conditional headers (206, 304, 412)
- Request compression via a `compress` option
### Diagnostics
- `--cpu-prof-md` and `--heap-prof-md` write profiles as Markdown, which makes them readable by both humans and AI agents
- Async stack traces that point back to the source `await`
- A `process.on("memoryPressure")` event
### Node.js compatibility
1517 new tests taken from the Node.js test suite. `node:http`, `node:fs`, and `node:cluster` pass 97% of Node's tests, and `node:quic`, `node:events`, `node:trace_events`, and `node:sqlite` pass 100%.
### Scripts
`bun run --parallel` runs several scripts concurrently with prefixed output, `--sequential` keeps them ordered, and `--filter` targets specific workspaces.
## References
- https://bun.sh
- https://bun.com/docs
- https://bun.com/blog/bun-v1.4
- https://github.com/oven-sh/bun
## Related
- [[JavaScript]]
- [[TypeScript]]
- [[Rust]]
- [[Node.js]]
- [[pnpm]]
- [[Linux]]