← Next.js learning pathNext.js · Module 10 of 10
Deploying Next.js
Ship to Vercel, a Node server, Docker or static hosting.
📖 Key ideas
- npm run build then npm start runs a production server.
- Vercel deploys from Git automatically with previews.
- output: "standalone" makes slim Docker images.
- output: "export" creates static files for any host.
- Set environment variables per environment; NEXT_PUBLIC_ ones are exposed to the browser.
💡 Real-life example: Deploying is moving into a new house: pick the house type (Vercel, server, static) that fits your furniture (features).
npm startRuns the built Next.js server
standaloneOutput mode for minimal servers/Docker
NEXT_PUBLIC_Prefix for browser-visible env vars
Preview deploymentTemporary URL for each branch/PR