File-Based Routing
Next.js completely eliminates the need for manual routing schemas. You structure your routes purely through nested folders.
Folder Paths
Every folder translates directly into a URL segment.
app/page.tsxmaps to/app/dashboard/page.tsxmaps to/dashboardapp/dashboard/settings/page.tsxmaps to/dashboard/settings
Route Groups
Sometimes you want to group folders together purely for code organization, but you don't want those folders to affect the URL path.
You can create a Route Group by wrapping the folder name in parentheses ( ).
For example, you might want to share a layout between marketing pages, but exclude the admin dashboard.
Directory structure:
app/(marketing)/about/page.tsxapp/(marketing)/contact/page.tsxapp/admin/page.tsx
Even though the routes are inside the (marketing) folder, the URL paths will still cleanly resolve to /about and /contact. The parenthesis folder is completely ignored by the Next.js router.