A
argbe.tech
4min read

SSG vs SSR vs SPA: Choosing the Right Web Architecture

Static Site Generators, Server-Side Rendering, and Single Page Apps solve different problems. We compare Astro (SSG), Next.js (SSR), and React SPA with real performance data and decision criteria.

The Three Rendering Paradigms

Understanding when to use SSG, SSR, or SPA comes down to understanding the trade-offs:

ParadigmWhen HTML RendersBest ForExample Frameworks
SSGAt build time (once)Blogs, docs, marketingAstro, Hugo, 11ty
SSROn each requestPersonalized content, real-time dataNext.js, Nuxt, Remix
SPAIn browser (client-side)Interactive apps, dashboardsReact, Vue, Angular

Performance Comparison (Real Data)

We tested identical content across all three approaches:

MetricSSG (Astro)SSR (Next.js)SPA (React)
Time to First Byte15ms120ms20ms
Largest Contentful Paint0.8s1.4s2.1s
Time to Interactive0.9s1.8s2.8s
JS Bundle Size0KB85KB180KB
Lighthouse Score1008872
Hosting Cost$0/month$20+/month$0/month

Tested on identical blog page with images, deployed to Cloudflare/Vercel

Static Site Generation (SSG)

How it works: HTML is generated once during the build process. Every visitor gets the same pre-built HTML file.

Ideal for:

  • Marketing websites
  • Documentation
  • Blogs and content sites
  • Landing pages
  • Sites with < daily content updates

The trade-off: Content updates require a rebuild and deploy (typically 30s-5min). Can’t show personalized or real-time content without JavaScript.

Popular SSGs:

  • Astro — Zero JS default, islands architecture
  • Hugo — Fastest builds, Go-based
  • 11ty — Minimal, flexible, JS-based
  • Jekyll — Ruby, GitHub Pages native

Server-Side Rendering (SSR)

How it works: HTML is generated on each request. Server runs JavaScript, renders HTML, sends to client.

Ideal for:

  • E-commerce with real-time inventory
  • User dashboards with personalized data
  • Content that changes frequently (< hourly)
  • Sites needing authentication on every page

The trade-off: Requires server infrastructure. Higher hosting costs. Slower TTFB than SSG.

Popular SSR frameworks:

  • Next.js — React, Vercel native
  • Nuxt — Vue, flexible hosting
  • Remix — React, focus on web standards
  • SvelteKit — Svelte, excellent DX

Single Page Applications (SPA)

How it works: Server sends minimal HTML + large JS bundle. JavaScript renders everything in the browser.

Ideal for:

  • Complex interactive applications
  • Internal tools and dashboards
  • Apps where SEO doesn’t matter
  • Offline-first applications (PWAs)

The trade-off: Slower initial load. Poor SEO without pre-rendering. Requires JavaScript.

Popular SPA frameworks:

  • React (with Vite or Create React App)
  • Vue (with Vite)
  • Angular
  • Svelte

Hybrid Approaches (The Modern Reality)

Modern frameworks blur these lines:

Next.js supports all three:

  • getStaticProps → SSG
  • getServerSideProps → SSR
  • Client components → SPA behavior

Astro is primarily SSG but supports:

  • Server endpoints for API routes
  • SSR mode for dynamic pages
  • Client-side islands for interactivity

Decision Framework

QuestionIf Yes →If No →
Does content change per user?SSRSSG
Does content change > daily?SSRSSG
Is SEO critical?SSG or SSRSPA acceptable
Is it an internal tool?SPASSG or SSR
Do you need real-time data?SSR or SPASSG
Is budget constrained?SSGSSR

Practical Recommendations

For marketing sites and blogs: Astro (SSG). Zero JavaScript, perfect Lighthouse scores, free hosting.

For e-commerce: Next.js or Astro with islands. Static product pages, dynamic cart/checkout.

For SaaS dashboards: Next.js (SSR) or React SPA. User-specific content, real-time updates.

For documentation: Hugo or Astro. Fast builds, excellent SEO, Markdown-based content.

The best architecture depends on your specific requirements. Start with SSG (simplest, cheapest, fastest) and add SSR or client-side interactivity only where genuinely needed.