Production build pipeline
What you need to know
A production build prepares deployable output and may execute server code to prerender eligible routes. A successful build is necessary for many deployment modes but does not prove that the deployed application works.
By the end, you can: describe compilation and output; separate type check from runtime.
A proposed CI sequence
next typegentsc --noEmiteslint .next buildnext start --hostname 127.0.0.1 --port 3100Expected behavior: These commands assume approved local binaries and config; execute as separate fail-fast stages. Start only after the earlier stages succeed.
How it works
Keep dependency resolution, source analysis, generated route types, static checks, compilation, prerendering and startup distinct. The exact internal sequence is implementation-dependent. Next.js 16 no longer automatically runs lint during next build, so run your reviewed linter independently. next typegen produces framework route types without needing a complete build; it loads project config using the production build phase, so use only a reviewed project and include its configuration prerequisites in the type generation job. Then run the TypeScript compiler with the intended project settings. next build performs its framework build and type checks under normal configuration; do not disable failures just to get output. next start serves a built Node application, not a static export directory. The .next directory can contain server and browser artifacts, so do not publish its entire contents as static assets. Build-time environment values, runtime secrets and public variables have different lifetimes; inspect generated client output for accidental exposure using synthetic markers only.
Evidence from each stage
Types: route parameters accepted by compilerLint: configured rules checkedBuild: output generatedHTTP: /catalog -> 200Browser: keyboard selection worksExpected behavior: The first three are not substitutes for the last two. The listed outcomes are acceptance criteria, not measured results.
Common mistake
Do not expose the full build directory or skip type errors. A working development server can still hide production prerendering or configuration failures.
Practice and verification
Write a five-stage build report for River Books. For each stage identify one failure it can detect and another it cannot. Use the staged browser fixture for production checks only after dependencies are reviewed.
Scope: Proposed Next.js 16.x / React 19, Cache Components disabled unless noted. Framework, browser and component examples are staged; local standalone tests are reported separately. Exact dependency patches and platform contracts pending.