Files
layout.tsx wraps everything below it. error.tsx catches failures in its subtree. not-found.tsx renders a 404. page.tsx is a route. route.ts is an API endpoint.A leading underscore marks a file as not routable, which is how shared components and data modules live beside pages.
Dynamic segments
[id] captures one segment. [...slug] captures the rest. [[...slug]] does both — it also matches the parent path, which is why /docs resolves here.Parameters arrive on props.params as string or undefined. Literal per-parameter types need generated declarations, and recovering them needs an assertion this codebase forbids.
app/users/[id]/page.tsx → /users/ada
app/docs/[[...slug]]/page.tsx → /docs and /docs/guides/routingStatic generation
A dynamic route has no request to read its parameters from, so it exports paths(). A route with parameters and no paths() is skipped and the reason is reported.Generation walks the same manifest a request does and renders through the same function, which is why a prerendered page is byte-identical to a served one.
export async function paths() {
const users = await getUsers();
return users.map((user) => ({ id: user.id }));
}URL in use: /docs/guides/routing — matched by [[...slug]], an optional catch-all.