ArchitectureIntermediate

Frontend Architecture: SSR vs SSG vs Islands vs SPA

DeveloperHat Team
19 min read

TL;DR

SSR, SSG, islands, and SPA solve the same problem four ways. Compare them on first paint, SEO, and freshness — and pick by page type, not fashion.

Every frontend eventually faces the same question: where does the HTML come from? SSG renders it at build time, SSR renders it per request, islands render most of it at build time and hydrate only the interactive widgets, and SPA ships a shell and renders everything in the browser. They are not four versions of the same idea. They are four different answers to one trade-off — how fresh the page must be, against how much JavaScript the browser must run before the page works — and the right one depends on the page, not the project.

The versions in this article are current as of November 2026. Next.js 16 shipped on October 21, 2025, with Cache Components completing the Partial Prerendering story, Turbopack stable and default, and stable React Compiler support; the 16.x line's current minor is 16.4 (October 6, 2026), which adds React 19.3 features. React itself is at 19.3.1 (October 14, 2026), with Server Components stable since 19.0. Angular is at 22.3.0 (November 18, 2026), with incremental hydration now the default. The islands idea is older than all of them: the term "component island" was coined by Etsy's Katie Sylor-Miller in 2019, and Astro popularised it as a framework default. The short version up front: public pages that rarely change want SSG, pages that change per visitor want SSR, mostly-static pages with a few widgets want islands, and apps behind a login want SPA. Everything below is the reasoning that makes those four sentences true.

Four models, one question: where is the HTML produced? SSG HTML at build time Islands static + widgets SSR HTML per request SPA HTML shell + JS same HTML for all hydrate what is interactive fresh HTML every request render in the browser JAVASCRIPT THE BROWSER MUST RUN SSG: none  ·  Islands: only the widgets  ·  SSR: the hydration bundle SPA: the whole application, before anything is usable Left to right is more dynamic, not more modern — each step trades speed for freshness.

SSG: HTML at build time

Static Site Generation renders every page once, at build time, and serves the resulting HTML files from a CDN. A visitor's request never touches application code — the CDN answers with a file that already exists. That is why SSG is the fastest model on first paint and the cheapest to host: there is no server in the request path at all, and the HTML is cacheable everywhere by default.

The model has one obvious limit, and it is the one every SSG pitch glosses over: the HTML is only as fresh as the last build. A docs site, a marketing page, or a blog post changes when somebody edits it, so rebuilding is fine. A product page whose price changes ten times a day is not a build-time artifact, and pretending it is means either rebuilding constantly or serving stale prices. Next.js answers this with incremental regeneration — rebuild one page on demand when its data changes, or revalidate it on a timer — and with Cache Components in Next.js 16 the same idea is explicit: mark what may be cached, and everything else renders dynamically.

// next.config.ts — Cache Components are opt-in in Next.js 16
const nextConfig = {
  cacheComponents: true,
}
export default nextConfig

// The product shell is cached; a Suspense boundary keeps the
// personalized part (price, stock) rendering per request
async function ProductDetail({ id }: { id: string }) {
  'use cache'
  const res = await fetch(`https://api.example.com/products/${id}`)
  const product = await res.json()
  return <h2>{product.name}</h2>
}

The honest cost of SSG is build time. A site with fifty pages builds in seconds; a site with fifty thousand pages builds in minutes or hours, and every content edit pays that cost again unless regeneration is incremental and on demand. SSG also moves work into the build: data fetching that used to happen at request time now happens at build time, so a slow CMS or a flaky API breaks the deploy instead of one request. That is usually a good trade — a broken build is visible, a slow request is silent — but it is a trade, and teams that adopt SSG for a catalogue with millions of pages discover it the first time a full rebuild takes longer than the content stays fresh.

SSG is for: marketing pages, documentation, blogs, and any page whose content is the same for every visitor and changes on a human schedule rather than a data schedule.

SSR: HTML per request

Server-Side Rendering renders the page on the server for every request, so the HTML the browser receives is fresh and complete — including content that depends on who is asking, like a logged-in user's name or a price in their currency. The browser paints real content immediately instead of a loading shell, and search engines see the same page a user sees, which is the original reason SSR exists.

React's version of this is Server Components: components that run on the server, read the database directly, and never ship their code to the browser. The Server Components reference states the boundary plainly — server for data and rendering, client for interaction — and our React patterns that scale guide covers where to draw that line in a real codebase. Next.js 16 makes the boundary cheaper to operate: Cache Components let the static shell of a page be cached while the dynamic parts stream in behind Suspense, so a page can be mostly static and partly fresh at the same time. Angular's version is the same idea in a different framework: SSR with incremental hydration now the default in Angular 22, so the server streams HTML and the client hydrates only the parts the user can see, deferring the rest with @defer blocks. Our Angular 22 what's new guide has the details, including the Resource API's SSR caching so data fetched on the server is not fetched twice.

<!-- The chart renders on the server; its JavaScript hydrates only when visible -->
@defer (on viewport) {
  <app-sales-chart [data]="sales" />
} @placeholder {
  <p>Chart loading…</p>
}

SSR's costs are the mirror image of SSG's strengths. Every request now costs server compute, so traffic spikes cost money instead of being absorbed by a CDN, and the server is in the critical path for time-to-first-byte — a slow database query is a slow page, not a slow widget. Hydration is the second cost: the browser receives HTML and then must download and run JavaScript to make it interactive, and if the server-rendered HTML and the client's first render disagree, the result is flicker or console errors. Frameworks have spent years shrinking this cost — streaming, partial hydration, resumability — but none of them removes it. SSR is a deployment decision, not a flag: it needs a server or an edge runtime, and an internal dashboard behind a login gains nothing from it while paying the hydration cost for nothing.

SSR is for: pages that are different per visitor or per request — product listings with live prices, feeds, search results, anything behind authentication where the content cannot be cached across users.

Islands: a static sea with interactive widgets

Islands architecture starts from SSG and asks a sharper question: if most of a page is static text, why hydrate all of it? An island is one interactive component on an otherwise static page — a search box, a carousel, a cart widget — rendered to HTML on the server and hydrated on its own, in isolation, while the rest of the page ships no JavaScript at all. The technique is called partial or selective hydration, and Astro's islands documentation is the clearest statement of it: by default Astro renders every component to HTML and CSS and strips out all client-side JavaScript automatically.

---
// .astro files render on the server; only the island hydrates
import SearchBox from '../components/SearchBox.jsx';
---
<SearchBox client:visible />

The client:* directive is the whole API, and it is also a performance contract. client:load hydrates immediately, client:idle waits for the browser to be idle, client:visible waits until the component scrolls into view, client:media waits for a media query, and client:only skips server rendering entirely. Each island ships its own bundle, so a slow island does not block the others and none of them blocks the text on the page. The same idea now appears inside the bigger frameworks — Astro also has server islands, which render dynamic content on the server separately from the rest of a cacheable page — but Astro is where the model is the default rather than an optimisation you bolt on.

The honest limit is that islands are a content-site architecture, not an app architecture. Islands communicate awkwardly: two islands on one page share state through the DOM or a tiny store, not through the component tree, so a page that is really an application with shared state across twenty widgets will fight the model. Each island also still ships its framework runtime — ten React islands ship ten copies of the same idea unless the framework deduplicates them — so the "zero JavaScript" claim is true of the page and approximate of the islands. And the model assumes the team is comfortable with a server-first framework: islands are a different mental model from the SPA most frontend developers learned first, and the learning curve is real even though the payoff is large.

Islands are for: content-heavy sites with pockets of interactivity — documentation with a live playground, a blog with a comments widget, a marketing site with a configurator, a storefront where the product copy is static and only the cart and search are alive.

SPA: the browser owns the app

A Single-Page Application ships a near-empty HTML shell and a JavaScript bundle, and the browser renders everything. The first load is a blank page plus a download; after that, navigation is instant because the app never leaves the page. This is the model most frontend developers learned first, and for the thing it is actually for — an application — it is still the right one.

The SPA's strengths are all about state. A dashboard with filters, tables, and live updates; a drawing tool; an admin panel where every screen shares the same session, the same store, and the same WebSocket connection — these are applications, and an application wants one runtime, one router, and one state tree in the browser. The tooling matches: Vite starts instantly, the router is client-side, and the whole ecosystem of state libraries assumes the app lives in the browser.

The costs are the ones the other three models exist to avoid. The first paint is a shell until the bundle downloads, parses, and runs, which on a slow phone is the difference between a page and a spinner. SEO is a project, not a property: search engines can execute JavaScript, but the safe path is prerendering or server rendering the pages that need to rank, which is SSR by another name. And the bundle is the budget: every feature adds JavaScript that every visitor downloads whether they use the feature or not, so an SPA's performance story is a discipline story — code splitting, lazy routes, and constant vigilance — where the other models get most of it by default.

SPA is for: authenticated applications where the user is known, the state is shared across screens, and nobody needs to find the page in a search engine — dashboards, admin tools, editors, and internal tools.

Where the HTML is produced — the layer you pay for decides the model Browser — paints HTML, runs islands and hydration CDN / edge — serves cached HTML in milliseconds Server render — SSR / React Server Components per request Build-time render — SSG and islands HTML, made before deploy Data — database + APIs, read at build time or per request SSG pays at build time. SSR pays per request. SPA skips the middle and pays in the browser.

Head-to-head: SSR vs SSG vs islands vs SPA

SSGIslandsSSRSPA
HTML producedAt build timeAt build time + islandsPer requestIn the browser
First paintFastest — a file from a CDNFast — static HTML firstFast content, server in the pathSlowest — shell, then bundle
SEOExcellent — full HTMLExcellent — full HTMLExcellent — full HTMLNeeds prerendering
FreshnessStale until rebuild / revalidateStatic parts stale, islands liveFresh every requestFresh — data fetched client-side
JavaScript shippedNone (or near none)Only the islandsHydration bundleThe whole app
Server costNone at request timeNone at request timePer requestAPI only
HostingAny static host / CDNStatic host + edge for server islandsServer or edge runtimeStatic host + API
InvalidationRebuild or on-demand revalidateRevalidate the static partsNone — always freshNone — client fetches
Shared stateNoneVia DOM / small storeServer sessionFull client store
Best forDocs, marketing, blogsContent sites with widgetsPersonalized pages, feedsDashboards, apps

The table hides the decision that matters most, which is not in any row: who the page is for. A page whose audience is everyone and whose content is the same for all of them should be built once and served as a file. A page whose content depends on the visitor should be rendered when the visitor arrives. A page that is mostly the former with a little of the latter should be built once and hydrated in pieces. And a page that is really an application should stop pretending to be a document and ship as an app. Pick the audience first, and the model picks itself.

Two other factors decide more real-world choices than any row of the table. The first is how often the content changes relative to how often it is read: a page read ten thousand times and changed once a week is an SSG page, and rendering it per request is paying ten thousand times for one change. The second is how much of the page is interactive: if the answer is "one search box", islands win by an order of magnitude over shipping a framework for the whole page; if the answer is "all of it, and the widgets share state", the islands model is fighting the application and the SPA is honest about what the page is.

Pick by page type, not by framework fashion What does the page need? start from the page Public + static same for everyone Mostly static a few widgets Personalized per visitor App-like behind a login SSG pre-render at build Islands hydrate only widgets SSR render per request SPA client-rendered shell One site can use all four — pick per page, not per project.

Architecture decision: frontend rendering for a new product

  • Decision: Default to SSG for public pages and SPA for authenticated apps, and add SSR or islands per page where the page's needs demand it. Never pick one model for the whole product — pick per page, and let the framework mix them.
  • Context: A product with a marketing site, documentation, a storefront with live prices, and an authenticated dashboard. One team, one repository, and a framework that supports all four models — Next.js 16, Angular 22, or Astro — so the decision is about which model each page uses, not which framework the company bets on.
  • Options considered: (a) SPA everywhere — one model, one skill set, client routing throughout. (b) SSR everywhere — every page rendered per request, one mental model. (c) SSG everywhere — every page a file, rebuild on change. (d) The mixed default above: SSG public, islands for widgets, SSR for personalized pages, SPA behind the login.
  • Why this one: Option (a) makes the marketing site and docs pay the SPA's first-paint and SEO costs for no benefit — nobody needs client-side state on a pricing page. Option (b) pays server compute on every request for pages that never change, and gives up the CDN's near-zero cost for the pages that are read most. Option (c) cannot serve a live price or a logged-in user's feed without rebuilding, so the storefront would be stale or the build would never stop. Option (d) pays the cost of knowing four models, but each page uses the model whose strengths are real and whose costs are irrelevant: SSG's staleness does not matter to a blog post, SSR's server cost does not matter to a page that must be fresh, and the SPA's bundle does not matter to a dashboard that is used for hours.
  • What it costs you: The team has to know when a page changes models, and the boundary has to be visible — a page-type table in the repo, reviewed when a new page is added, so nobody "just makes it an SPA" because that is the familiar default. Shared components have to work in both worlds: a component that reads window on render breaks SSG and SSR alike, and the team needs the discipline to keep browser-only code behind a client boundary. Observability has to span models: a slow page could be a slow build, a slow server render, or a heavy island, and the team needs to know which one it is looking at.
  • When to reverse it: If the product turns out to be one audience and one kind of page — a pure content site, or a pure dashboard — collapse to that model and delete the others; the mixed default was overhead. If the framework's mixed support proves painful (for example, islands that keep needing shared state), move the app-like pages to a separate SPA and keep the content site static — the split is a deployment boundary, not a rewrite. Revisit whenever a new page type appears: the second page type is the signal that the model decision needs re-checking, not the twentieth.
  • Recommendation

    For a new product, apply the decision in this order. First, list the page types, not the pages: marketing, docs, storefront, feed, dashboard. Assign each type a model from the decision flowchart above, and write the assignment down where a new hire will find it — a table in the README beats a convention nobody wrote down. Second, pick the framework that supports the models you assigned: Next.js 16 if the mix is SSG plus SSR with React Server Components, Angular 22 if the team is Angular and the mix is SSR plus SPA, Astro if the product is content-first with islands. The framework decision follows the page-type decision, not the other way around. Third, set the budgets that make the models honest: a JavaScript budget per page (islands make this easy, since each island is a line item), a build-time budget for SSG, and a server-cost budget for SSR — because a model without a budget drifts into the model it was supposed to replace.

    For an existing product, the migration is incremental and safe. A SPA can grow static pages around it: put the marketing site on SSG in the same repository and let the app live at /app. An SSR site can shed its static pages to SSG one route at a time, and each page that moves stops costing server compute on every request. An SSG site can add one island without touching the rest of the page, and one SSR route without rebuilding the site. What you should not do is a big-bang rewrite of the rendering model, because the model is the URL structure, and every link, bookmark, and search ranking moves on the same day. Migrate the page types, not the product, and retire the old model only when its last page is gone.

    When NOT to use each

  • Don't use SSG for content that changes per visitor. A price, a feed, or a logged-in state is not a build-time artifact. If the rebuild runs more often than the content is read, the model has inverted — use SSR, or cache the static shell and stream the dynamic part.
  • Don't use SSG for a catalogue with millions of pages. The build is the bottleneck, and a full rebuild that takes longer than the content stays fresh means the site is always stale. Use on-demand revalidation, or SSR with caching, instead.
  • Don't use SSR for pages that never change. A blog post rendered per request is server compute spent on a file. The CDN would have served it for free, and the only thing SSR bought was a slower first byte.
  • Don't use SSR for an internal dashboard. Nobody searches for it, nobody shares it, and the hydration work is pure overhead on a page whose users would have been happy with a client-rendered shell.
  • Don't use islands for an application. If the widgets share state, talk to each other, and cover most of the page, the islands are not islands — they are a fragmented SPA with worse state management. Ship the SPA and be honest about it.
  • Don't use SPA for a page that needs to rank. Search engines can run JavaScript, but "can" is not "will, quickly, and with your content intact". A page whose traffic comes from search should be a document first — SSG, islands, or SSR — and the app can live one click away.
  • Don't mix all four in one page. One page, one model, with translation at the boundary — a static page can link to an app, and an app can embed a static page, but a page that is half SPA and half islands has two hydration stories and two sets of bugs. The mixed default above is a product-level decision, not a per-page one.
  • SSR, SSG, islands, and SPA are not rungs on a ladder — nothing is "more modern" about any of them, and the team that picks SPA for a blog or SSR for a dashboard has mistaken novelty for fit. The durable skill is reading the page: who it is for, how often it changes, and how much of it is interactive. Name the page type first, and the rendering model picks itself. For the decision that comes before this one — how the services behind the pages are organised — our modular monolith vs microservices guide is the place to start; and when the answer to "which rendering model" is "none of them, this should be asynchronous", the API decision matters more than the page decision, and our REST vs GraphQL vs gRPC guide covers that choice.

    Why This Matters

    Understanding the business and technical context helps you make informed decisions rather than blindly following patterns.

    Trade-offs to Consider

    Every architectural decision involves trade-offs. Consider your specific requirements, team expertise, and scale when evaluating options.

    When NOT to Use This

    Knowing when a solution doesn't apply is as valuable as knowing when it does. Consider alternatives for your specific situation.

    Decision Framework

    Use this framework to evaluate whether this approach is right for your use case based on your specific constraints and requirements.

    Share this articleShare on XShare on LinkedIn

    Keep the decision frameworks coming

    One practical architecture guide a week — patterns, trade-offs, and when not to use them. No spam, unsubscribe anytime.