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: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: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:
Create the app directory
Next.js uses file-system routing — routes are determined by how you structure your files.
1
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.2
Create the home page
Add Both
app/page.tsx with some initial content:layout.tsx and page.tsx are rendered when a user visits /.3
Create the public folder (optional)
Create a
public/ folder at the root of your project to store static assets such as images and fonts. Files inside public can be referenced from your code starting from the base URL (/).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:1
Open the command palette
Press
Ctrl/⌘ + Shift + P.2
Select the TypeScript version
Search for TypeScript: Select TypeScript Version and select Use Workspace Version.
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.