Overview
Introduction to Setup
Getting started with Next.js is quick and straightforward. You can instantly create and initialize a new Next.js project on your machine using the official setup tool. This tool guides you through project configuration, automatically sets up your file structure, and installs all necessary dependencies so you can start building your web application right away.
System Requirements and Prerequisites
Before you create a new project, make sure your machine meets the basic software requirements:
- Node.js: Version
20.9.0or higher is required.
Note
You can verify your installed Node.js version by running node -v in your terminal.
Creating a New Project
The easiest way to set up a new Next.js application is to run the interactive creation tool. Open your terminal and run the following command:
npx create-next-app@latestWhen you run the command, the tool will ask you a series of interactive questions to customize your new project, such as your preferred project name, styling options, and language preferences.
Customizing Your Setup with Command-Line Options
Configuration Flags Reference
Project Configuration Flags
| Flag | Description |
|---|---|
--ts, --typescript | Initialize as a TypeScript project (default). |
--js, --javascript | Initialize as a JavaScript project. |
--tailwind | Initialize with Tailwind CSS configuration (default). |
--react-compiler | Initialize with React Compiler enabled. |
--cache-components | Initialize with Cache Components enabled. |
--eslint | Initialize with ESLint configuration. |
--biome | Initialize with Biome configuration. |
--app | Initialize as an App Router project. |
--src-dir | Initialize inside a src/ directory. |
--rspack | Enable Rspack as the bundler. |
--import-alias <prefix/*> | Specify import alias to use (default "@/*"). |
--api | Initialize a headless API using the App Router. |
--empty | Initialize an empty project. |
--agents-md | Include AGENTS.md to guide coding agents (default). |
--agent-feedback | Prepare anonymized feedback for your review. |
--no-agent-feedback | Do not prepare anonymized feedback. |
--disable-git | Skip initializing a Git repository. |
--skip-install | Explicitly tell the CLI to skip installing packages. |
--reset, --reset-preferences | Reset saved preferences for the setup tool. |
--yes | Use saved preferences or defaults for unprovided options. |
-e, --example <name|url> | Bootstrap the app using an official example or public GitHub URL. |
--example-path <path> | Specify the path to the example in a GitHub URL if needed. |
Sources: packages/create-next-app/index.ts
Package Manager Flags
You can explicitly choose which package manager you want the tool to use for installing dependencies:
| Flag | Package Manager |
|---|---|
--use-npm | npm |
--use-pnpm | pnpm |
--use-yarn | Yarn |
--use-bun | Bun |
Sources: packages/create-next-app/index.ts
Tip
If you don't specify a package manager flag, the tool will automatically detect which package manager you are currently using.
Starting Your Development Server
Once your project has been successfully created and initialized, navigate into your new project folder and start the local development server:
cd your-project-name
npm run devOpen your web browser and visit http://localhost:3000 to see your running application.