Lesson 1 of 9 · 24m
The App Router Is Server-First
Why App Router components are server components by default, what that changes about data and bundle size, and how to stop fighting the architecture.
The App Router is not pages-plus-suspense. It is a server-first programming model with deliberate holes cut through it for browser interactivity. Once that clicks, most of the confusing rules stop looking arbitrary: imports execute on the server by default, only serialized props cross to the client, and the network waterfall belongs on the server where latency is measured in microseconds instead of residential Wi-Fi milliseconds.
A war story I have seen twice: a team ports a dashboard, sprinkles "use client" at the top of every file because hooks fail, and wonders why the JavaScript bundle is now larger than the old Pages Router app. Nothing was broken except the mental model. They opted out of the architecture file by file.
A route is a tree of server and client work
app/
dashboard/
layout.tsx # shared shell
page.tsx # server component by default
loading.tsx # streamed fallback boundary
error.tsx # error boundary (client component)
actions.ts # server actionspage.tsx can query the database directly because it runs on the server. That does not mean it should contain SQL strings forever — put queries in a data-access module — but it means there is no requirement to invent an API endpoint just so the browser can ask for data that the server already rendered.
// app/dashboard/page.tsx
import { listInvoices } from "@/server/invoices";
export default async function DashboardPage() {
const invoices = await listInvoices();
return <InvoiceTable rows={invoices} />;
}No effect. No loading flag. No client fetch cascade. The first render is real HTML with data in it.
The server render is not hydration
People describe this as "the server renders, then React hydrates." That is only true for client components. A server component never hydrates in the browser; React receives a serialized description of where it belongs and what props it passed down. That is why server component code and dependencies do not ship in the client bundle.
The practical division
- Server components: data access, secrets, formatting, expensive dependencies, static composition.
- Client components: event handlers, browser APIs, local state, subscriptions, animation, third-party widgets.
The correct instinct is: push "use client" as low in the tree as possible. A page is not interactive; a menu, chart, or editor inside it is.
Field notes
- You cannot import a server component directly into a client component module, but you can pass one through
children. Date, functions, class instances, and database handles do not cross the server-client boundary. Serialize explicit shapes.- A blank page with
useSearchParams() should be wrapped in a suspense boundaryis Next telling you a client read can suspend route generation; isolate it under<Suspense>. - If the first fix for every error is adding
"use client", stop and redraw the boundary. You are recreating the old client-rendered app inside the new router.
Was this lesson helpful?