Skip to main content
Understanding the difference between Server-Side Rendering (SSR) and Single-Page Applications (SPA) helps you choose the right approach.

Server-Side Rendering (SSR)

The server generates HTML for each request.

How It Works

  1. User requests /users
  2. Server fetches data from database
  3. Server renders HTML template
  4. Server sends complete HTML
  5. Browser displays page immediately

Example with HTMX

Pros

  • SEO-friendly: Search engines see full HTML
  • Fast initial load: No JavaScript needed
  • Works without JS: Functional even if JS disabled
  • Simpler: No client-side routing or state management

Cons

  • Server load: Server renders every page
  • Full page reloads: Less smooth than SPA
  • Network dependency: Requires server for every action
  • Less interactive: Limited client-side interactivity

Single-Page Application (SPA)

The browser loads once, then JavaScript handles all interactions.

How It Works

  1. User visits site
  2. Server sends minimal HTML + JavaScript bundle
  3. JavaScript loads and runs
  4. JavaScript fetches data via API
  5. JavaScript updates DOM

Example with React

Pros

  • Smooth UX: No page reloads
  • Rich interactions: Complex UI possible
  • Offline capable: Can work offline with service workers
  • Reduced server load: Server only handles API requests

Cons

  • SEO challenges: Requires extra work for search engines
  • Slower initial load: Must download JavaScript first
  • Complexity: Client-side routing, state management
  • JavaScript required: Doesn’t work without JS

Hybrid Approaches

HTMX with Alpine.js

Server renders HTML, Alpine adds interactivity:
Benefits:
  • SEO-friendly
  • Progressive enhancement
  • Minimal JavaScript

SPA with SSR (Next.js, Nuxt)

Generate static HTML at build time:
Benefits:
  • SEO-friendly
  • SPA-like interactions
  • Fast initial load

Decision Matrix

When to Use SSR

Choose SSR (HTMX) when:
  • SEO is critical
  • Simple CRUD operations
  • Content-heavy sites
  • Team prefers server-side
  • Progressive enhancement needed
Examples:
  • Blogs
  • Marketing sites
  • Admin dashboards
  • Documentation sites

When to Use SPA

Choose SPA (React/Vue/Svelte) when:
  • Rich interactivity needed
  • Desktop-like experience
  • Complex client-side state
  • Offline support needed
Examples:
  • Email clients
  • Project management tools
  • Design tools
  • Real-time dashboards

When to Use Hybrid

Choose Hybrid when:
  • Need both SEO and interactivity
  • Want best of both worlds
  • Content + interactive features
Examples:
  • E-commerce (product pages + cart)
  • Social media (feeds + messaging)
  • SaaS apps (marketing site + app)

Performance Comparison

First Contentful Paint (FCP)

SSR: ~500ms (server renders immediately) SPA: ~2000ms (download + parse + render JavaScript)

Time to Interactive (TTI)

SSR: ~1000ms (minimal JavaScript) SPA: ~3000ms (JavaScript must load)

Subsequent Navigation

SSR: ~300ms (server renders + network) SPA: ~50ms (client-side only)

Mizu’s Approach

Mizu supports both equally: SSR:
SPA:
Both:

Next Steps

HTMX Guide

Server-side approach

React Guide

SPA approach

View Engine

Server-side templates