# Next.js Documentation @doc-version: >=15.0.0 @doc-version-notes: Some features may have extended or refined behavior in minor or patch releases @router: App Router @router-note: Unless otherwise noted in each section, these documents apply to the App Router -------------------------------------------------------------------------------- title: "Getting Started" description: "Learn how to create full-stack web applications with the Next.js App Router." source: "https://nextjs.org/docs/app/getting-started" -------------------------------------------------------------------------------- # Getting Started Welcome to the Next.js documentation! This **Getting Started** section will help you create your first Next.js app and learn the core features you'll use in every project. ## Pre-requisite knowledge Our documentation assumes some familiarity with web development. Before getting started, it'll help if you're comfortable with: * HTML * CSS * JavaScript * React If you're new to React or need a refresher, we recommend starting with our [React Foundations course](/learn/react-foundations), and the [Next.js Foundations course](/learn/dashboard-app) that has you building an application as you learn. ## Next Steps - [Installation](/docs/app/getting-started/installation.md) - [Project Structure](/docs/app/getting-started/project-structure.md) - [Layouts and Pages](/docs/app/getting-started/layouts-and-pages.md) - [Linking and Navigating](/docs/app/getting-started/linking-and-navigating.md) - [Server and Client Components](/docs/app/getting-started/server-and-client-components.md) - [Partial Prerendering](/docs/app/getting-started/partial-prerendering.md) - [Fetching Data](/docs/app/getting-started/fetching-data.md) - [Updating Data](/docs/app/getting-started/updating-data.md) - [Caching and Revalidating](/docs/app/getting-started/caching-and-revalidating.md) - [Error Handling](/docs/app/getting-started/error-handling.md) - [CSS](/docs/app/getting-started/css.md) - [Image Optimization](/docs/app/getting-started/images.md) - [Font Optimization](/docs/app/getting-started/fonts.md) - [Metadata and OG images](/docs/app/getting-started/metadata-and-og-images.md) - [Route Handlers and Middleware](/docs/app/getting-started/route-handlers-and-middleware.md) - [Deploying](/docs/app/getting-started/deploying.md) - [Upgrading](/docs/app/getting-started/upgrading.md) -------------------------------------------------------------------------------- title: "Installation" description: "Learn how to create a new Next.js application with the `create-next-app` CLI, and set up TypeScript, ESLint, and Module Path Aliases." source: "https://nextjs.org/docs/app/getting-started/installation" -------------------------------------------------------------------------------- # Installation ## System requirements Before you begin, make sure your system meets the following requirements: * [Node.js 18.18](https://nodejs.org/) or later. * macOS, Windows (including WSL), or Linux. ## Automatic installation The quickest way to create a new Next.js app is using [`create-next-app`](/docs/app/api-reference/cli/create-next-app.md), which sets up everything automatically for you. To create a project, run: ```bash filename="Terminal" npx create-next-app@latest ``` On installation, you'll see the following prompts: ```txt filename="Terminal" What is your project named? my-app Would you like to use TypeScript? No / Yes Would you like to use ESLint? No / Yes Would you like to use Tailwind CSS? No / Yes Would you like your code inside a `src/` directory? No / Yes Would you like to use App Router? (recommended) No / Yes Would you like to use Turbopack for `next dev`? No / Yes Would you like to customize the import alias (`@/*` by default)? No / Yes What import alias would you like configured? @/* ``` After the prompts, [`create-next-app`](/docs/app/api-reference/cli/create-next-app.md) will create a folder with your project name and install the required dependencies. ## Manual installation To manually create a new Next.js app, install the required packages: ```bash package="pnpm" pnpm i next@latest react@latest react-dom@latest ``` ```bash package="npm" npm i next@latest react@latest react-dom@latest ``` ```bash package="yarn" yarn add next@latest react@latest react-dom@latest ``` ```bash package="bun" bun add next@latest react@latest react-dom@latest ``` > **Good to know**: The App Router uses [React canary releases](https://react.dev/blog/2023/05/03/react-canaries) built-in, which include all the stable React 19 changes, as well as newer features being validated in frameworks. The Pages Router uses the React version you install in `package.json`. Then, add the following scripts to your `package.json` file: ```json filename="package.json" { "scripts": { "dev": "next dev", "build": "next build", "start": "next start", "lint": "next lint" } } ``` These scripts refer to the different stages of developing an application: * `next dev`: Starts the development server. * `next build`: Builds the application for production. * `next start`: Starts the production server. * `next lint`: Runs ESLint. ### Create the `app` directory Next.js uses file-system routing, which means the routes in your application are determined by how you structure your files. Create an `app` folder. Then, inside `app`, create a `layout.tsx` file. This file is the [root layout](/docs/app/api-reference/file-conventions/layout.md#root-layout). It's required and must contain the `` and `
` tags. ```tsx filename="app/layout.tsx" switcher export default function RootLayout({ children, }: { children: React.ReactNode }) { return ( {children} ) } ``` ```jsx filename="app/layout.js" switcher export default function RootLayout({ children }) { return ( {children} ) } ``` Create a home page `app/page.tsx` with some initial content: ```tsx filename="app/page.tsx" switcher export default function Page() { return{post.content}
{post.content}
{count} likes
{count} likes
View pictures
{/* Works, since Carousel is a Client Component */}View pictures
{/* Works, since Carousel is a Client Component */}Read the latest posts below.
Read the latest posts below.