Configuration
Environment variables (runtime)
Section titled “Environment variables (runtime)”| Variable | Default | Description |
|---|---|---|
PORT |
3000 |
Server port |
HOSTNAME |
0.0.0.0 |
Server hostname |
KEEP_ALIVE_TIMEOUT |
— | HTTP keep-alive timeout (ms) |
NBC_RUNTIME_DIR |
binary’s directory | Where runtime files extract and .next/cache lives. Point at tmpfs (e.g. /tmp/app) for RAM-backed runtime files and read-only root filesystems. |
NEXT_BUN_COMPILE_DEBUG |
0 |
Set to 1 to log every resolver-hook decision. See Debug mode. |
Environment variables (build time)
Section titled “Environment variables (build time)”| Variable | Default | Description |
|---|---|---|
NEXT_ADAPTER_PATH |
— | Enable the adapter without touching next.config: NEXT_ADAPTER_PATH=next-bun-compile next build |
NBC_TARGET |
host platform | Cross-compile target, e.g. bun-linux-x64. See Cross-compilation. |
NEXT_BUN_COMPILE_VERBOSE |
0 |
Set to 1 to print the alias-resolution table at build time. |
next.config.ts options
Section titled “next.config.ts options”adapterPath (required)
Section titled “adapterPath (required)”const nextConfig: NextConfig = { adapterPath: "next-bun-compile",};This makes next build produce the binary directly. output: "standalone" is not required (and not used) — the adapter
assembles its own traced output tree from the build.
In monorepos or linked workspaces, Next resolves adapterPath from
its own package location — resolve from the app dir instead:
import { createRequire } from "node:module";const req = createRequire(process.cwd() + "/");
const nextConfig: NextConfig = { adapterPath: req.resolve("next-bun-compile"),};assetPrefix (optional, optimizes binary size)
Section titled “assetPrefix (optional, optimizes binary size)”If you set assetPrefix for a CDN, next-bun-compile detects it
and skips embedding static assets in the binary — your CDN serves
them instead. Only public/ files and runtime chunks get embedded.
const nextConfig: NextConfig = { adapterPath: "next-bun-compile", assetPrefix: "https://cdn.example.com",};You’ll need to upload .next/static/ to your CDN separately.
transpilePackages (optional, for packages with dynamic requires)
Section titled “transpilePackages (optional, for packages with dynamic requires)”Some packages use dynamic require() calls internally that Turbopack
can’t resolve at build time. Force them through the bundler instead:
const nextConfig: NextConfig = { adapterPath: "next-bun-compile", transpilePackages: ["pino", "pino-pretty"],};See the transpilePackages guide for when you need this.
Custom cache handlers
Section titled “Custom cache handlers”If you configure a custom cacheHandler, the in-memory page tiers
turn themselves off automatically (revalidation events flow through
your handler, which the memory tiers can’t observe) — every page
request goes through Next exactly as it would under next start.
Static assets are still served from memory.
Where the binary appears
Section titled “Where the binary appears”./server next to the package.json of the project being built.
In a monorepo, this is apps/<your-app>/server. Monorepo layouts
are detected automatically.