
Send an HTTP request using fetch
Bun's bundler has built-in support for CSS with modern features
Build static sites, landing pages, and web applications with Bun's bundler
Built-in loaders for the Bun bundler and runtime
Share feedback, bug reports, and feature requests
Convert an ArrayBuffer to an array of numbers
Convert an ArrayBuffer to a Buffer
Convert an ArrayBuffer to a Uint8Array
Convert a Blob to an ArrayBuffer
Convert a Blob to a ReadableStream
Convert a Buffer to a blob
Convert a Buffer to a string
Convert a DataView to a string
Convert a Uint8Array to a Blob
Convert a Uint8Array to a Buffer
Convert a Uint8Array to a DataView
Convert a Uint8Array to a ReadableStream
Convert a Uint8Array to a string
Deploy a Bun application on DigitalOcean
Deploy Bun applications to Railway with this step-by-step guide covering CLI and dashboard methods, optional PostgreSQL setup, and automatic SSL configuration.
Deploy a Bun application on Render
Deploy a Bun application on Vercel
Build an app with Astro and Bun
Create a Discord bot
Containerize a Bun application with Docker
Use Drizzle ORM with Bun
Build an app with Next.js and Bun
Use Neon's Serverless Postgres with Bun
Use Prisma with Bun
Build a React app with Bun
Build an app with Remix and Bun
Build an app with SolidStart and Bun
Use TanStack Start with Bun
Bun Redis with Upstash
Build a frontend using Vite and Bun
Extract links from a webpage using HTMLRewriter
Use `bun publish` to publish a package to the npm registry
Write a simple HTTP server
Streaming HTTP Server with Node.js Streams
Configure TLS on an HTTP server
A collection of code samples and walkthroughs for performing common tasks with Bun.
Add a dependency
Using bun install with an Azure Artifacts npm registry
Install dependencies with Bun in GitHub Actions
Override the default npm registry for bun install
Configure git to diff Bun's lockb lockfile
Install a package under a different name
Add a trusted dependency
Configuring a monorepo using workspaces
Generate a yarn-compatible lockfile
Listen for CTRL+C
Get the process uptime in nanoseconds
Spawn a child process
Read stdout from a child process
Read from stdin
Check if a file exists
Read a JSON file
Install packages with Bun's fast package manager
Fix the "can't be opened because it is from an unidentified developer" Gatekeeper warning when running your JavaScript executable.
Inspect memory usage using V8 heap snapshots
Import a JSON5 file
Import a TOML file
Import a YAML file
Set environment variables
Set a time zone in Bun
Install TypeScript declarations for Bun
Debugging Bun with the VS Code extension
Convert a Node.js Readable to a Blob
Convert a Node.js Readable to a string
Convert a ReadableStream to a Buffer
Convert a ReadableStream to JSON
Bail early with the Bun test runner
Set a glob pattern to decide which tests from which files run in parallel
Re-run tests multiple times with the Bun test runner
Use snapshot testing in `bun test`
import, require, and test Svelte components with bun test
Set a per-test timeout with the Bun test runner
Mark a test as a "todo" with the Bun test runner
Run tests in watch mode with Bun
Encode and decode base64 strings
Check if the current file is the entrypoint
Convert a file URL to an absolute path
Compress and decompress data with gzip
Hash a password
Get the absolute path of the current file
Get the absolute path to the current entrypoint
Convert an absolute path to a file URL
Get the path to an executable bin file
Build a publish-subscribe WebSocket server
Append content to a file
Write a string to a file
Copy a file to another location
Write a Response to a file
Write to stdout
Write a ReadableStream to a file
Delete a file
Bun is an all-in-one toolkit for developing modern JavaScript/TypeScript applications.
Run packages from npm
Check your installed packages for known security vulnerabilities
Display package metadata from the npm registry
Link local packages for development
Persistently patch node_modules packages in a git-friendly way
Package manager utilities
Remove dependencies from your project
Update dependencies to latest versions
Select packages by pattern in a monorepo using the --filter flag
Strict dependency isolation similar to pnpm's approach
How Bun handles package lifecycle scripts securely
.npmrc support
Configure private registries and scoped packages
Security Scanner API
Develop complex monorepos with multiple independent packages
Bindgen for Bun
Contributing to Bun
License for Bun
Bun's roadmap and long-term plans
Build your first app with Bun
Create and extract tar archives with Bun's fast native implementation
Working with binary data in JavaScript
Configure Bun's behavior using its configuration file bunfig.toml
Compile and run C from JavaScript with low overhead
Format colors as CSS, ANSI, numbers, hex strings, and more
The console object in Bun
Use Bun's native APIs for working with HTTP cookies
Debug your Bun code with an interactive debugger using WebKit Inspector Protocol
Bun provides a set of optimized APIs for reading and writing files.
Bun provides a fast API for resolving routes against file-system paths
Use Bun's fast native implementation of file globbing
Use Bun's global objects
Use Bun's HTMLRewriter to transform HTML documents with CSS selectors
Work with cookies in HTTP requests and responses using Bun's built-in Cookie API.
Monitor server activity with built-in metrics
Use `Bun.serve` to start a high-performance HTTP server in Bun
Server-side WebSockets in Bun
Parse newline-delimited JSON (JSONL) with Bun's built-in streaming parser
Parse and render Markdown with Bun's built-in Markdown API, supporting GFM extensions and custom rendering callbacks
Use Bun's DNS module to resolve DNS records
Use Bun's native TCP API to implement performance sensitive systems like database clients, game servers, or anything that needs to communicate over TCP (instead of HTTP)
Use Bun's UDP API to implement services with advanced real-time requirements, such as voice chat.
Universal plugin API for extending Bun's runtime and bundler
Bun provides fast, native bindings for interacting with S3-compatible object storage services.
Use Bun's Secrets API to store and retrieve sensitive credentials securely
Use Bun's semantic versioning API
Bun provides native bindings for working with SQL databases through a unified Promise-based API that supports PostgreSQL, MySQL, and SQLite.
Use Bun's streams API to work with binary data without loading it all into memory at once
Use Bun's transpiler to transpile JavaScript and TypeScript code
Use Bun's utility functions to work with the runtime
Learn how to use Bun's built-in code coverage reporting to track test coverage and find untested areas in your codebase
Learn how to manipulate time and dates in your Bun tests using setSystemTime and Jest compatibility functions
Learn how to test DOM elements and components using Bun with happy-dom and React Testing Library
Bun's fast, built-in, Jest-compatible test runner with TypeScript support, lifecycle hooks, mocking, and watch mode
Learn how to create and use mock functions, spies, and module mocks in Bun tests
Learn about Bun test's runtime integration, environment variables, timeouts, and error handling
Learn how to write tests using Bun's Jest-compatible API with support for async tests, timeouts, and various test modifiers
Using TypeScript with Bun, including type definitions and compiler options
Explain why a package is installed
Generate standalone executables from TypeScript or JavaScript files with Bun
Bun's fast native bundler for JavaScript, TypeScript, JSX, and more
Reduce bundle sizes with Bun's JavaScript and TypeScript minifier
Convert an ArrayBuffer to a Blob
Convert a Buffer to a Uint8Array
Deploy a Bun application on AWS Lambda
Deploy a Bun application on Google Cloud Run
Extract social share images and Open Graph tags
Stream a file as an HTTP Response
Add a development dependency
Add a Git dependency
Add a peer dependency
Migrate from npm install to bun install
Listen to OS signals
Read a file to an ArrayBuffer
Get the MIME type of a file
Read a file as a string
Read a file to a Uint8Array
Delete files
Import a JSON file
Read environment variables
Convert a Node.js Readable to an ArrayBuffer
Convert a Node.js Readable to an Uint8Array
Convert a ReadableStream to an ArrayBuffer
Convert a ReadableStream to a string
Write browser DOM tests with Bun and happy-dom
Run your tests with the Bun test runner
Spy on methods in `bun test`
Using Testing Library with Bun
Update snapshots in `bun test`
Compress and decompress data with DEFLATE
Detect when code is executed with Bun
Get the directory of the current file
Upgrade Bun to the latest version
Get the current Bun version
Enable compression for WebSocket messages
Build a simple WebSocket server
Write a file incrementally
Install Bun with npm, Homebrew, Docker, or the official script.
Check for outdated dependencies
How Bun stores and manages packages in its global cache
Control metadependency versions with npm overrides and Yarn resolutions
How to benchmark Bun
Building Bun on Windows
Bun's automatic package installation feature for standalone script execution
Bun provides a set of utility functions for hashing and verifying passwords with various cryptographically secure algorithms
Learn how to handle errors in Bun's development server
Define routes in `Bun.serve` using static paths, parameters, and wildcards
Send HTTP requests with Bun's fetch API
Use Bun's shell scripting API to run shell commands from JavaScript
Automatic reloading in Bun with --watch and --hot modes
Learn how to configure Bun test behavior using bunfig.toml and command-line options
Learn how to use snapshot testing in Bun to save and compare output between test runs
Migrate from Jest to Bun's test runner
Run JavaScript functions at bundle-time with Bun macros
Universal plugin API for extending Bun's runtime and bundler
Convert a Blob to a Uint8Array
Convert a Uint8Array to an ArrayBuffer
Build an app with Qwik and Bun
Build an HTTP server using Elysia and Bun
Use Gel with Bun
Build an HTTP server using Hono and Bun
Read and write data to MongoDB using Mongoose and Bun
Use Prisma Postgres with Bun
Build an app with SvelteKit and Bun
Run Bun as a daemon with systemd
Get the file name of the current file
Web-standard APIs supported by Bun for server-side JavaScript
Learn how to use beforeAll, beforeEach, afterEach, and afterAll lifecycle hooks in Bun tests
Test Reporters
Run Bun as a daemon with PM2
Skip tests with the Bun test runner
Check if two objects are deeply equal
Enable TLS in Bun.serve
Streaming HTTP Server with Async Iterators
Using bun install with Artifactory
Convert a Buffer to a ReadableStream
Speed up JavaScript execution with bytecode caching in Bun's bundler
Migration guide from esbuild to Bun's bundler
Build fullstack applications with Bun's integrated dev server that bundles frontend assets and handles API routes
Convert a Blob to a string
Convert a Buffer to an ArrayBuffer
Build an HTTP server using Express and Bun
fetch with unix domain sockets in Bun
Build an HTTP server using StricJS and Bun
Server-side render (SSR) a React component
Proxy HTTP requests using fetch()
Hot reload an HTTP server
Upload files via HTTP using FormData
Add an optional dependency
Add a tarball dependency
Configure a private registry for an organization scope with bun install
Parse command-line arguments
Spawn a child process and communicate using IPC
Read stderr from a child process
Read a file to a Buffer
Read a file as a ReadableStream
Watch a directory for changes
Install and run Bun in GitHub Actions
Define and replace static globals & constants
Delete directories
Import a HTML file as text
Run a Shell Command
Re-map import paths
Debugging Bun with the web debugger
Convert a Node.js Readable to JSON
Convert a ReadableStream to an array of chunks
Generate code coverage reports with the Bun test runner
Convert a ReadableStream to a Blob
Convert a ReadableStream to a Uint8Array
Set a code coverage threshold with the Bun test runner
Set the system time in Bun's test runner
Mock functions in `bun test`
Escape an HTML string
Generate a UUID
Sleep for a fixed number of milliseconds
Write a file to stdout
Write a Blob to a file
Share common dependency versions across multiple packages in a monorepo
Bun's lockfile format and configuration
Overview of Bun's native APIs available on the Bun global object and built-in modules
Spawn child processes with `Bun.spawn` or `Bun.spawnSync`
Use Bun's FFI module to efficiently call native libraries from JavaScript
File types and loaders supported by Bun's bundler and runtime
Execute JavaScript/TypeScript files, package.json scripts, and executable packages with Bun's fast runtime.
Built-in JSX and TSX support in Bun with configurable transpilation options
How Bun resolves modules and handles imports in JavaScript and TypeScript
Use Bun's Node-API module to build native add-ons to Node.js
Bun's compatibility status with Node.js APIs, modules, and globals
Use Bun's native Redis client with a Promise-based API
Bun natively implements a high-performance SQLite3 driver.
Create a new Bun project from a React component, a `create-<template>` npm package, a GitHub repo, or a local template
Scaffold an empty Bun project with the interactive `bun init` command
Use Bun's Workers API to create and communicate with a new JavaScript instance running on a separate thread while sharing I/O resources with the main thread
Learn how Bun's test runner discovers and filters test files in your project
Add Sentry to a Bun app
Convert an ArrayBuffer to a string
Convert a Blob to a DataView
Use Neon Postgres through Drizzle ORM
Build an app with Nuxt and Bun
Build-time constants with --define
Set per-socket contextual data on a WebSocket
Bundle a single-page app into a single self-contained .html file with no external dependencies
Hot Module Replacement (HMR) for Bun's development server
Use Bun's built-in support for YAML files through both runtime APIs and bundler integration
Run multiple HTTP servers concurrently via the "reusePort" option to share the same port across multiple processes
Read and configure environment variables in Bun, including automatic .env file support
Common HTTP server usage
Use Bun's built-in support for JSON5 files through both runtime APIs and bundler integration
Add packages to your project with Bun's fast package manager