SSR vs SSG vs SPA β Which Rendering Strategy for Your Project?
Three rendering strategies, each with trade-offs. Hereβs how to pick the right one.
Quick definitions
SSG (Static Site Generation): Pages built at build time. Served as static HTML files. Fastest possible load times.
SSR (Server-Side Rendering): Pages built on each request. Server generates HTML, sends it to the browser. Fresh data on every load.
SPA (Single-Page Application): Browser downloads a JavaScript bundle, renders everything client-side. No page reloads after initial load.
The decision framework
Use SSG when:
- Content doesnβt change often (blog, docs, marketing site)
- SEO matters
- You want the fastest possible page loads
- You can rebuild when content changes
Examples: Blog, documentation, landing pages, portfolio, changelog
Tools: Astro, Next.js (static export), Hugo, Eleventy
Use SSR when:
- Content is personalized or changes frequently
- SEO matters AND data is dynamic
- You need fresh data on every page load
- You have user-specific content (dashboards, feeds)
Examples: E-commerce product pages, social media feeds, news sites, search results
Tools: Next.js, Nuxt, Remix, SvelteKit
Use SPA when:
- SEO doesnβt matter (internal tools, dashboards)
- The app feels like a desktop application
- Real-time updates are important
- Users stay on the page for long sessions
Examples: Admin dashboards, chat apps, design tools, email clients
Tools: React (Vite), Vue, Svelte, Angular
The hybrid approach (what most apps actually need)
Modern frameworks let you mix strategies per page:
/ β SSG (marketing page, rarely changes)
/blog β SSG (rebuild on new post)
/blog/:slug β SSG (each post is static)
/dashboard β SSR (personalized, needs auth)
/app β SPA (interactive, real-time)
/products/:id β SSR (inventory changes, SEO needed)
Next.js, Nuxt, and SvelteKit all support this. You donβt have to pick one strategy for your entire app.
Performance comparison
| Metric | SSG | SSR | SPA |
|---|---|---|---|
| First load | β‘ Fastest | π‘ Medium | π΄ Slowest |
| Navigation | π‘ Full reload | π‘ Full reload | β‘ Instant |
| SEO | β‘ Excellent | β‘ Excellent | π΄ Poor |
| Server cost | β‘ Cheapest (CDN) | π΄ Highest (compute) | β‘ Cheap (CDN) |
| Data freshness | π΄ Build time | β‘ Real-time | β‘ Real-time |
Common mistakes
Using SSR for a blog. Your blog posts donβt change between requests. SSG gives you faster loads and zero server costs.
Using SPA for a marketing site. Google can index SPAs, but itβs slower and less reliable. SSG or SSR is better for SEO.
Using SSG for a dashboard. Dashboards show personalized, real-time data. You canβt pre-build that at build time.
Over-using SSR. SSR means your server renders every page on every request. At scale, thatβs expensive. Use SSR only for pages that genuinely need fresh data AND SEO.
The simple rule
- Can you build it at deploy time? β SSG
- Does it need fresh data AND SEO? β SSR
- Is it an interactive app behind a login? β SPA
When in doubt, start with SSG. Itβs the simplest, fastest, and cheapest. Add SSR or client-side rendering for the pages that need it.
Related resources
Related: What is Next.js Β· React Interview Questions