# 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.

- Type: method
- Domain: Engineering & architecture
- Level: Intermediate
- Last reviewed: 2026-09-23
- Original: [Soroush’s Product Wiki](<https://wiki.soroush.uk/topic/server-side-rendering/>)

## What 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.

## Why 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.

## When 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.

## How 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.

## A practical 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.

## Where 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.

## Visualization

[View the visualization on the website](<https://wiki.soroush.uk/topic/server-side-rendering/#visualization-server-side-rendering>)

## Sources

1. [Rendering on the Web](<https://web.dev/articles/rendering-on-the-web>) — web.dev · Official technical guidance
2. [renderToPipeableStream](<https://react.dev/reference/react-dom/server/renderToPipeableStream>) — React · Official framework documentation

## Related topics

- [Client-Side Rendering \(CSR\)](<https://wiki.soroush.uk/topic/client-side-rendering/>)
- [Static Site Generation \(SSG\)](<https://wiki.soroush.uk/topic/static-site-generation/>)
- [Hydration](<https://wiki.soroush.uk/topic/hydration/>)
