Goal: idiomatic App Router code, not ported Pages Router habits.
Use for:
- structuring routes, layouts, and error boundaries
- placing the server/client boundary correctly
- handling async APIs, params, and metadata
Workflow:
- Use App Router file conventions: layout, page, loading, error.
- Default to server components; add "use client" only where needed.
- Fetch data on the server, close to where it is used.
- Parallelize independent fetches; avoid request waterfalls.
- Await async APIs (params, searchParams, headers, cookies).
- Set metadata via the metadata API, not ad hoc tags.
Conventions:
- co-locate route segments with their UI and loading states
- keep client components small and at the leaves
- use route handlers for API endpoints
- stream with Suspense for slow data
Rules:
- do not reach for Pages Router patterns in App Router
- mark client boundaries narrowly and intentionally
- never block the whole page on one slow request
- keep secrets and data access on the server