Creating a Next.js project
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.
Creating a Next.js project
The player loads from youtube-nocookie.com when you press play. Nothing reaches YouTube before that.
Not started
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 atsrc/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.tscontainscacheComponents: 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 writeimport { x } from "@/lib/x"instead of a chain of../. - AGENTS.md. A short file that points coding assistants at the documentation bundled inside the
nextpackage.
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
What 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`.
Why 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.
What 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
Notes are saved to your account.
Everything else on this page works without one — progress and bookmarks keep themselves in this browser and come with you when you sign in. Notes are the one thing worth not trusting to a browser you might clear.
Your notes could not be loaded.