Creating a Next.js project

Beginner · 1 min

Scaffold an app with create-next-app, read its prompts and defaults, and run the dev, build and start scripts on a current Next.js 16 install.

Before thisWhat Next.js is and why it exists

ByteGrad · 5 min · from 4:59

Creating a Next.js project

The player loads from youtube-nocookie.com when you press play. Nothing reaches YouTube before that.

Taught by ByteGradReport a problem with this video
Not started
Set this lesson's status

What you'll learn

  • create-next-app is the official scaffolder; `npx create-next-app@latest my-app --yes` skips the prompts and applies the recommended defaults.
  • The recommended defaults are TypeScript, ESLint, Tailwind CSS, the App Router, Turbopack, Cache Components and an AGENTS.md file, with no `src/` directory and no React Compiler.
  • Three scripts matter: `next dev` for the development server, `next build` for a production build, and `next start` to serve that build.
  • Next.js 16 needs Node.js 20.9 or newer, and `next lint` is gone, so the `lint` script just runs `eslint`.

One command

You need Node.js 20.9 or newer. Then:

npx create-next-app@latest my-app --yes
cd my-app
npm run dev

Open http://localhost:3000 and the starter page is there. The --yes flag skips the questions and uses your saved preferences, or the defaults if you have none. The same command works with pnpm create next-app, yarn create next-app and bun create next-app.

I ran this against the current release while preparing this lesson (Next.js 16.4.6, React 19 in package.json). If you leave out --yes, the first prompt asks whether to use the recommended defaults, and the defaults are listed in the question itself.

What the prompts decide

Choose “customize settings” and you are asked, one by one:

  • TypeScript. Yes, unless you have a reason. Next.js generates helper types for your routes, and they only help in TypeScript.
  • Linter. ESLint, Biome or none.
  • React Compiler. Off by default. It is opt-in memoization, covered in the React roadmap’s react compiler lesson.
  • Tailwind CSS. On by default.
  • src/ directory. Off by default. With it on, app/ lives at src/app/. This is a cosmetic choice, but changing it later means moving files.
  • App Router. Yes. The alternative is the older Pages Router, compared in the App Router and the Pages Router.
  • Cache Components. On in the recommended defaults. This switches on a newer caching model that you will meet properly in the data-fetching group; for now, know that the scaffolded next.config.ts contains cacheComponents: true, and that it makes Next.js stricter about reading request data outside a loading boundary.
  • Import alias. @/* maps to the project root, so you can write import { x } from "@/lib/x" instead of a chain of ../.
  • AGENTS.md. A short file that points coding assistants at the documentation bundled inside the next package.

The three scripts

The scaffold’s package.json has these:

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

next dev starts the development server using Turbopack, the default bundler since Next.js 16, with fast refresh. next build produces the production build and prints a table of every route. next start serves that build. lint runs eslint directly; the old next lint command is no longer how it works.

Run next build early and often. The dev server compiles a page when you ask for it and is lenient. The build type-checks everything and prerenders routes, so it is where mistakes about what runs when become visible. On the scaffold above, the build prints each route with a symbol: a circle for fully static, a half-filled circle for a prerendered shell with dynamic parts streamed in.

What the video covers

The embedded segment is a stretch of ByteGrad’s 2026 Next.js course, starting at the chapter “Create a new Next.js app” and running through “Fresh app lookaround” (about 5:00 to 9:40 of the full video). From the chapter titles and description, it creates a new app and then looks over the fresh project. The rest of the course covers many later topics and is worth watching in full once you have the basics. It is a long video because it spans the whole framework; this lesson uses only the opening.

Where this fits

You now have a running project and know what its prompts chose. Next, the project structure walks through every file and folder the scaffold produced.

Check yourself

  1. 01What do `next dev`, `next build` and `next start` each do?

    `next dev` runs the development server with hot reloading. `next build` compiles an optimized production build and reports which routes are static and which are dynamic. `next start` serves the output of a previous `next build`.

  2. 02Why would you run `next build` even while you are still developing?

    The dev server is forgiving and compiles pages on demand. The build type-checks the whole project and prerenders routes, so it catches errors that only appear when a route is rendered for production.

  3. 03What is a good reason to answer the prompts yourself rather than pass `--yes`?

    The defaults pick Tailwind, no `src/` directory and ESLint. If your team uses a different linter, wants application code under `src/`, or is not using TypeScript, you choose those at creation time because they are tedious to retrofit.

Go deeper

Notes

Private to you

Esc
↑↓ navigate↵ open? shortcuts

Keyboard shortcuts

Press Esc to close

Anywhere

⌘K
Search and commands
/
Search
?
This sheet
Esc
Close

Reading a lesson

J
Next lesson
K
Previous lesson
B
Bookmark