Next.js App Router - Route Groups

Route Groups are a powerful feature in Next.js that allow you to organize routes into logical groups without affecting the URL path structure. You create route groups by using parentheses `(folderName)`.

This organization method is particularly useful for scenarios where different route segments require different layouts, such as grouping admin pages, user pages, and public pages. Each group can have its own layout and styles, while the URL path remains clean.

Admin Group

Pages related to the admin backend

User Group

Pages related to user profiles

Public Group

Publicly accessible pages

Admin Group

Pages related to the admin backend

Folder Structure: (group-name)/
Dashboard
Admin Dashboard
/layouts/route-groups/dashboardVisit
User Management
User Management
/layouts/route-groups/usersVisit