पाठ 23 / 25
Building and Deploying
next build, next start, and hosting options.
Production builds and where to run them
next build compiles, type-checks and prerenders the app and prints the route table; next start runs the production server (Node.js). Deployment options include platforms with built-in Next.js support (Vercel and others), Node.js servers or containers (the output: "standalone" option creates a minimal server bundle for Docker), and fully static exports (output: "export") for sites that need no server features. Features like Server Actions, Proxy and dynamic rendering need a server runtime.
From laptop to production
Build and run production servers, handle environment variables safely, and review with a checklist.
Building and starting the demo, run
I built the demo store with next build (Next.js 16.3.8), started it with next start and requested pages with curl; the output is copied from that run, trimmed to the relevant lines. The build compiled, ran TypeScript and generated 13 static pages before printing the route table; next start then served the app on the chosen port.
npx next build
npx next start -p 3917
Output:
✓ Compiled successfully in 3.2s Finished TypeScript in 440ms ... ✓ Generating static pages using 7 workers (13/13) in 330ms ... ƒ Proxy (Middleware)
Build in CI
Run next build in CI on every pull request; type errors and prerender failures then block merges instead of deployments.
त्वरित जाँच: Which deployment option cannot support Server Actions?
- A fully static export (output: "export")
- A Node.js server running next start
- A container built with output: "standalone"
- A platform with Next.js support
Answer
A fully static export (output: "export") — Server features need a server runtime.