M. Kodirov

STAGE 02 / LESSON 04

Next.js routing and server/client components

The App Router turns folders into routes and lets a page combine server and client work.

THE IDEA

Understand it.

In the App Router, a page.tsx file defines a route and layout.tsx can wrap related pages. Server Components are the default in the app directory; they can fetch data or use server-only secrets without sending that code to the browser.

A Client Component begins with 'use client' and is appropriate for browser APIs, event handlers and interactive state. Keep secrets on the server and send the client only data it needs.

SEE IT IN CONTEXT

A simple route structure

app/
  layout.tsx
  page.tsx            → /
  tasks/
    page.tsx          → /tasks
    [id]/page.tsx     → /tasks/123

The folder names determine the route. A dynamic [id] segment represents a value in the URL.

LEARN FROM REAL WEBSITES

See it in the real world.

These simplified structures come from public sources. Company systems change, and the sources may describe only one project or an earlier design.

Fern

Vercel customer story, 2025

Documentation in one app

Vercel's customer story reports that Fern uses Next.js App Router to serve documentation for multiple customers.

  1. Documentation request
  2. Next.js App Router
  3. Customer documentation

What to learn: Routing and layouts can organize many related pages within one application. This is a vendor-reported case study.

Read the source: Fern customer story

Whop

Vercel customer story, 2023

A Next.js application

Vercel describes Whop's use of the Next.js App Router in a customer story about its web experience.

  1. Visitor
  2. Next.js App Router
  3. Whop web experience

What to learn: The router organizes pages and rendering. Consult the case study for its reported scope rather than assuming every service uses Next.js.

Read the source: Whop customer story

TRY IT YOURSELF

Practice.

A button needs an onClick handler. Should that component use the server or client boundary?

Show one possible answer

The interactive component needs to be a Client Component. It can still be rendered inside a server-rendered page.

GO DEEPER

Official references.