Back to Examples
Bun
Discover Bun: the fast all-in-one JavaScript runtime with a bundler, test runner, and Node.js-compatible package manager for seamless development.
Lines
380
Sections
4
Want your own llms.txt file?
Generate a professional, AI-friendly file for your website in minutes!
llms.txt Preview
# Bun Documentation
> Bun is a fast all-in-one JavaScript runtime & toolkit designed for speed, complete with a bundler, test runner, and Node.js-compatible package manager.
This documentation covers all aspects of using Bun, from installation to advanced usage.
## Recent Bun Versions
- [Bun v1.2.23](https://bun.com/blog/bun-v1.2.23.md): pnpm-lock.yaml migration for seamless switching from pnpm to bun install, Redis Pub/Sub support, concurrent test execution with configurable parallelism, platform-specific dependency filtering with --cpu and --os flags, system CA certificates support with --use-system-ca, Windows code signing for compiled executables, JSX configuration improvements in Bun.build, sql.array helper for parameterized arrays, randomized test ordering, stricter CI test defaults, process.report.getReport() on Windows, and numerous Node.js compatibility improvements including http, dns, worker_threads, crypto, http2, net, and tty modules.
- [Bun v1.2.22](https://bun.com/blog/bun-v1.2.22.md): Async stack traces for better debugging, RFC 6455 compliant WebSocket client subprotocol negotiation, MySQL adapter improvements including affectedRows and lastInsertRowid support, JSX side effects preservation during bundling, event loop delay monitoring with perf_hooks, HTTP server idle connection management, --workspaces in bun run, function name removal during minification, and numerous Node.js compatibility fixes including child_process.spawnSync, socket.write with Uint8Array, crypto.verify RSA defaults, N-API improvements, HTMLRewriter error handling, fetch decompression fixes, Bun.SQL, and Bun.$ improvements.
- [Bun v1.2.21](https://bun.com/blog/bun-v1.2.21.md): Bun.SQL now supports MySQL and SQLite, alongside PostgreSQL. Native YAML support. 500x faster postMessage(string). Bun.build() compile API, with cross-platform targets. Reduced idle CPU usage. Bun.stripANSI for SIMD-accelerated ANSI escape removal. bunx --package flag support. customizable User-Agent headers. Windows executable metadata embedding. and extensive Node.js compatibility improvements
- [Bun v1.2.20](https://bun.com/blog/bun-v1.2.20.md): Reduced idle CPU usage. Improved `bun:test` diffing. Automatic `ETag` and `If-None-Match` in static routes for `Bun.serve`. 40x faster `AbortSignal.timeout`. Windows long path support. `WebAssembly.compileStreaming` and `WebAssembly.instantiateStreaming`. Many, many reliability improvements.
- [Bun v1.2.19](https://bun.com/blog/bun-v1.2.19.md): 043 👍). Introduces `bun install --linker=isolated` for pnpm-style isolated node_modules, `bun why` for dependency tree understanding, `bun pm pkg` commands for package.json management, enhanced `node:fs.glob()` with array patterns and exclude options, `node:module.SourceMap` class and `findSourceMap()`, smarter `@types/bun` with automatic Node.js compatibility detection, plus numerous Node.js compatibility improvements, runtime bugfixes, bundler enhancements, and bun install optimizations.
## Documentation Sections
### Intro
- [What is Bun?](https://bun.com/docs/index.md): Bun is an all-in-one runtime for JavaScript and TypeScript apps. Build, run, and test apps with one fast tool.
- [Installation](https://bun.com/docs/installation.md): Install Bun with npm, Homebrew, Docker, or the official install script.
- [Quickstart](https://bun.com/docs/quickstart.md): Get started with Bun by building and running a simple HTTP server in 6 lines of TypeScript.
- [TypeScript](https://bun.com/docs/typescript.md): Install and configure type declarations for Bun's APIs
### Templating
- [`bun init`](https://bun.com/docs/cli/init.md): Scaffold an empty Bun project.
- [`bun create`](https://bun.com/docs/cli/bun-create.md): Scaffold a new Bun project from an official template or GitHub repo.
### Runtime
- [`bun run`](https://bun.com/docs/cli/run.md): Use `bun run` to execute JavaScript/TypeScript files and package.json scripts.
- [File types](https://bun.com/docs/runtime/loaders.md): Bun's runtime supports JavaScript/TypeScript files, JSX syntax, Wasm, JSON/TOML imports, and more.
- [TypeScript](https://bun.com/docs/runtime/typescript.md): Bun can directly execute TypeScript files without additional configuration.
- [JSX](https://bun.com/docs/runtime/jsx.md): Bun can directly execute TypeScript files without additional configuration.
- [Environment variables](https://bun.com/docs/runtime/env.md): How to read and set environment variables, plus how to use them to configure Bun
- [Bun APIs](https://bun.com/docs/runtime/bun-apis.md): Bun provides a set of highly optimized native APIs for performing common tasks.
- [Web APIs](https://bun.com/docs/runtime/web-apis.md): Bun implements an array of Web-standard APIs like fetch, URL, and WebSocket.
- [Node.js compatibility](https://bun.com/docs/runtime/nodejs-apis.md): Bun aims for full Node.js compatibility. This page tracks the current compatibility status.
- [Single-file executable](https://bun.com/docs/bundler/executables.md): Compile a TypeScript or JavaScript file to a standalone executable
- [Plugins](https://bun.com/docs/runtime/plugins.md): Implement custom loaders and module resolution logic with Bun's plugin system.
- [Watch mode](https://bun.com/docs/runtime/hot.md): Reload your application & tests automatically.
- [Module resolution](https://bun.com/docs/runtime/modules.md): Bun uses ESM and implements an extended version of the Node.js module resolution algorithm.
- [Auto-install](https://bun.com/docs/runtime/autoimport.md): Never use node_modules again. Bun can optionally auto-install your dependencies on the fly.
- [bunfig.toml](https://bun.com/docs/runtime/bunfig.md): Bun's runtime is configurable with environment variables and the bunfig.toml config file.
- [Debugger](https://bun.com/docs/runtime/debugger.md): Debug your code with Bun's web-based debugger or VS Code extension
### Package manager
- [`bun install`](https://bun.com/docs/cli/install.md): Install all dependencies with `bun install`, or manage dependencies with `bun add` and `bun remove`.
- [`bun add`](https://bun.com/docs/cli/add.md): Add dependencies to your project.
- [`bun remove`](https://bun.com/docs/cli/remove.md): Remove dependencies from your project.
- [`bun update`](https://bun.com/docs/cli/update.md): Update your project's dependencies.
- [`bun publish`](https://bun.com/docs/cli/publish.md): Publish your package to an npm registry.
- [`bun outdated`](https://bun.com/docs/cli/outdated.md): Check for outdated dependencies.
- [`bun link`](https://bun.com/docs/cli/link.md): Install local packages as dependencies in your project.
- [`bun pm`](https://bun.com/docs/cli/pm.md): Utilities relating to package management with Bun.
- [`bun why`](https://bun.com/docs/cli/why.md): Explains why a package is installed in your project.
- [Global cache](https://bun.com/docs/install/cache.md): Bun's package manager installs all packages into a shared global cache to avoid redundant re-downloads.
- [Isolated installs](https://bun.com/docs/install/isolated.md): Create strict dependency isolation, preventing phantom dependencies.
- [Workspaces](https://bun.com/docs/install/workspaces.md): Bun's package manager supports workspaces and monorepo development workflows.
- [Catalogs](https://bun.com/docs/install/catalogs.md): Use catalogs to share dependency versions between packages in a monorepo.
- [Lifecycle scripts](https://bun.com/docs/install/lifecycle.md): How Bun handles package lifecycle scripts with trustedDependencies
- [Filter](https://bun.com/docs/cli/filter.md): Run scripts in multiple packages in parallel
- [Lockfile](https://bun.com/docs/install/lockfile.md): Bun's lockfile `bun.lock` tracks your resolved dependency tree, making future installs fast and repeatable.
- [Scopes and registries](https://bun.com/docs/install/registries.md): How to configure private scopes, custom package registries, authenticating with npm token, and more.
- [Overrides and resolutions](https://bun.com/docs/install/overrides.md): Specify version ranges for nested dependencies
- [Patch dependencies](https://bun.com/docs/install/patch.md): Patch dependencies in your project to fix bugs or add features without vendoring the entire package.
- [Audit dependencies](https://bun.com/docs/install/audit.md): Check installed packages for vulnerabilities.
- [.npmrc support](https://bun.com/docs/install/npmrc.md): Bun supports loading some configuration options from .npmrc
- [Security Scanner API](https://bun.com/docs/install/security-scanner-api.md): Scan your project for vulnerabilities with Bun's security scanner API.
### Bundler
- [`Bun.build`](https://bun.com/docs/bundler.md): Bundle code for consumption in the browser with Bun's native bundler.
- [HTML & static sites](https://bun.com/docs/bundler/html.md): Zero-config HTML bundler for single-page apps and multi-page apps. Automatic bundling, TailwindCSS plugins, TypeScript, JSX, React support, and incredibly fast builds
- [CSS](https://bun.com/docs/bundler/css.md): Production ready CSS bundler with support for modern CSS features, CSS modules, and more.
- [Fullstack Dev Server](https://bun.com/docs/bundler/fullstack.md): Serve your frontend and backend from the same app with Bun's dev server.
- [Hot reloading](https://bun.com/docs/bundler/hmr.md): Update modules in a running application without reloading the page using import.meta.hot
- [Loaders](https://bun.com/docs/bundler/loaders.md): Bun's built-in loaders for the bundler and runtime
- [Plugins](https://bun.com/docs/bundler/plugins.md): Implement custom loaders and module resolution logic with Bun's plugin system.
- [Macros](https://bun.com/docs/bundler/macros.md): Run JavaScript functions at bundle-time and inline the results into your bundle
- [vs esbuild](https://bun.com/docs/bundler/vs-esbuild.md): Guides for migrating from other bundlers to Bun.
### Test runner
- [`bun test`](https://bun.com/docs/cli/test.md): Bun's test runner uses Jest-compatible syntax but runs 100x faster.
- [Writing tests](https://bun.com/docs/test/writing.md): Write your tests using Jest-like expect matchers, plus setup/teardown hooks, snapshot testing, and more
- [Watch mode](https://bun.com/docs/test/hot.md): Reload your tests automatically on change.
- [Lifecycle hooks](https://bun.com/docs/test/lifecycle.md): Add lifecycle hooks to your tests that run before/after each test or test run
- [Mocks](https://bun.com/docs/test/mocks.md): Mocks functions and track method calls
- [Snapshots](https://bun.com/docs/test/snapshots.md): Add lifecycle hooks to your tests that run before/after each test or test run
- [Dates and times](https://bun.com/docs/test/time.md): Control the date & time in your tests for more reliable and deterministic tests
- [Code coverage](https://bun.com/docs/test/coverage.md): Generate code coverage reports with `bun test --coverage`
- [Test reporters](https://bun.com/docs/test/reporters.md): Add a junit reporter to your test runs
- [Test configuration](https://bun.com/docs/test/configuration.md): Configure the test runner with bunfig.toml
- [Runtime behavior](https://bun.com/docs/test/runtime-behavior.md): Learn how the test runner affects Bun's runtime behavior
- [Finding tests](https://bun.com/docs/test/discovery.md): Learn how the test runner discovers tests
- [DOM testing](https://bun.com/docs/test/dom.md): Write headless tests for UI and React/Vue/Svelte/Lit components with happy-dom
Preview of Bun's llms.txt file. View complete file (380 lines) →
Ready to create yours?
Generate a professional llms.txt file for your website in minutes with our AI-powered tool.
Generate Your llms.txt File