The next dev options let you tune the development server's port, hostname, bundler, and protocol. next dev starts the server with hot reloading and error reporting, and running the bare next command is an alias for it, so both start the same server.
Start the server with the npm script:
npm run devVisit http://localhost:3000. The server watches your files and pushes updates to the browser as you save.
With npm, put -- before any flag so npm forwards it to Next.js. With pnpm, yarn, or bun, pass flags directly.
The table below lists the flags most people need. The full set also includes CPU profiling and trace upload options, which matter only for performance work.
The most useful options are:
| Option | Effect |
|---|---|
| --turbopack | Force Turbopack, the default bundler |
| --webpack | Use Webpack instead |
| --port or -p | Choose the port |
| --hostname or -H | Choose the hostname |
| --experimental-https | Serve over HTTPS |
During development, Next.js writes build output to .next/dev instead of .next, so you can run the dev server and a production build side by side.
Change the port
The dev server listens on port 3000 by default, and you can override that. To use a different port, pass --port or -p:
npm run dev -- --port 4000The server now runs at http://localhost:4000. You can also set the PORT environment variable, but not inside .env, because the server starts before .env is loaded.
Choose the bundler
Turbopack is the default bundler in Next.js 16, so you normally pass no flag at all. Use --webpack only when you need Webpack-specific behavior, and --turbopack or --turbo to force the default back on. Most projects never touch this option.
next dev --webpackServe over HTTPS
For testing webhooks or authentication, you can serve the app over a local HTTPS connection. Pass --experimental-https and Next.js generates a certificate for you:
next dev --experimental-httpsThis creates a self-signed certificate and serves https://localhost:3000, which is enough for local testing but not for production.
Run from another directory
Pass a directory argument to start the server for a project in a different folder, which is handy in monorepos where the app lives in a subfolder. If you pass no directory, Next.js uses the current folder.
next dev apps/webThe server starts for that app while your terminal stays wherever it was.
For how the dev server differs from production, read Next.js Development vs Production Mode. To understand the build command's output, read Understanding next build Output.
Rune AI
Key Insights
- next dev starts the server with hot reloading and error reporting.
- The bare next command is an alias for next dev.
- Turbopack is the default bundler, and --webpack opts out.
- Change the port with --port or the PORT environment variable.
- --experimental-https serves the app over a local HTTPS connection.
Frequently Asked Questions
Is running next the same as next dev?
How do I change the dev port?
Is Turbopack still the default?
Conclusion
next dev starts the development server with hot reloading and error reporting. Use --port for the address, --webpack to switch bundlers, and --experimental-https for a local HTTPS setup.
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.