Next.js 16 brings a more refined, modern, and consistent project structure, especially with features like Cache Components, proxy.ts, improved App Router, and the new create-next-app template.
If you’re starting a new project—or upgrading from Next.js 13–15—this guide explains exactly what each folder does and how everything fits together.
A typical Next.js 16 project looks like this:
my-app/├── app/├── public/├── components/├── lib/├── hooks/├── styles/├── proxy.ts├── postcss.config.mjs├── tailwind.config.ts├── next.config.ts├── package.json└── tsconfig.json
Below, we break down each part.
app/ — The Core of Your ApplicationNext.js 16 uses the App Router by default. Every route, page, layout, and server action lives here.
app/├── layout.tsx├── page.tsx├── global.css├── (marketing)/│ ├── layout.tsx│ └── page.tsx├── dashboard/│ ├── page.tsx│ ├── loading.tsx│ ├── error.tsx│ └── default.tsx└── api/└── hello/└── route.ts
app/:| File | Purpose |
|---|---|
layout.tsx | Root layout; wraps all routes |
page.tsx | Page content (maps to a route) |
loading.tsx | Automatic loading UI |
error.tsx | Error boundary for the route |
default.tsx | Required for parallel route slots |
route.ts | API endpoints |
global.css | App-wide CSS |
"use client"proxy.ts — Replaces middleware.tsStarting in Next.js 16:
✔ middleware.ts → Deprecated
✔ proxy.ts → New standard
my-app/└── proxy.ts
And now always runs in Node.js runtime, providing a clearer network boundary.
Example:
export default function proxy(request) {return Response.redirect(new URL('/home', request.url));}
public/ — Static AssetsAnything in public/ is served directly at the root URL:
public/logo.png → /logo.pngpublic/fonts/... → /fonts/...
Used for:
components/ — Reusable UI & Client ComponentsThis folder is for UI building blocks:
components/├── button.tsx├── navbar.tsx└── card.tsx
Recommended use:
lib/ — Server Utilities & Core LogicCommon for:
lib/├── db.ts├── auth.ts└── cache.ts
This keeps your app folder clean and focused on routing.
hooks/ — Custom React HooksClient or shared hooks go here:
hooks/├── useScroll.ts├── useAuth.ts└── useTheme.ts
styles/ — Global & Shared StylesIncludes:
styles/└── globals.css
If you’re using Tailwind, some projects prefer:
app/global.css
next.config.tsMain Next.js config.
Enables features like:
export default {cacheComponents: true, // NEWreactCompiler: false, // stable but off by defaultturbopack: {}, // stable bundler};
tsconfig.jsonTypeScript config + path aliases:
{"compilerOptions": {"baseUrl": ".","paths": {"@/*": ["./*"]}}}
postcss.config.mjsUsed when Tailwind or PostCSS plugins are enabled.
export default {plugins: {tailwindcss: {},autoprefixer: {},},};
tailwind.config.tsIf using Tailwind CSS:
content: ["./app/**/*.{ts,tsx}", "./components/**/*.{ts,tsx}"]
types/Store TypeScript interfaces and types.
data/Local JSON or markdown files.
context/React context providers.
models/For ORM-based apps (Prisma, Drizzle).
scripts/Automation tasks / migrations.
project-root/│├── app/ # ⚡ App Router (SSR + RSC + Server Actions)│ ├── (marketing)/ # Route Group: public pages│ │ ├── layout.tsx│ │ ├── page.tsx│ │ └── about/│ │ └── page.tsx│ ││ ├── (dashboard)/ # Route Group: authenticated area│ │ ├── layout.tsx│ │ ├── page.tsx│ │ ├── settings/│ │ │ └── page.tsx│ │ └── analytics/│ │ └── page.tsx│ ││ ├── api/ # 🛰️ Route Handlers (Server Functions)│ │ ├── auth/│ │ │ └── route.ts│ │ └── posts/│ │ └── route.ts│ ││ ├── layout.tsx # Root Layout (global UI)│ ├── page.tsx # Landing page│ ├── error.tsx # Error Boundary│ ├── loading.tsx # App-wide loading UI│ ├── not-found.tsx # 404 Page│ └── global-error.tsx # v16+ Global error handling│├── components/ # 🧩 Reusable UI Components│ ├── ui/ # shadcn/ui or atomic components│ ├── layout/ # Navbar, footer, sidebar...│ ├── charts/ # Custom chart components│ └── forms/ # Input, button, form components│├── lib/ # ⚙️ Business Logic / Utilities│ ├── auth.ts # Authentication logic│ ├── db.ts # DB client (Prisma / Drizzle)│ ├── api-client.ts # Fetch wrappers (client-side)│ ├── validations.ts # Zod schemas│ └── utils.ts # General utilities│├── hooks/ # 🎣 Custom React hooks (client)│ ├── useAuth.ts│ ├── useDebounce.ts│ └── useMediaQuery.ts│├── store/ # 🧠 Global state (Zustand / Jotai / Redux)│ └── userStore.ts│├── styles/ # 🎨 Global styling│ ├── globals.css│ └── variables.css│├── public/ # 📁 Static files│ ├── favicon.ico│ └── images/│ └── logo.png│├── tests/ # 🧪 Unit, Integration, E2E tests│ ├── components/│ ├── pages/│ └── api/│├── scripts/ # 🛠️ DevOps / maintenance scripts│ ├── seed.ts│ └── deploy.sh│├── proxy.ts # 🌐 v16 Proxy Middleware + Auth├── next.config.ts # Next.js configuration (Edge, caching, adapters)├── tailwind.config.ts # Tailwind CSS settings├── tsconfig.json # TypeScript configuration├── .env.local # Local environment variables└── package.json # Dependencies & scripts
This is the clean, modern structure recommended for Next.js 16.