File-based routing#
The directory tree under app/pages is the route table.
| File | URL | Mode |
|---|---|---|
index.tsx | / | universal |
about.server.tsx | /about | server |
blog/[slug].tsx | /blog/:slug | universal |
docs/[...path].tsx | /docs/*path | universal |
(marketing)/pricing.tsx | /pricing | universal |
Rules#
indexmaps to its folder.blog/index.tsxserves/blog.[name]is a dynamic segment.[...name]is a catch-all.(group)folders share layouts and organize files, but never appear in the URL.- Files whose names start with
_are never routes._layout.tsxwraps the pages beside it and below it. - Two files that resolve to the same URL stop the build with a conflict error.
Priority#
Static segments beat dynamic segments, and dynamic segments beat catch-alls. /blog/new wins over /blog/[slug].
Why not a config file#
A central route table drifts from the files it describes. A file-based table cannot drift, because the files are the table.

