Contents

Frontend Development › Rendering Strategies

CSR vs SSR vs SSG

Choosing a rendering strategy for SEO, speed and complexity.

Also known as: CSR vs SSR, SSR vs SSG, rendering strategies, client-side vs server-side rendering, static site generation

Where and when HTML gets produced is a major architecture choice.

CSR (client-side rendering)SSR (server-side rendering)SSG (static site generation)
HTML createdIn the browser, by JavaScriptOn the server, per requestAt build time, once
First responseAn empty shell plus JSFull HTMLPre-built HTML file
First paintSlower (wait for JS and data)FastFastest (can be served from a CDN)
SEO and link previewsWeaker unless crawlers run JSGoodGood
Server costStatic hostingA server rendering on every requestStatic hosting
Fresh dataFetched on the clientFresh per requestOnly as fresh as the last build
Personalized contentEasyPossible (careful with caching)Hard (needs client-side fetch)
ComplexityLowestHighest (server and client)Moderate
CSR:  server → <div id="root"></div> + app.js → browser runs JS → fetch data → render
SSR:  server runs the app per request → full HTML → browser shows it → hydrate
SSG:  build runs the app → static .html files → CDN serves them → (optional hydration)

Choosing

  • Mostly static content (docs, blog, marketing pages): SSG. Fast, cheap, easy to cache.
  • Public pages with frequently changing or personalized data, where SEO and first paint matter (product pages, news feeds): SSR, often with caching.
  • App behind a login, such as dashboards and internal tools, where SEO is irrelevant: CSR is often fine, and simpler.
  • Most real sites mix them per route, which is what meta-frameworks enable: static marketing pages, server-rendered product pages, client-rendered account area.

Variants worth knowing

  • Incremental/on-demand regeneration: static pages rebuilt in the background after a time or on a trigger, giving SSG speed with fresher data (the names and details depend on the framework).
  • Streaming SSR: send HTML in chunks as parts become ready.
  • Islands and server components: ship less JavaScript by hydrating only interactive parts (islands, server components).

What to measure

Load speed and stability: Core Web Vitals. SSR improves first paint, but hydration can delay interactivity, so look at both. Don’t choose by fashion. Choose by the page: who’s visiting, how fresh must the data be, and does a search engine need to see it.