What is the difference between next dev, next build, and next start?
These are the three commands Next.js ships for running your app, each for a different phase of development.
next dev — the development server. Compiles routes on demand, watches files, enables Fast Refresh for near-instant updates, and surfaces errors with source maps. It's not optimized for performance — it's optimized for the feedback loop. Run it locally with
npm run dev.next build — the production build. Compiles your app ahead of time, runs type checks and lint (by default), statically generates pages that can be, and produces the
.next/output directory ready for deployment. This is the command your CI/CD runs.next start — the production server. Reads the artifacts from
next buildand serves them. Requires the build step to have finished first; it will refuse to start if.next/is missing or stale.
Typical lifecycle:
# development
npm run dev # next dev on localhost:3000
# deployment
npm run build # next build
npm run start # next start on the production hostKey differences:
Compilation timing —
devcompiles a route when you visit it.buildcompiles everything once.startcompiles nothing — it serves the pre-built artifacts.Error handling —
devshows a helpful overlay with stack traces.startreturns a generic 500 and logs to the console.Caching —
devdisables most caching so changes show up immediately.startenforces the real ISR, Data Cache, and Router Cache behavior.Performance — only
startrepresents real production performance. Don't benchmarkdevand assume production is slow.Port — all default to 3000, overridable with
-p 4000orPORT=4000.
Useful flags:
next dev --turbo— use Turbopack (now the default in Next 15+).next build --debug— extra logging for troubleshooting builds.next build --profile— writes a trace file for analyzing build performance.next start -H 0.0.0.0— bind to all interfaces when running in Docker.
One other related command is next lint (running ESLint with the Next config) and next export (deprecated — use output: 'export' in config instead for fully static sites).
On Vercel and most PaaS, you don't call next start directly — the platform runs your build output through its own serving layer. next start is for self-hosting.
The practical insight: you must run next build before next start. Mentioning that next dev compiles on-demand while next build pre-compiles everything shows you understand the performance difference.