Next.js App Router uses your folder structure to create routes. No separate router config needed.
The simplest one.
app/├── page.tsx├── about/│ └── page.tsx└── contact/└── page.tsxThis gives you://about/contact
Folders can be nested to create deeper URLs.
app/└── blog/└── tutorials/└── page.tsx→ `/blog/tutorials`
[slug]This is probably the one you’ll use the most.
app/└── blog/└── [slug]/└── page.tsx
slug is the dynamic part of the URL. You can read it from params:
export default async function Page({params,}: {params: Promise<{ slug: string }>}) {const { slug } = await paramsreturn <h1>{slug}</h1>}
For /blog/nextjs, slug is "nextjs".
[...slug]Sometimes you need to match multiple URL segments.
app/└── docs/└── [...slug]/└── page.tsx
Think of it as:
[slug] → one segment[...slug] → one or more segments
Useful for documentation, CMS pages, or deep category structures.
(group)Route Groups are mainly for organizing your app.
app/├── (marketing)/│ ├── about/│ └── pricing/└── (dashboard)/└── dashboard/
The (marketing) and (dashboard) parts don’t appear in the URL.
They’re useful when you want different layouts or want to keep a large project organized.