How to Create a Next.js App with create-next-app

Create a new Next.js app with the create-next-app CLI, understand its prompts, and start the dev server in a few minutes.

6 min read

The fastest way to start a Next.js project is create-next-app, the official scaffolding CLI. It generates a ready-to-run app with TypeScript, ESLint, Tailwind CSS, the App Router, and Turbopack already configured, so the only thing left is writing your first page.

Run this in the folder where you want the project:

bashbash
npx create-next-app@latest my-app

Replace my-app with your project name. The CLI asks a few questions, creates a new folder with that name, and installs the dependencies for you.

The prompts you will see

After the project name, create-next-app stops to ask how the project should be configured. The first question is whether to use the recommended defaults or to customize the setup.

texttext
What is your project named? my-app
Would you like to use the recommended Next.js defaults?
    Yes, use recommended defaults - TypeScript, ESLint, Tailwind CSS, App Router, AGENTS.md
    No, reuse previous settings
    No, customize settings - Choose your own preferences

The recommended setup enables TypeScript, Tailwind CSS, ESLint, the App Router, and Turbopack. It also sets an import alias of @/* and adds an AGENTS.md file that helps coding agents write current Next.js code. Accept the defaults unless you have a specific reason to change one, because each is the value the Next.js team ships with.

If you choose customize settings, you can pick TypeScript or plain JavaScript, choose ESLint, Biome, or no linter, enable the React Compiler, add Tailwind CSS, use a src directory, and adjust the import alias. Each choice only affects the generated files, so you can change any of them later.

Skip the prompts with --yes

For scripts and tutorials, pass the --yes flag to accept saved preferences or the defaults without prompts.

bashbash
npx create-next-app@latest my-app --yes

This is the version you see in automated guides. Always include a project name so the generated folder is predictable.

Run the app

Move into the new folder and start the dev server:

bashbash
cd my-app
npm run dev

Open http://localhost:3000. The server starts with Turbopack, the default bundler, and shows the generated landing page with links to the documentation and a starter example. Edit app/page.tsx and save to see the page update immediately without a manual refresh.

Common problems

  • Node version. create-next-app needs Node.js 20.9 or newer, so check with node --version first. An old Node install fails during the dependency step.
  • Wrong folder. Always cd into the new folder before running the dev server, or npm will not find the project scripts.
  • Port in use. If port 3000 is taken, the server picks the next free port and prints the new address in the terminal.

Once the app runs, read Next.js Project Structure Explained to understand the generated folders, or learn the flags in Running the Next.js Dev Server.

Rune AI

Rune AI

Key Insights

  • create-next-app scaffolds a Next.js project in one command.
  • Recommended defaults include TypeScript, ESLint, Tailwind CSS, the App Router, and Turbopack.
  • The --yes flag skips prompts using saved preferences or defaults.
  • Node.js 20.9 or newer is required.
  • Run the dev server inside the new folder with npm run dev.
RunePowered by Rune AI

Frequently Asked Questions

What Node.js version do I need?

Node.js 20.9 or newer. Check with node --version before running create-next-app, because an older version fails during installation.

Can I create the app without answering prompts?

Yes. Pass a project name and the --yes flag, for example npx create-next-app@latest my-app --yes, to accept saved preferences or the recommended defaults.

Which package manager should I use?

Any supported one works: npm, pnpm, yarn, or bun. The CLI adapts its install and run commands to the package manager you use.

Conclusion

create-next-app is the fastest way to start a Next.js project. Run it with a project name, accept the recommended defaults or customize them, then start the dev server and open localhost:3000.