Rendering Strategies: CSR vs SSR vs SSG vs ISR

Mediumβ€’

Rendering strategy is not about memorizing acronyms. It is about understanding when HTML is generated and where the work happens.

πŸ”₯ Insight

Good engineers don’t memorize CSR vs SSR vs SSG. They understand when the user gets meaningful HTML and who pays the cost β€” server or client.

🧠 Core Mental Model

CSR β†’ HTML late, JS heavy
SSR β†’ HTML early, server per request
SSG β†’ HTML precomputed at build time
ISR β†’ HTML cached + refreshed over time

All rendering strategies are trade-offs between:

TTFB (Time to First Byte)
FCP / LCP (how quickly content appears)
JavaScript execution cost
Server load vs client load

Quick Navigation: CSR β€’ SSR β€’ SSG β€’ ISR β€’ Hydration β€’ Comparison β€’ Decision Guide β€’ Hybrid

The Four Rendering Strategies

Rendering strategies are different ways of shifting work between build time, request time, and client runtime.

  • CSR (Client-Side Rendering): browser executes JavaScript and generates most of the UI at runtime
  • SSR (Server-Side Rendering): server generates HTML on each request
  • SSG (Static Site Generation): HTML is generated at build time
  • ISR (Incremental Static Regeneration): static HTML is cached and refreshed over time

Client-Side Rendering (CSR)

In CSR, the browser receives minimal HTML and JavaScript is responsible for generating the UI.

Mental model: HTML arrives late, JavaScript does most of the work.

How CSR Works

1
User visits URL in browser
2
Browser requests page from server
3
Server returns static files (HTML, CSS, JS) - only once
4
JavaScript executes, fetches data, renders UI at runtime
5
Subsequent navigations only fetch data (no full page reload)

βœ… Key Point: Static files loaded once, only data fetched on navigation

Advantages

  • βœ“Fast navigation after load: client-side routing avoids full page reloads
  • βœ“Rich interactivity: great for dashboards and app-like UIs
  • βœ“Decoupled architecture: frontend and backend can evolve independently
  • βœ“Lower request-time server cost: server mainly serves static assets and APIs

Disadvantages

  • βœ—Slower initial render: UI depends on JavaScript download, parsing, and execution
  • βœ—SEO can be weaker: content may appear late to crawlers if critical HTML is missing initially
  • βœ—Higher client CPU and memory cost: especially on low-end devices
  • βœ—Blank or skeletal initial experience: until app code runs

🎯 Best For:

Dashboards, admin panels, authenticated apps, internal tools, and highly interactive experiences where SEO is not the main requirement.

Server-Side Rendering (SSR)

SSR generates HTML on the server for each request.

How SSR Works

1
User visits URL in browser
2
Browser sends request to server
3
Server generates HTML with data populated
4
Browser receives meaningful HTML immediately
5
JavaScript later hydrates the page for interactivity

⚠️ Key Point: Each navigation = New server request + New HTML page

Advantages

  • βœ“Fast initial content display: useful for LCP and perceived performance
  • βœ“SEO-friendly: crawlers receive meaningful HTML immediately
  • βœ“Works better under JS failure: content can still appear before interactivity loads

Disadvantages

  • βœ—Higher server load: HTML is generated per request
  • βœ—TTFB can grow: expensive server work delays the response
  • βœ—Still pays hydration cost: fast HTML does not guarantee fast interactivity

🎯 Best For:

SEO-critical pages, public content, dynamic per-request data, and first-load experiences where meaningful HTML should arrive quickly.

Static Site Generation (SSG)

SSG generates HTML during the build process and serves it as static files.

Mental model: HTML is precomputed β€” close to zero request-time render cost.

How SSG Works

1
Build time: Generate all HTML pages
2
Deploy static HTML files to CDN
3
User requests page
4
CDN serves pre-built HTML instantly
5
Page renders immediately (no server processing)

βœ… Key Point: HTML generated once at build time, served instantly from CDN

Advantages

  • βœ“Excellent performance: pre-built HTML served from CDN
  • βœ“Excellent SEO: full content available in HTML
  • βœ“Highly scalable: traffic is handled by static infrastructure
  • βœ“Low request-time cost: no server rendering on each request

Disadvantages

  • βœ—Content updates need rebuilds: unless paired with revalidation
  • βœ—Build times can grow: especially for large sites
  • βœ—Weak fit for personalized content: same HTML for everyone

🎯 Best For:

Blogs, documentation, marketing pages, portfolios, and other mostly static pages that benefit from maximum CDN performance.

Incremental Static Regeneration (ISR)

ISR combines static delivery with periodic regeneration after deployment.

Mental model: HTML is cached and refreshed over time.

How ISR Works

1
Build time: Generate initial HTML pages
2
Deploy static HTML to CDN
3
User requests page β†’ CDN serves cached HTML
4
After revalidate time (e.g., 60s), regenerate in background
5
Next request gets fresh HTML

βœ… Key Point: Best of both worlds - static performance with dynamic updates

Advantages

  • βœ“Static-like performance: cached HTML from CDN
  • βœ“Fresher content: without full rebuilds
  • βœ“Better scaling for large catalogs: not every page must rebuild every time

Disadvantages

  • βœ—Stale windows exist: some users may briefly see older content
  • βœ—Cache invalidation is real complexity: refresh rules need careful design
  • βœ—Framework/platform support matters: behavior depends on hosting primitives

🎯 Best For:

E-commerce product pages, blog posts, documentation, and content that changes periodically but does not need real-time freshness.

ISR Revalidation Strategies

  • Time-based: regenerate every X seconds
  • On-demand: trigger updates via webhook or API
  • Hybrid: combine scheduled and event-based refresh

Hydration and JavaScript Cost

πŸ”₯ Insight

Hydration is not rendering β€” it is attaching behavior to already-rendered HTML.

What Happens During Hydration

  • HTML is already present from SSR or SSG
  • JavaScript bundle loads in the browser
  • Framework executes component logic again on the client
  • Event listeners are attached and interactivity becomes available

Why It Matters

  • Large bundles delay interactivity
  • JavaScript execution can dominate on low-end devices
  • Fast HTML does not automatically mean fast UX

Senior-Level Takeaway

The biggest bottleneck in many modern apps is not HTML generation. It is JavaScript execution, hydration work, and the cost of making the page interactive.

Comparison Table

AspectCSRSSRSSGISR
Initial Load⚠ Slower - Must load JS firstβœ“ Fast - HTML with data readyβœ“ Fastest - Pre-built HTMLβœ“ Fastest - Pre-built HTML
Subsequent Navigationβœ“ Fastest - Only data fetchedβœ— Slower - Full page reloadβœ“ Fast - Static filesβœ“ Fast - Static files
SEOβœ— Poor - JS-rendered contentβœ“ Excellent - Pre-rendered HTMLβœ“ Excellent - Pre-rendered HTMLβœ“ Excellent - Pre-rendered HTML
Content Updatesβœ“ Instant - Client-sideβœ“ Instant - Server-sideβœ— Requires rebuild - Build time⚠ Periodic - Revalidation
Server Loadβœ“ Low - Static files onlyβœ— High - Every requestβœ“ None - CDN onlyβœ“ Low - Only on revalidation
Build Timeβœ“ Fast - No pre-renderingβœ“ Fast - No pre-renderingβœ— Slow - All pages at build⚠ Medium - Initial build
Dynamic Contentβœ“ Full supportβœ“ Full supportβœ— Limited - Static only⚠ Periodic updates

Decision Guide

Choose CSR when

  • β€’SEO is not critical
  • β€’You need highly interactive client-side UX
  • β€’Content is heavily personalized or authenticated

Choose SSR when

  • β€’First-load content visibility matters
  • β€’SEO is important
  • β€’Data changes frequently per request

Choose SSG when

  • β€’Content is mostly static
  • β€’You want maximum CDN performance
  • β€’Rebuild-based publishing is acceptable

Choose ISR when

  • β€’You want SSG-like speed with periodic freshness
  • β€’You have many pages but only some need frequent refresh
  • β€’Full rebuilds are too expensive

πŸ”₯ Interview Insight

Most real-world performance issues are not caused by choosing CSR vs SSR. They are caused by excessive JavaScript, poor data fetching, and hydration cost. Understanding where the cost moves matters more than memorizing acronyms.

Hybrid Approaches

Most production apps combine strategies rather than choosing a single one everywhere.

SSR + CSR Hydration

A common hybrid approach is: server render the first HTML, then use client-side routing for later navigation.

What This Looks Like

1
Server returns meaningful HTML

good for SEO and first paint

2
JavaScript loads and hydrates the page

interactivity becomes available

3
Later navigation happens on the client

faster transitions without full page reload

βœ… Key benefit: SEO-friendly initial HTML plus faster app-like navigation afterward.

Performance Benefits

  • βœ“Fast initial load: Server-rendered HTML shows immediately
  • βœ“Fast navigation: Client-side routing after hydration
  • βœ“Progressive enhancement: Works even if JavaScript fails
  • βœ“Selective hydration: Only hydrate what's needed

SEO Benefits

  • βœ“Crawlable content: Search engines see full HTML
  • βœ“Meta tags: Proper Open Graph and Twitter cards
  • βœ“Social sharing: Rich previews work correctly

UX Benefits

  • βœ“No blank screen: Content visible immediately
  • βœ“Smooth transitions: Client-side navigation feels instant
  • βœ“Works offline: After initial load, app can work offline

When to Use Hybrid Approach

Common Public/App Split

Public pages use SSR or SSG for SEO. Authenticated app areas use CSR for speed and interactivity.

SSG + CSR

Static article content is pre-rendered, but comments, search, or personalization load on the client.

ISR + CSR

Product pages stay fast and cacheable while cart, filters, and user interactions stay client-driven.

Best Practices

  1. Pick per page, not per app
  2. Minimize JavaScript on public pages
  3. Use SSR or SSG where meaningful HTML matters
  4. Use CSR where interactivity and personalization dominate
  5. Measure hydration and bundle cost, not just TTFB