Rendering Strategies: CSR vs SSR vs SSG vs ISR
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 timeAll rendering strategies are trade-offs between:
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
β 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
β οΈ 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
β 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
β 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
| Aspect | CSR | SSR | SSG | ISR |
|---|---|---|---|---|
| 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
good for SEO and first paint
interactivity becomes available
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
- Pick per page, not per app
- Minimize JavaScript on public pages
- Use SSR or SSG where meaningful HTML matters
- Use CSR where interactivity and personalization dominate
- Measure hydration and bundle cost, not just TTFB