Skip to main content
next dev starts the application in development mode with Hot Module Replacement (HMR), error reporting, and incremental compilation.
next dev [directory] [options]
Development builds are output to .next/dev instead of .next, so next dev and next build can run concurrently without conflicts.

Options

[directory]
string
The directory containing the Next.js application. Defaults to the current working directory.
-p / --port <port>
number
default:"3000"
Port number to listen on. Can also be set via the PORT environment variable.
-H / --hostname <hostname>
string
default:"0.0.0.0"
Hostname to listen on. Set to 0.0.0.0 to make the server available on all network interfaces.
--turbopack / --turbo
boolean
Start development mode using Turbopack (default bundler in Next.js 15+).
--webpack
boolean
Start development mode using webpack instead of the default Turbopack bundler.
--disable-source-maps
boolean
default:"false"
Disable source map generation in the development server.
--no-server-fast-refresh
boolean
Disable server-side Fast Refresh. When set, changes to server-side code require a full page reload instead of a soft refresh.
--inspect [[host:]port]
string
Enable the Node.js inspector for debugging server-side code. Accepts an optional host:port (default 127.0.0.1:9229).
--experimental-https
boolean
Start the server with HTTPS using a locally-trusted self-signed certificate generated by mkcert.
--experimental-https-key <path>
string
Path to a custom HTTPS private key file.
--experimental-https-cert <path>
string
Path to a custom HTTPS certificate file.
--experimental-https-ca <path>
string
Path to a custom HTTPS certificate authority file.
--experimental-upload-trace <traceUrl>
string
Report a subset of the debugging trace to a remote HTTP URL. Includes sensitive data.
--experimental-next-config-strip-types
boolean
Use Node.js native TypeScript resolution for next.config.ts or next.config.mts.
--experimental-cpu-prof
boolean
Enable CPU profiling via V8’s inspector. Profiles are saved to .next/cpu-profiles/ on process exit.
-h / --help
boolean
Show all available options.

Watch mode

The development server automatically watches all source files. When you save a change, Next.js incrementally recompiles only the affected modules and applies the update via HMR without a full page reload. For Server Components and server-side code, the affected pages are revalidated and the browser updates automatically.

Examples

Change the port

next dev -p 4000
# or
PORT=4000 next dev
PORT cannot be set in .env files — the HTTP server starts before environment files are loaded.

Expose to the network

next dev --hostname 0.0.0.0
This makes the dev server accessible at your machine’s LAN IP address, useful for testing on mobile devices.

HTTPS in development

next dev --experimental-https
Generates a locally-trusted certificate and starts the server at https://localhost:3000. Useful for testing webhooks, OAuth flows, and other HTTPS-only features. To use an existing certificate:
next dev --experimental-https \
  --experimental-https-key ./certs/localhost-key.pem \
  --experimental-https-cert ./certs/localhost.pem
--experimental-https is for development only. Use a certificate from a trusted authority in production.

Debugging server-side code

next dev --inspect
Opens the Node.js inspector on the default port. Connect with Chrome DevTools at chrome://inspect or any editor with Node.js debug support.

CPU profiling

next dev --experimental-cpu-prof
Profiles are saved to .next/cpu-profiles/ when you stop the server (Ctrl+C). Open .cpuprofile files in Chrome DevTools under the Performance tab.

Version history

VersionChanges
v15.0.0Turbopack for dev stable

Build docs developers (and LLMs) love