SSG vs SSR vs SPA: Choosing the Right Web Architecture
An older article from 21 April 2023, kept online for reference. For current work on this topic, see Software development.
The Three Rendering Paradigms
Understanding when to use SSG, SSR, or SPA comes down to understanding the trade-offs:
| Paradigm | When HTML Renders | Best For | Example Frameworks |
|---|---|---|---|
| SSG | At build time (once) | Blogs, docs, marketing | Astro, Hugo, 11ty |
| SSR | On each request | Personalized content, real-time data | Next.js, Nuxt, Remix |
| SPA | In browser (client-side) | Interactive apps, dashboards | React, Vue, Angular |
What About Performance?
Updated 2026-10-18: earlier versions showed a benchmark table (time to first byte, LCP, Lighthouse scores, hosting cost) from a test we can no longer reproduce or document, so it’s removed.
What holds without a benchmark: a page that arrives as finished HTML has less work left to do in the browser than one that must download and run JavaScript before content appears. How much that matters depends on your pages, hosting, and caching, so measure your own pages with field data before choosing on speed alone. The website speed guide covers how.
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 whose content changes less often than it’s read
The trade-off: Content updates require a rebuild and deploy. Can’t show personalized or real-time content without server-side or client-side code.
Popular SSGs:
- Astro — Zero JS default, islands architecture
- Hugo — Go-based, known for fast builds
- 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 too often to rebuild for every change
- Sites needing authentication on every page
The trade-off: Requires server infrastructure, which usually costs more to run, and each request does work a prebuilt page wouldn’t.
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; Create React App is deprecated, see the React team’s announcement)
- Vue (with Vite)
- Angular
- Svelte
Hybrid Approaches (The Modern Reality)
Modern frameworks blur these lines:
Next.js supports all three. A route can be prerendered at build time or rendered per request, depending on the data it uses and its route configuration; client components add SPA-style interactivity. The older Pages Router did the same with getStaticProps and getServerSideProps (Next.js: caching and revalidating, accessed 2026-10-18).
Astro is primarily SSG but supports:
- Server endpoints for API routes
- SSR mode for dynamic pages
- Client-side islands for interactivity
Decision Framework
| Question | If Yes → | If No → |
|---|---|---|
| Does content change per user? | SSR | SSG |
| Does content change > daily? | SSR | SSG |
| Is SEO critical? | SSG or SSR | SPA acceptable |
| Is it an internal tool? | SPA | SSG or SSR |
| Do you need real-time data? | SSR or SPA | SSG |
| Is budget constrained? | SSG | SSR |
Practical Recommendations
For marketing sites and blogs: Astro (SSG). It renders to HTML with no client JavaScript unless you add an island (Astro: islands), and static files can be hosted cheaply.
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. Markdown-based content and prebuilt HTML that crawlers can read without running JavaScript.
The best architecture depends on your requirements. Start with SSG, the simplest to run, and add SSR or client-side interactivity only where you need it.
On this page