Server-Side Rendering (SSR): HTML on Every Request
You'll learn: How SSR generates fresh HTML for every user request, enabling personalized content and real-time data from the very first page load.
The Per-Request Model
Unlike Client-Side Rendering (which sends the same blank HTML to everyone), SSR generates unique HTML for each incoming request. When a user visits your site, the server:
- Receives the request (including cookies, headers, auth tokens)
- Fetches necessary data from databases or APIs
- Renders React components to HTML on the server
- Sends the personalized, data-filled HTML back
This happens every single time someone loads the page.
Why This Matters
SSR's per-request nature enables two critical capabilities:
Personalization: Since the server sees the request context (who's logged in, their preferences, location), it can render "Welcome back, Sarah!" or show region-specific content in the initial HTML—not after a loading spinner.
Real-Time Data: The HTML contains fresh data from that moment. If your database updates, the next visitor sees the new information immediately. No stale static files sitting in a CDN.
The Trade-off
This power comes with a cost: the server does work per user, not once during build time. Every request triggers rendering, which means:
- Server CPU usage scales with traffic
- Response times depend on data-fetching speed
- You need server infrastructure (not just static hosting)
Think of it like a restaurant making each meal fresh to order versus reheating pre-made meals. SSR is the chef cooking when you place your order—slower but fresh and customizable.
Key Takeaway: SSR generates fresh, personalized HTML on every request by rendering React components server-side with real-time data, trading server resources for dynamic, user-specific initial content.