Course map
Stage 1: App Router Foundations
Stage 2: The Rendering Model
Stage 3: Data, Caching and Mutations
Stage 4: Full-Stack Next.js
Stage 5: Production and Specialization

Part 02 / Topic 3 of 9

Nested routes: folders nest, URLs nest

Apna Bazaar's home page, harness/app/store/page.tsx, is built exactly like Part 1's homepage, just one folder deeper:

import Link from "next/link";
import { products } from "./lib/products";

export default function StorePage() {
  return (
    <main style={{ fontFamily: "system-ui", padding: "2rem", maxWidth: 560 }}>
      <h1>Apna Bazaar</h1>
      <p>A small storefront, one route at a time.</p>
      <ul>
        {products.map((product) => (
          <li key={product.id}>
            <Link href={`/store/products/${product.id}`}>{product.name}</Link> &mdash; ₹{product.price.toLocaleString("en-IN")}
          </li>
        ))}
      </ul>
      {/* ... */}
    </main>
  );
}

A second folder, harness/app/store/products/page.tsx, nests one level further and becomes /store/products — the full catalog page. No config connects these two files to each other; the folder tree alone decides that /store/products lives "under" /store.

Run the real build and read the route table — this is the harness's actual state after every section in this part is in place, so a few routes below (dynamic and catch-all) are explained in the next two sections:

$ npm run build
...
Route (app)
┌ ○ /
├ ○ /_not-found
├ ○ /store
├ ○ /store/about
├ ○ /store/contact
├ ○ /store/products
├   /store/products/[id]
│ ├ ◐ /store/products/[id]
│ ├ ○ /store/products/p1
│ ├ ○ /store/products/p2
│ └ ○ /store/products/p3
└   /store/search/[...terms]
  ├ ◐ /store/search/[...terms]
  ├ ○ /store/search/silk
  └ ○ /store/search/pottery

○  (Static)             prerendered as static content
◐  (Partial Prerender)  prerendered as static HTML with dynamic server-streamed content

Notice the tree shape in the table itself: /store/products/[id] and its three prerendered ids sit nested under /store, and /store/search/[...terms] sits at the same depth — the table is drawing the same folder nesting you just built, not a separate concept.

Full files: examples/01-store-home-page.tsx, examples/02-products-listing-page.tsx.

Done here? The practice set for Part 2 — including the solutions — is on the part page.

Search the guide