In the Next.js App Router, advanced routing patterns are defined using folder naming syntax: Square Brackets [param] for dynamic segments, Ellipses [...slug] for catch-all routes, and Parentheses (group) for organizing code without affecting the URL path.
[param]When a URL segment is dynamic (such as a blog post slug or user ID):
app/blog/[slug]/page.tsx/blog/learn-nextjs -> { slug: 'learn-nextjs' }[...slug]Matches any number of subsequent path segments and returns them as a string array:
app/docs/[...slug]/page.tsx/docs/getting-started -> { slug: ['getting-started'] }/docs/api/v2/authentication -> { slug: ['api', 'v2', 'authentication'] }/docs itself.[[...slug]] (Double Brackets)Matches all sub-segments AND matches the parent route itself:
/docs -> { slug: undefined }/docs/components/button -> { slug: ['components', 'button'] }(groupName)Route Groups allow organizing folders and sharing specific layouts without affecting the URL path:
Notice that neither (marketing) nor (dashboard) appears in the browser URL!
params and search searchParams be consumed inside an async Server Component page.tsx?/shop AND any deeply nested path like /shop/clothing/jackets/winter?app/(auth)/login/page.tsx?app/tutorials/[...slug]/page.tsx, what will (await params).slug evaluate to when a user visits /tutorials/web/react/hooks?(marketing)/about/page.tsx and (admin)/about/page.tsx)?Continue learning with hands-on practice, examples, and exercises in the upcoming topic.
Test your understanding of this lesson with 5 questions. Each question has one correct answer.
Practice in live mentor-led sessions with real projects, mock tests, and verifiable certification at MSK Institute.