NextjsDevelopment Workflow & CLI

Development Workflow & CLI

Every Next.js project revolves around the same small set of CLI commands, provided by the next package itself. create-next-app wires them into package.json scripts for you, so day-to-day you run them through npm run rather than typing next directly.

The core commands

Command

What it does

next dev

Starts the local development server with Fast Refresh, detailed error overlays, and no production optimizations.

next build

Compiles an optimized production build — statically generating what it can, and preparing everything else to be rendered on demand.

next start

Serves the output of next build as a production Node.js server.

next lint

Runs ESLint using the eslint-config-next rule set tailored for Next.js projects.

The package.json convention

A scaffolded project wires each command up as an npm script, so you rarely type next directly:

package.json (scripts excerpt)

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

Bash
npm run dev     # develop locally
npm run build   # build for production
npm run start   # run the production build
npm run lint    # check for lint issues
Fast Refresh

While next dev is running, saving a file triggers Fast Refresh: edited components update in the browser almost instantly, and in most cases React component state is preserved across the edit — you do not lose your place in a form or a modal just because you tweaked some styling.

 ✓ Compiled /about in 87ms
Turbopack

Turbopack is a newer, Rust-based bundler built specifically for Next.js, designed to replace Webpack as the dev-server engine with significantly faster cold starts and incremental updates on large projects. You can opt into it explicitly:

Bash
next dev --turbo
Note
Turbopack's dev-server support has matured quickly across recent Next.js releases and became the default for `next dev` starting with Next.js 15.x in newer scaffolds, but production builds (`next build --turbo`) are still catching up. Check the release notes for the exact Next.js version you are using before relying on it in production.
  • next dev — local development with Fast Refresh.

  • next build — creates the optimized production build.

  • next start — serves that build as a Node.js server.

  • next lint — lints the project with Next.js-aware rules.