> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/vercel/next.js/llms.txt
> Use this file to discover all available pages before exploring further.

# next dev

> Start the Next.js development server with Hot Module Replacement, error reporting, and more.

`next dev` starts the application in development mode with Hot Module Replacement (HMR), error reporting, and incremental compilation.

```bash theme={null}
next dev [directory] [options]
```

<Note>
  Development builds are output to `.next/dev` instead of `.next`, so `next dev` and `next build` can run concurrently without conflicts.
</Note>

## Options

<ParamField path="[directory]" type="string">
  The directory containing the Next.js application. Defaults to the current working directory.
</ParamField>

<ParamField path="-p / --port <port>" type="number" default="3000">
  Port number to listen on. Can also be set via the `PORT` environment variable.
</ParamField>

<ParamField path="-H / --hostname <hostname>" type="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.
</ParamField>

<ParamField path="--turbopack / --turbo" type="boolean">
  Start development mode using Turbopack (default bundler in Next.js 15+).
</ParamField>

<ParamField path="--webpack" type="boolean">
  Start development mode using webpack instead of the default Turbopack bundler.
</ParamField>

<ParamField path="--disable-source-maps" type="boolean" default="false">
  Disable source map generation in the development server.
</ParamField>

<ParamField path="--no-server-fast-refresh" type="boolean">
  Disable server-side Fast Refresh. When set, changes to server-side code require a full page reload instead of a soft refresh.
</ParamField>

<ParamField path="--inspect [[host:]port]" type="string">
  Enable the Node.js inspector for debugging server-side code. Accepts an optional `host:port` (default `127.0.0.1:9229`).
</ParamField>

<ParamField path="--experimental-https" type="boolean">
  Start the server with HTTPS using a locally-trusted self-signed certificate generated by [`mkcert`](https://github.com/FiloSottile/mkcert).
</ParamField>

<ParamField path="--experimental-https-key <path>" type="string">
  Path to a custom HTTPS private key file.
</ParamField>

<ParamField path="--experimental-https-cert <path>" type="string">
  Path to a custom HTTPS certificate file.
</ParamField>

<ParamField path="--experimental-https-ca <path>" type="string">
  Path to a custom HTTPS certificate authority file.
</ParamField>

<ParamField path="--experimental-upload-trace <traceUrl>" type="string">
  Report a subset of the debugging trace to a remote HTTP URL. Includes sensitive data.
</ParamField>

<ParamField path="--experimental-next-config-strip-types" type="boolean">
  Use Node.js native TypeScript resolution for `next.config.ts` or `next.config.mts`.
</ParamField>

<ParamField path="--experimental-cpu-prof" type="boolean">
  Enable CPU profiling via V8's inspector. Profiles are saved to `.next/cpu-profiles/` on process exit.
</ParamField>

<ParamField path="-h / --help" type="boolean">
  Show all available options.
</ParamField>

## 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

```bash theme={null}
next dev -p 4000
# or
PORT=4000 next dev
```

<Note>
  `PORT` cannot be set in `.env` files — the HTTP server starts before environment files are loaded.
</Note>

### Expose to the network

```bash theme={null}
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

```bash theme={null}
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:

```bash theme={null}
next dev --experimental-https \
  --experimental-https-key ./certs/localhost-key.pem \
  --experimental-https-cert ./certs/localhost.pem
```

<Warning>
  `--experimental-https` is for development only. Use a certificate from a trusted authority in production.
</Warning>

### Debugging server-side code

```bash theme={null}
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

```bash theme={null}
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

| Version   | Changes                    |
| --------- | -------------------------- |
| `v15.0.0` | Turbopack for `dev` stable |
