Course map
Stage 1: App Router Foundations
Stage 2: The Rendering Model
Stage 3: Data, Caching and Mutations
Stage 4: Full-Stack Next.js
Stage 5: Production and Specialization

Part 01 / Topic 5 of 9

next dev, next build, next start

package.json's scripts block, generated, not hand-written:

"scripts": {
  "dev": "next dev",
  "build": "next build",
  "start": "next start",
  "lint": "eslint"
}

Three genuinely different commands:

Command What it does When to use it
npm run dev Starts a dev server with hot reload, unoptimized, with extra error overlays While you are writing code
npm run build Compiles and type-checks the whole app once, decides what can be pre-rendered, writes .next/ Before shipping, and before start
npm run start Serves the output build already produced — no compiling happens here Running what you are about to deploy, locally

Run dev for real and read the banner:

$ npm run dev -p 3100
> [email protected] dev
> next dev -p 3100

▲ Next.js 16.4.6 (Turbopack)
- Local:         http://localhost:3100
- Network:       http://192.168.1.3:3100
✓ Ready in 277ms
✓ Running next.config.ts took 60ms
- Cache Components enabled
- Partial Prefetching enabled

(varies) applies to the port, the IP, and every millisecond timing above — none of that is deterministic across machines or runs. What is not (varies): the version line, and the two "enabled" lines, which come straight from next.config.ts (section 8).

start refuses to run with no build behind it — try it on a project with no .next/ folder and you get Error: Could not find a production build in the '.next' directory. build must run first, always.

Done here? The practice set for Part 1 — including the solutions — is on the part page.

Search the guide