Create a new project
Run the following command to scaffold a new Next.js application:- npm
- yarn
- pnpm
create-next-app will generate a pages/ directory instead of app/.
Start the development server
pages/index.tsx (or pages/index.js) to start building.
Manual setup
If you prefer to set up Next.js manually:Create the pages directory
Create a
pages/ directory at the root of your project. Add an index.tsx file:pages/index.tsx
TypeScript
Next.js has built-in TypeScript support. Create atsconfig.json at the root of your project and run next dev—Next.js will automatically configure it for you.
tsconfig.json
next-env.d.ts file that ensures the Next.js types are picked up by the TypeScript compiler. Do not delete or edit this file.
For the App Router equivalent, see App Router installation.
System requirements
- Node.js 18.18 or later.
- macOS, Windows (including WSL), or Linux.
