Move over, Node.js and Deno. A potential competitor is emerging in the JavaScript/TypeScript runtime space, called Bun.
Now in a beta stage of development, Bun is billed as a modern JavaScript runtime akin to Deno or Node, built to start fast, offer new levels of performance, and be a complete tool, equipped with a bundler, transpiler, and package manager. Bun also features an NPM client that implements the Node module resolution algorithm.
Bun has ambitions. The goal of the project is to “run most of the world’s JavaScript outside of browsers,” providing performance and complexity enhancements to future infrastructure. Developer productivity and simpler tools also are goals. The project claims to support 90% of Node-API functions. Built-in web APIs include fetch
, WebSocket
, and ReadableStream
.
Instructions on getting started with Bun can be found on the project website. Bun was designed as a drop-in replacement for current JavaScript and TypeScript apps and scripts on a local computer, server, or on the edge. Hundreds of Node.js and web APIs are implemented natively.
Written in the Zig low-level programming language, the Bun runtime uses the JavaScriptCore engine from the WebKit project, which Bun developers said tends to perform faster than “traditional choices like V8,” which is used by both Node.js and Deno. Most of Bun was written from scratch, including clients for NPM, SQLite, HTTP, and WebSocket, as well as the JSX/TypeScript transpiler.
To make Bun fast, the developers spent time profiling, benchmarking, and optimizing. Zig’s low-level control over memory and transparent control flow make it simpler to write fast software, the developers said.