Skip to content
Tech Atlas, home
Search
Esc
  • All roadmapsBrowse every learning path
  • ExploreFind a technology area
  • ProjectsGuided projects and builds
  • My AtlasYour learning dashboard
Lesson 1 of 6 · Concept · 25 min · revision 3

Rendering Strategies Side by Side: CSR, SSR, SSG and Streaming

Compare client rendering, server rendering, static generation with revalidation and streaming, and choose a mode per route from data freshness, personalisation and performance needs.

Contentsand lesson path

On this page

  1. Why it matters
  2. The four strategies
  3. Choosing per route
  4. Streaming: start the answer early
  5. Check your understanding
  6. Apply it
  7. Review prompt

Lessons of Server Components & Rendering Modes

  1. Rendering Strategies Side by Side: CSR, SSR, SSG and Streaming Concept · 25 min
  2. Server and Client Components: Boundaries, Secrets and Sessions Worked example · 30 min
  3. Fetching, Streaming and Caching Server Data Worked example · 30 min
  4. Server Actions, Revalidation and Hydration Pitfalls Worked example · 25 min
  5. Lab: Move a Signed-In Dashboard to the Server Lab · 30 min
  6. Check: Pick the Rendering Mode Knowledge check · 10 questions

What you will learn

  • Compare client-side rendering, server-side rendering, static generation with revalidation and streaming, and choose a mode per route from data freshness and performance needs.

Prerequisites: Next.js App Router & Routing

01. Why it matters

Every React page has to answer one question before anything else: where and when does the HTML get built? The answer decides who waits and for what. Build it in the browser and the user stares at a shell while JavaScript loads. Build it on the server for every request and each visitor pays for a fresh render. Build it once at deploy time and everyone gets an instant answer — to a question that may have gone stale.

These are not competing frameworks. They are four strategies you can mix within one application, one decision per route. A marketing page, a documentation article and a signed-in dashboard have different freshness, personalisation and performance needs, so they deserve different modes. Choosing deliberately is often the difference between a site that feels instant and one that keeps showing loading states.

This lesson compares the four strategies side by side and shows how the Next.js App Router expresses the choice for each route. The examples follow a small shop application — a static landing page and a signed-in portfolio dashboard — that you will build yourself in the lab lesson of this skill.

02. The four strategies

With client-side rendering (CSR), the server sends a near-empty HTML shell and a JavaScript bundle. The browser downloads, parses and executes the bundle, then fetches data from APIs, and only then renders the interface. Everything after that first load can be fast and stateful, which is why editors, dashboards with heavy interaction and offline-capable tools use it. The price is paid at the start: the user waits through download, parse, execute and data fetching before seeing content, and any data the page needs is fetched from the browser, where nothing can stay secret.

With server-side rendering (SSR), the server runs the component tree for each request and sends finished HTML. The user sees content as soon as the first bytes arrive, and the data was fetched on the server, close to the database. The costs run the other way: every request does server work, and the browser still downloads the JavaScript so that the page can become interactive — a step called hydration.

With static generation (SSG), the HTML is built once at deploy time and served from a CDN. Requests are answered from cache without running your code, which makes this the fastest and cheapest mode. The trade-off is staleness. Time-based revalidation refreshes the page after an interval using stale-while-revalidate semantics: the first request after the interval is still served the cached page, and it triggers a fresh render in the background. On-demand revalidation refreshes exactly when your data changes.

Streaming is not a fourth destination but a delivery change: the server sends the shell of the page immediately and flushes each completed section as soon as it is ready, instead of holding the response until the slowest query finishes. It combines naturally with SSR, because the per-request work is the same — only the waiting is reorganised.

The four strategies compared
Strategy    HTML built       Freshness       Server cost per request
CSR         in the browser   live per fetch  none (data APIs pay)
SSR         every request    live            full render + data fetch
SSG         at build time    stale, then     none (CDN serves cache)
            + revalidation   refreshed
Streaming   every request    live, section   shell sent early, rest
            as it streams    by section      follows as ready

03. Choosing per route

Three questions pick the mode for a route.

  1. Does the content depend on who is looking? Public and identical for everyone points to SSG. Personalised content — a portfolio, an inbox — must be rendered at request time, because static output would be shared between users.
  2. How fresh must the data be? Content that changes only when an editor publishes can be rendered once and refreshed on demand. Live prices, feeds and anything per-user need request-time rendering or short-lived cache windows.
  3. How much interactivity does it need? Occasional buttons do not justify CSR for the whole page; you can keep the page on the server and hand small islands to the browser — that is the next lesson's subject. A full working surface that never touches the network again, such as an offline-capable drawing tool, may still be genuinely client-rendered.

In the Next.js App Router a page is a React Server Component by default, and Next decides the mode from what the page does. A page that reads no request data is prerendered at build time. Reading the session cookie, reading request headers, or a fetch with cache: 'no-store' makes the page dynamic — rendered per request. (A plain fetch with no cache option is not enough on its own: on a page with no request-time reads, Next calls it once during the build.) You can also declare intent: in projects without Cache Components, exporting revalidate = 60 opts a route into time-based revalidation. In apps with Cache Components enabled (cacheComponents: true in next.config.ts, which new create-next-app projects turn on by default but existing or hand-made projects must add), the use cache directive with cacheLife gives a component or data function an explicit cache lifetime. So the mode is not a global switch; it falls out of the route's code.

Expected output — `next build` (tail) for the shop app of this skill, Next 16.4.6
Route (app)
┌ ○ /
├ ○ /_not-found
├ ƒ /api/notes
├ ƒ /api/session
└ ƒ /dashboard


○  (Static)   prerendered as static content
ƒ  (Dynamic)  server-rendered on demand

The landing page at / reads no request data, so Next prerendered it once at build time. /dashboard reads the session cookie, so it is marked dynamic and renders per request. The two route handlers are dynamic because they read cookies and bodies. Checking this table after every build is the quickest way to notice when a page accidentally became dynamic — usually because a stray request-time read slipped in — or when a page you thought was personalised is being cached for everyone.

04. Streaming: start the answer early

Without streaming, a request-time page waits for its slowest data source before sending anything: if the risk API takes two seconds, the whole page takes two seconds. Streaming splits the page at <Suspense> boundaries. The server sends the shell — layout, headings, fast sections and a declared fallback for each pending section — then flushes each section's HTML as its data arrives, and a small script swaps it into place.

The rules of thumb follow directly. Put each slow, independent section in its own suspended component rather than awaiting it in the page, or the whole response waits for it again. Fast sections still go above the boundary so they ship with the shell. And remember what streaming does not change: the slow query still takes its time, and the client JavaScript for interactivity still has to load and hydrate. Streaming buys an early, informative first paint, not a faster database.

05. Check your understanding

Practice check · 3 questions

Pick the mode

Three situations, three decisions.

Q1. A team is building a drawing tool that must run entirely in the browser, keep large drawing state between strokes and work offline once loaded. Which rendering mode fits?
Q2. A documentation site is statically generated and revalidated on demand when an article is edited. What does a typical reader request cost the application server?
Q3. A streamed page shows account details immediately and loads a market-rates panel inside Suspense. What does the user see in the first moment?
Practice only: not graded, not saved, not evidence.

06. Apply it

List five routes of an application you know: home, pricing, docs article, signed-in dashboard, and one route of your choice. For each, answer the three questions from this lesson — who sees it, how fresh the data must be, how interactive it is — and write down the mode you would choose, plus the signal Next.js would use for it (no request data, reading cookies, an explicit revalidate window, or a use cache lifetime). Flag any route where your current application's choice differs from the one you just derived, and check the build output table to see what Next actually decided.

07. Review prompt

Without looking back, write one sentence per strategy saying where the HTML is built and what the user waits for first. Then explain, for a page that is identical for every visitor and changes only on publish, why static generation with on-demand revalidation beats rendering per request. Finally, name the two things streaming does not speed up.

References

Your progress

Reading state

Sign in to save that you finished reading this lesson.

Sign in to mark reading complete

Prove this skill

10 questions · about 8 minutes · scored automatically. Marking a lesson as read never demonstrates a skill.
Take the skill check