Bun, an all-in-one toolkit for building, testing, debugging, and running JavaScript and TypeScript apps, has reached stable production-ready status as of September 8.
Positioned as a drop-in replacement for Node.js, Bun is a single executable intended to eliminate complexity and slowness without tossing away everything that is “great” about JavaScript, Bun’s developers said. They bill Bun as a fast JavaScript runtime that simplifies JavaScript development by eliminating the “layers and layers of tooling that have accumulated on top of each other.”
Bun makes Node.js tools including node
, npx
, nodemon
, and dotenv
or cross-env
unnecessary, the Bun team said. And Bun can run .js
, .ts
, .cjs
, .mjs
, .jsx
, and .tsx
files, which can replace transpilers such as tsc
and babel
. For testing, Bun is a Jest-compatible test runner supporting snapshot testing, code coverage, and mocking. Bun also serves as a JavaScript bundler with “best-in-class” performance and an esbuild-compatible plugin API. It also is an NPM-compatible package manager.
Other features of Bun:
- A JavaScript transpiler is baked into the runtime, for running JavaScript, TypeScript, and JSX/TSX files, with no dependencies.
- ECMAScript and CommonJS module systems are supported.
- Web-standard APIs are supported such as
fetch
,request
, andWebSocket
. Bun APIs were designed to be easy to use and fast. - Bun is faster than
npm
,yarn
, andpnpm
, the Bun team said. A global module cache is used to avoid redundant downloads from the NPM registry; the fastest system calls are used from each operating system. - Hot reloading is enabled, to reload an application when files change.
Production-ready native builds of Bun are provided for macOS and Linux; an experimental native build of Bun for Windows also is available. Bun can be installed with the following command:
$ curl -fsSL https://bun.sh/install | bash
Upgrades can be done by running bun upgrade
.