intermediate
Route groups
Organize route trees without affecting URLs while separating layouts, teams, or product areas.
Route groups wrap folders in parentheses — `(marketing)`, `(shop)` — to organize files without affecting the URL. They enable different root layouts for product areas while sharing components and conventions.
app/
(marketing)/about/page.tsx → /about
(shop)/cart/page.tsx → /cart
Groups help team ownership and layout separation; they do not replace authentication boundaries or API design.
On interviews: explain why URLs stay unchanged and when separate layout trees beat one global layout.
Common pitfalls: using groups expecting URL prefixes, duplicating providers across groups without reason, and confusing groups with parallel routes.
The trade-off is filesystem clarity versus more layout files to maintain.
Checklist:
- Parentheses exclude segment from URL.
- Assign layouts per product area when needed.
- Do not use groups for auth alone.
- Document team conventions for folder names.