Skip to main content

App Router (app/)

Routes are directories containing a page.tsx/page.jsx/page.ts. Walk app/ recursively:
  • app/page.tsx → /
  • app/billing/page.tsx → /billing
  • app/(group)/settings/page.tsx → /settings — route groups (name) add no path segment
  • app/blog/[slug]/page.tsx → /blog/[slug] — dynamic segment; substitute a real sample value for the render (/blog/hello-world)
  • app/@modal/…, app/…/layout.tsx, loading.tsx, error.tsx, template.tsx, default.tsx → not routes; layout.tsx is shared chrome — include it under styles/components for every child route
  • app/api/, route.ts → API endpoints, skip
Title: read export const metadata = { title } or generateMetadata in page.tsx/layout.tsx; fall back to the directory name. Source: the page.tsx file verbatim, plus imported local components under components.

Pages Router (pages/)

  • pages/index.tsx → /, pages/about.tsx → /about, pages/blog/[slug].tsx → /blog/[slug]
  • pages/api/ → skip, pages/_app.tsx and pages/_document.tsx → shared chrome, include as styles/components
  • getServerSideProps/getStaticProps data fetching lives in the same file — source already captures it

Shared styles

Always include app/globals.css (or styles/globals.css), tailwind.config.*, app/layout.tsx, app/(group)/layout.tsx files covering the route, and any theme/design-token module.