Skip to content
Getting StartedChapter 2 / 34Beginner4 min read

Installation & Project Structure

Next.js install and project structure: create a Next.js 16 project with create-next-app, the Node 20.9+ requirement, and what the app, public and next.config files do.

On this page

1. What are installation and project structure?

In Next.js, folders and file names are not just for organization. Inside app/, every folder is a route segment, and special names like page.tsx and layout.tsx have specific meanings. So understanding the structure is the first step to understanding routing.

2. Why does it matter?

With a manual setup you have to configure React, a bundler, TypeScript, ESLint and Tailwind separately. create-next-app gives you all of it with good defaults.

Manual setupcreate-next-app
Install every package yourselfOne command, everything ready
Write the bundler config yourselfTurbopack by default, no config
A separate TypeScript setupA TypeScript-first template
Any folder structure you likeThe App Router convention
Errors on the wrong Node versionA clear Node 20.9+ requirement

3. Where is it used?

SituationWhat to do
A new projectnpx create-next-app@latest
An older Next.js 15 projectnpx @next/codemod@canary upgrade latest
Team onboardingA new developer understands the project quickly from its structure
MonorepoEach app has its own app/ and next.config.ts

4. How does it work?

Check your Node version first. Next.js 16 needs Node.js 20.9 or newer, and Node 18 support has ended.

Setup flow
Check the version with node -v
npx create-next-app@latest
Choose the recommended defaults
npm run dev
The app runs at localhost:3000

The default template includes App Router, TypeScript, Tailwind CSS and ESLint. You can also choose an optional src/ folder, in which case app/ moves inside it.

5. Code example

Creating the project

bash
node -v
npx create-next-app@latest my-app
cd my-app
npm run dev

Folder structure

bash
my-app/
  app/
    layout.tsx
    page.tsx
    globals.css
    favicon.ico
  public/
  next.config.ts
  tsconfig.json
  eslint.config.mjs
  postcss.config.mjs
  package.json

package.json scripts

json
{
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "eslint"
  }
}

How does the code work?

PartMeaning
app/The App Router, every folder is a route segment
app/layout.tsxThe root layout, the html and body tags live here
app/page.tsxThe page for the / route
public/Static files, served directly at URLs like /logo.png
next.config.tsNext.js configuration
next devThe dev server, with Turbopack
next buildThe production build, with Turbopack
next startRuns the built app in production mode
eslintLinting now uses ESLint directly, next lint was removed

Interview tip

If you are asked, "What is the difference between public/ and app/?", say: public/ is for static assets that are served as they are, and app/ is for routes and components that get rendered.

6. Common mistakes

Mistake: Running the project on an old Node version

Why? Next.js 16 refuses to run on anything below Node 20.9 and the errors are confusing.

Better: Check node -v and install Node 20.9+ (preferably the LTS).

Mistake: Deleting the root layout

Why? The App Router needs a root layout with the html and body tags, and the app does not run without it.

Better: Always keep app/layout.tsx and render html and body in it.

Mistake: Putting images in the app folder and accessing them by URL

Why? Files in the app folder are not served directly at a URL.

Better: Put static images and files in the public folder.

Mistake: Leaving a next lint script in package.json

Why? This command does not exist in Next.js 16, so the script fails.

Better: Switch the script to eslint, and the next-lint-to-eslint-cli codemod can help.

7. What to learn before and after

Final quick revision

PointDetail
Install commandnpx create-next-app@latest
Node requirement20.9 or newer
Where routes liveThe app/ folder
Static filesThe public/ folder
Dev servernext dev (Turbopack)
Lintingeslint directly, not next lint