Standalone Node output
What you need to know
Standalone output packages the server files and traced dependencies needed by a Next.js Node deployment, rather than shipping the whole development workspace.
By the end, you can: identify required assets; specify local production startup.
Configure the standalone artifact
import type {NextConfig} from 'next';const config:NextConfig={output:'standalone'};export default config;Expected behavior: A reviewed npm run build produces a traced runtime artifact; no build has been executed in this package.
How it works
Set output: 'standalone' for a normal single-project Node build. File tracing identifies runtime files from imports and other supported patterns. A monorepo or dynamically referenced file may require explicit tracing configuration; inspect the emitted tree and test real runtime reads. The minimal server lives in .next/standalone/server.js for this layout. In a monorepo the relative app path may be retained under the standalone directory; inspect actual output and use the documented outputFileTracingRoot when necessary. The asset-copy commands below assume a fresh single-project artifact and an existing public directory; skip the public copy if none exists. Assets in public and .next/static are not copied automatically; serve them via a separately configured CDN or copy them into the standalone tree. Do not copy all of .next into a public web root. The generated server starts with Node, not next start. The configuration is captured at build time, while server-only environment values read dynamically can be provided at startup. Build once, identify the resulting artifact and deploy the same bytes across replicas of that release.
Complete and start a local single-project artifact
npm run buildcp -r public .next/standalone/publicmkdir -p .next/standalone/.nextcp -r .next/static .next/standalone/.next/staticHOSTNAME=127.0.0.1 PORT=3000 node .next/standalone/server.jsExpected behavior: Assumes a fresh build and existing public directory. The server should listen only on loopback; verify page, CSS and local public image then stop it.
Common mistake
A successful startup does not prove that fonts, CSS or lazy chunks are available. Missing asset copies can cause an apparently working HTML response with broken hydration or styling.
Practice and verification
Compare the artifact inventory against the staged file checklist. Remove only a lab-owned copied static directory in a disposable copy and predict which HTTP assertion will fail; restore the copy and repeat after an approved build.
Scope: Proposed Next.js 16.x / React 19, App Router with Cache Components disabled unless noted. Framework and browser examples are staged, not executed. Hypothetical costs are not actual provider rates.