File-Based Routing
In the App Router, the folder structure under app/ directly maps to the URL structure of your site. There is no routes file to edit and nothing to register — you create a folder, and if it contains the right file, that folder becomes a URL.
Folders map directly to URLs
app/
├── page.tsx # /
├── about/
│ └── page.tsx # /about
└── blog/
└── page.tsx # /blogSpecial file names
Within any folder under app/, a handful of specifically-named files each have a defined meaning to the router:
File | Meaning |
|---|---|
| Defines the unique UI for a route and makes that folder's path publicly accessible. |
| Shared UI that wraps the page and any nested routes below it, without re-rendering on navigation. |
| An instant loading UI shown automatically while a route's content is being fetched (covered in depth on its own page). |
| A boundary that catches runtime errors within its segment and renders a fallback UI (covered on its own page). |
| The UI shown when |
A folder without page.tsx is not a route
Creating a folder under app/ does not, by itself, expose a URL. Only a folder that contains a page.tsx becomes visitable. This is intentional — it lets you organize files (components, styles, tests, utilities specific to one part of your app) alongside your routes without accidentally exposing them as pages.
components/ here is not a route
app/
└── dashboard/
├── page.tsx # "/dashboard" — this exists
└── components/
└── Chart.tsx # NOT a route — just a colocated fileA folder under
app/becomes a URL segment.Only a folder containing
page.tsxis actually visitable.layout.tsx,loading.tsx,error.tsx, andnot-found.tsxeach have a specific, reserved meaning.Folders without a
page.tsxare safe to use purely for organization.