System requirements
Before you begin, make sure your development environment meets the following requirements:- Node.js version 20.9 or later — nodejs.org
- Operating system: macOS, Windows (including WSL), or Linux.
Supported browsers
Next.js supports modern browsers with zero configuration:| Browser | Minimum version |
|---|---|
| Chrome | 111+ |
| Edge | 111+ |
| Firefox | 111+ |
| Safari | 16.4+ |
Quick start
- pnpm
- npm
- yarn
- bun
http://localhost:3000.
--yes skips the interactive prompts, using saved preferences or defaults. The default setup enables TypeScript, Tailwind CSS, ESLint, App Router, and Turbopack, with import alias @/*, and includes AGENTS.md (with a CLAUDE.md symlink) to guide coding agents to write up-to-date Next.js code.Create with the CLI
To create a project interactively, runcreate-next-app without --yes:
- pnpm
- npm
- yarn
- bun
CLI flags
You can pass flags to skip prompts entirely:| Flag | Description |
|---|---|
--ts, --typescript | Initialize as a TypeScript project (default) |
--js, --javascript | Initialize as a JavaScript project |
--tailwind | Add Tailwind CSS config (default) |
--eslint | Add ESLint config |
--biome | Add Biome config |
--react-compiler | Enable the React Compiler |
--app | Use the App Router (default) |
--src-dir | Place source files inside a src/ directory |
--import-alias <prefix/*> | Set a custom import alias (default @/*) |
--empty | Initialize an empty project |
--api | Initialize a headless API using the App Router |
--use-npm / --use-pnpm / --use-yarn / --use-bun | Choose a package manager |
--skip-install | Skip installing packages |
--disable-git | Skip initializing a git repository |
--yes | Accept saved preferences or defaults for all prompts |
-e, --example <name|url> | Bootstrap from an official example or GitHub URL |
Manual installation
If you prefer to set things up yourself, install the required packages:- pnpm
- npm
- yarn
- bun
The App Router uses React canary releases built-in, which include all stable React 19 changes plus newer features being validated in frameworks. You should still declare
react and react-dom in package.json for tooling and ecosystem compatibility.package.json:
| Script | Description |
|---|---|
next dev | Starts the development server with Turbopack (default bundler) |
next build | Builds the application for production |
next start | Starts the production server |
eslint | Runs ESLint |
Create the app directory
Next.js uses file-system routing — routes are determined by how you structure your files.
Create the root layout
Create an
app/ folder, then add app/layout.tsx inside it. This is the root layout and is required. It must contain <html> and <body> tags.Create the home page
Add Both
app/page.tsx with some initial content:layout.tsx and page.tsx are rendered when a user visits /.Set up TypeScript
Minimum TypeScript version:
v5.1.0.ts or .tsx and run next dev. Next.js will automatically install the necessary dependencies and add a tsconfig.json file with the recommended configuration.
IDE plugin
Next.js includes a custom TypeScript plugin and type checker that VSCode and other editors can use for advanced type-checking and auto-completion. To enable the plugin in VS Code:Set up linting
Next.js supports linting with ESLint or Biome.- ESLint
- Biome
ESLint provides comprehensive rules. Add lint scripts to Create an explicit config file (the recommended format is
package.json:eslint.config.mjs). See the ESLint config reference for a recommended setup.Starting with Next.js 16,
next build no longer runs the linter automatically. Run your linter through npm scripts instead.next lint, migrate to the ESLint CLI with the codemod:
Set up absolute imports and module path aliases
Next.js has built-in support for thepaths and baseUrl options in tsconfig.json and jsconfig.json. These let you alias project directories to absolute paths, making imports cleaner.
baseUrl to your tsconfig.json:
paths entry:
paths is relative to the baseUrl location.