The Next.js dev vs production split comes down to what each mode optimizes for. Development mode is what you use while writing code, and production mode is what you deploy after running next build. The same app behaves differently in each.
The two modes at a glance
| Aspect | Development | Production |
|---|---|---|
| Command | next dev | next build and next start |
| Output folder | .next/dev | .next |
| Code | Unminified, with source maps | Minified and optimized |
| Caching | Disabled | Config-driven |
| Errors | Full overlays and stacks | Terse server logs |
The development server favors instant feedback, while the production build favors fast page loads. A page that refreshed instantly in development is prerendered and minified in production.
What development mode gives you
next dev starts a server with hot reloading, so editing a file updates the browser without a full rebuild. It writes its output to .next/dev, which lets it run alongside a production build without conflicts.
Turbopack is the default bundler, and error overlays point at the exact component and line when something throws. Fast Refresh preserves component state while a module swaps.
What changes after next build
next build compiles the app for production. It tree-shakes unused code, minifies JavaScript and CSS, and prerenders every route it can.
Type checking runs in parallel, and each route is classified for prerendering before anything is written. The output lands in .next, and next start serves it.
npm run build
npm run startAfter these two commands, the app serves on port 3000 from the optimized build. Visiting a page now returns prerendered HTML where possible, instead of rebuilding it on every request.
Caching and rendering differ
Development mode disables caching so you always see fresh changes, and it re-renders pages as you edit them. Production mode prerenders static routes at build time and may cache data, depending on your configuration. With Cache Components enabled, production routes are split into a static shell and streamed dynamic parts.
One thing stays the same across modes: both use Turbopack by default and both respect the routes in your app directory. The platform you deploy to adds another layer on top of production behavior, so self-hosting can differ from a managed host.
For the dev server's flags, read Running the Next.js Dev Server. To read the route table printed by the build, read Understanding next build Output.
Rune AI
Key Insights
- Development mode runs with next dev and favors instant feedback.
- Production mode runs after next build and next start.
- The dev output goes to .next/dev and the build output goes to .next.
- Production minifies, tree-shakes, and prerenders the app.
- Caching is disabled in development and config-driven in production.
Frequently Asked Questions
Is next dev slower than the production server?
Does the production build run the linter?
Does caching work in development?
Conclusion
Development mode gives you hot reloading and full error detail while you work. Production mode minifies, tree-shakes, and prerenders your app after next build, and that is what you deploy.
More in this topic
`generateMetadata` Explained with Real Examples
What generateMetadata does, when it runs, and how to use it for real routes: awaited params, deduplicated data fetching, extending parent metadata, and returning a 404 from metadata.
Canonical URLs in Next.js: `metadataBase`, `alternates.canonical`, and Dynamic Pages
How canonical URLs work in the Next.js App Router: setting metadataBase once, writing alternates.canonical per route, handling dynamic segments, and what happens when the base URL is missing.
Open Graph and Twitter Card Metadata in Next.js
How to write Open Graph and Twitter card metadata in the Next.js App Router: the openGraph and twitter fields, automatic card defaults, article tags, and image merge rules.