methodEngineering & architecture

Server-Side Rendering (SSR)

Server-side rendering generates a route's HTML in a server environment and sends it to the browser as the navigation response.

Download Markdown (.md)

01What it means

Server-side rendering (SSR) executes view logic on a server for each request or cache miss and returns HTML representing the current route. The browser can display that markup before optional client code loads. SSR differs from static generation because rendering normally happens at request time, though caches can reuse responses.[1][2]

Request-time HTML generation The server renders the current route before optional client enhancement
  1. 01Navigation requestRoute and request context
  2. 02Load authorized dataServer-controlled dependencies
  3. 03Render HTMLTemplates or components, optionally streamed
  4. 04Browser displaysParse markup while assets load
  5. 05Enhance or hydrateOnly interactions that need client code

SSR normally runs per request or cache miss, unlike build-time static generation; cached responses can still be reused.

02Why it matters

SSR can deliver meaningful content early, support link previews and crawlers, and centralize access to protected data. It also adds server compute, response latency, caching decisions, and possible hydration work.

03When to use it

Use SSR when routes need request-specific or frequently changing content and early HTML has user or discovery value. Prefer static generation for safely precomputable pages and client rendering for private interaction-heavy views where a server-rendered first view adds little.

04How it works

  1. A navigation request reaches a server runtime with route and request context.
  2. The server loads authorized data and executes templates or components.
  3. It returns HTML, often streamed or cached, with styles and resource references.
  4. The browser parses and displays the response while remaining assets load.
  5. Optional client code hydrates or enhances only the interactions that need it.

05A practical example

Example

A marketplace renders product pages on the server using current price and stock data. It caches safe fragments, streams the product heading early, and hydrates only purchasing controls rather than delaying all content for a client render.

06Where it breaks

Slow data dependencies increase time to first byte, rendering consumes server capacity, and personalized HTML is harder to cache safely. Full client hydration can duplicate rendering work and make visible controls temporarily unresponsive.

Common mistakes

  • Equating SSR with a complete multi-page architecture.
  • Fetching dependencies serially before sending any HTML.
  • Caching personalized responses without correct variation and privacy controls.
  • Claiming SSR is fast without measuring server latency and hydration cost.

07Sources

  1. Rendering on the Webweb.dev · Official technical guidanceRendering on the Web
  2. renderToPipeableStreamReact · Official framework documentationrenderToPipeableStream
View saved topics

Start typing to search titles, definitions, categories, and frameworks.