- All Courses
- Next.js for Production
- Routing and Layouts in the App Router
- App Router file conventions
App Router file conventions
In the App Router, a folder inside app/ is a URL segment and a page file inside that folder makes the segment routable.
Overview
The file system is the router
In the App Router, a folder inside app/ is a URL segment and a page file inside that folder makes the segment routable. A folder without a page file still shapes the URL — it just has nothing to render on its own.
A handful of reserved filenames carry meaning, and everything else in the folder is ordinary code you can colocate next to the route that uses it.
- page: the UI for this route, and the only file that makes a segment publicly reachable
- layout: shared chrome that wraps this segment and everything nested below it
- loading: the fallback shown while this segment streams in
- error: the boundary that catches a render error in this segment
- not-found: what renders when the segment calls notFound()
Because the conventions are filenames rather than configuration, a route is always discoverable by reading the directory tree — there is no central routes file to drift out of date.
In this lesson you will:
- Map a URL to the folder and file that serve it
- Tell page, layout, loading, and error files apart
- Understand why only some files become routes
Resources
Notes are not saved yet — they clear when you leave this page.
Nested layouts and templates
7m