Next.js
We recommend starting a new Next.js app using create-next-app, which sets up everything automatically for you. To create a project, run
Installation
System Requirements:
- Node.js 18.17 or later.
- macOS, Windows (including WSL), and Linux are supported.
Automatic Installation
We recommend starting a new Next.js app using create-next-app, which sets up everything automatically for you. To create a project, run:
Get Starter Template
Alternatively, you can clone or download the template from the GitHub repo.
On installation, you'll see the following prompts:
Install Dependencies
Development Server
Creating directories
Next.js uses file-system routing, which means the routes in your application are determined by how you structure your files.
The app
directory
For new applications, we recommend using the App Router
. This router allows you to use React's latest features and is an evolution of the Pages Router
based on community feedback.
Create an app/
folder, then add a layout.tsx
and page.tsx
file. These will be rendered when the user visits the root of your application (/)
.
Create a root layout inside app/layout.tsx
with the required <html>
and <body>
tags:
app/layout.tsx
Finally, create a home page app/page.tsx
with some initial content:
app/page.tsx