Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
bun

bun

> 编程语言
Free

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one

97.2K stars0 likes5 views
WebsiteGitHub

About

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one

Bun

Read the docs →

What is Bun?

Bun is an all-in-one toolkit for JavaScript and TypeScript apps. It ships as a single executable called bun.

At its core is the Bun runtime, a fast JavaScript runtime designed as a drop-in replacement for Node.js. It's written in Rust and powered by JavaScriptCore under the hood, dramatically reducing startup times and memory usage.

bash
bun run index.tsx             # TS and JSX supported out-of-the-box

The bun command-line tool also implements a test runner, script runner, and Node.js-compatible package manager. Instead of 1,000 node_modules for development, you only need bun. Bun's built-in tools are significantly faster than existing options and usable in existing Node.js projects with little to no changes.

bash
bun test                      # run tests
bun run start                 # run the `start` script in `package.json`
bun install <pkg>             # install a package
bunx cowsay 'Hello, world!'   # execute a package

Install

Bun supports Linux (x64 & arm64), macOS (x64 & Apple Silicon), and Windows (x64 & arm64).

Linux users — Kernel version 5.6 or higher is strongly recommended, but the minimum is 5.1.

x64 users — if you see "illegal instruction" or similar errors, check our CPU requirements

bash
# with install script (recommended)
curl -fsSL https://bun.com/install | bash

# on windows
powershell -c "irm bun.sh/install.ps1 | iex"

# with npm
npm install -g bun

# with Homebrew
brew tap oven-sh/bun
brew install bun

# with Docker
docker pull oven/bun
docker run --rm --init --ulimit memlock=-1:-1 oven/bun

Upgrade

To upgrade to the latest version of Bun, run:

bash
bun upgrade

Bun automatically releases a canary build on every commit to main. To upgrade to the latest canary build, run:

bash
bun upgrade --canary

View canary build

Quick links

  • Intro

    • What is Bun?
    • Installation
    • Quickstart
    • TypeScript
    • TypeScript 6
  • Templating

    • bun init
    • bun create
  • Runtime

    • bun run
    • File types (Loaders)
    • JSX
    • Environment variables
    • Bun APIs
    • Web APIs
    • Node.js compatibility
    • Plugins
    • Watch mode / Hot Reloading
    • Module resolution
    • Auto-install
    • bunfig.toml
    • Debugger
    • REPL
    • $ Shell
  • Package manager

    • bun install
    • bun add
    • bun remove
    • bun update
    • bun link
    • bun pm
    • bun outdated
    • bun publish
    • bun patch
    • bun why
    • bun audit
    • bun info
    • Global cache
    • Global store
    • Isolated installs
    • Workspaces
    • Catalogs
    • Lifecycle scripts
    • Filter
    • Lockfile
    • Scopes and registries
    • Overrides and resolutions
    • Security scanner API
    • .npmrc
  • Bundler

    • Bun.build
    • Loaders
    • Plugins
    • Macros
    • vs esbuild
    • Single-file executable
    • CSS
    • HTML & static sites
    • Hot Module Replacement (HMR)
    • Full-stack with HTML imports
    • Standalone HTML
    • Bytecode caching
    • Minifier
  • Test runner

    • bun test
    • Writing tests
    • Lifecycle hooks
    • Mocks
    • Snapshots
    • Dates and times
    • DOM testing
    • Code coverage
    • Configuration
    • Discovery
    • Reporters
    • Runtime Behavior
  • Package runner

    • bunx
  • API

    • HTTP server (Bun.serve)
    • HTTP routing
    • HTTP error handling
    • HTTP metrics
    • WebSockets
    • Workers
    • Binary data
    • Streams
    • File I/O (Bun.file)
    • Archive (tar)
    • SQLite (bun:sqlite)
    • PostgreSQL (Bun.sql)
    • Redis (Bun.redis)
    • S3 Client (Bun.s3)
    • FileSystemRouter
    • TCP sockets
    • UDP sockets
    • Globals
    • Child processes (spawn)
    • Cron (Bun.cron)
    • WebView
    • Transpiler (Bun.Transpiler)
    • Hashing
    • Colors (Bun.color)
    • Console
    • FFI (bun:ffi)
    • C Compiler (bun:ffi cc)
    • HTMLRewriter
    • Cookies (Bun.Cookie)
    • CSRF (Bun.CSRF)
    • Secrets (Bun.secrets)
    • YAML (Bun.YAML)
    • TOML (Bun.TOML)
    • JSON5
    • JSONL
    • Markdown
    • Image processing
    • Utils
    • Node-API
    • Glob (Bun.Glob)
    • Semver (Bun.semver)
    • DNS
    • fetch API extensions

Guides

  • Deployment

    • Deploy to Vercel
    • Deploy to Railway
    • Deploy to Render
    • Deploy to AWS Lambda
    • Deploy to DigitalOcean
    • Deploy to Google Cloud Run
  • Binary

    • Convert a Blob to a string
    • Convert a Buffer to a blob
    • Convert a Blob to a DataView
    • Convert a Buffer to a string
    • Convert a Blob to a ReadableStream
    • Convert a Blob to a Uint8Array
    • Convert a DataView to a string
    • Convert a Uint8Array to a Blob
    • Convert a Blob to an ArrayBuffer
    • Convert an ArrayBuffer to a Blob
    • Convert a Buffer to a Uint8Array
    • Convert a Uint8Array to a Buffer
    • Convert a Uint8Array to a string
    • Convert a Buffer to an ArrayBuffer
    • Convert an ArrayBuffer to a Buffer
    • Convert an ArrayBuffer to a string
    • Convert a Uint8Array to a DataView
    • Convert a Buffer to a ReadableStream
    • Convert a Uint8Array to an ArrayBuffer
    • Convert an ArrayBuffer to a Uint8Array
    • Convert an ArrayBuffer to an array of numbers
    • Convert a Uint8Array to a ReadableStream
  • Ecosystem

    • Use React and JSX
    • Use Gel with Bun
    • Use Prisma with Bun
    • Use Prisma Postgres with Bun
    • Add Sentry to a Bun app
    • [Create a Discord bot](https://bun.com/guides/ecos

Issues· 9446 open

View all issuesOpen on GitHub
  • #44177

    Bun.serve routes: building the table is quadratic and lookup is linear in the number of sibling routes

    bugperformancebun:serveconfirmed bugUpdated Sep 28, 2026
  • #44176

    Bun.serve routes: matching uses the raw request-target but req.url is dot-segment-normalised (`..` reaches a :param route; `#` lands in params)

    bugbun:serveconfirmed bugUpdated Sep 28, 2026
  • #41363

    Support mixed static/dynamic route segments like `/@:username`

    enhancementbun:serveUpdated Sep 28, 2026
  • #43996

    `Bun.write` stringifies input it does not support, so `Bun.write(path, img.png())` writes "[object Image]" and reports success

    bugruntimeUpdated Sep 28, 2026
  • #44157

    node:sqlite / bun:sqlite: built without SQLITE_DEFAULT_MEMSTATUS=0, so reads from several workers contend on a global mutex

    Updated Sep 28, 2026
  • #44156

    worker_threads: allocating workers block on each other's GC marking; BUN_JSC_numberOfGCMarkers=1 halves 8-worker wall time

    Updated Sep 28, 2026
  • #44173

    node:worker_threads: new Worker() validates options.name before the filename, execArgv, argv and env

    Updated Sep 28, 2026
  • #44127

    ws: req.setHeader() in finishRequest does not replace a header of options.headers with an uppercase name

    Updated Sep 28, 2026
  • #44098

    ws: a finishRequest that calls req.end() later opens two connections

    Updated Sep 28, 2026
  • #11548

    bun requires clearing cache when updating package that is using a git tag

    bugUpdated Sep 28, 2026

> Tags

Rustbunbundlerjavascript

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedDec 4, 2026
Category编程语言
PricingFree

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言