Swap.Htmx vs Blazor

Two .NET approaches to building interactive web applications.

Blazor is Microsoft's framework for building interactive web UIs with C#. It comes in two flavors: Server (runs on server, uses SignalR) and WebAssembly (runs in browser).

Swap.Htmx uses traditional server rendering with HTMX for partial page updates over HTTP.

The Three Options

🔵 Blazor Server

C# runs on server. UI updates via SignalR.

  • ✓ Full .NET on server
  • ✓ Fast initial load
  • ✕ Requires constant connection
  • ✕ Server memory per user

🟣 Blazor WASM

.NET runtime runs in browser via WebAssembly.

  • ✓ Works offline
  • ✓ No server round-trips
  • ✕ Large download (2MB+)
  • ✕ Slow startup

🔄 Swap.Htmx

Server renders HTML. HTMX handles partials.

  • ✓ Tiny JS (~14kb)
  • ✓ Standard HTTP
  • ✓ Excellent SEO
  • ✓ Simple mental model

Detailed Comparison

Swap.HtmxBlazor ServerBlazor WASM
Initial LoadFastFastSlow (2MB+)
ConnectionPer requestAlways (WebSocket)Per request
SEOExcellentGoodPoor
OfflineNoNoYes
Server MemoryLowHigh (per user)Low
ScalabilityExcellentChallengingGood

When to Choose Blazor

  • WASM: Offline-capable apps, PWAs
  • Server: Internal tools, low latency OK
  • ✓ Team wants to avoid HTMX concepts
  • ✓ Heavy component-based patterns

When to Choose Swap.Htmx

  • ✓ Public-facing sites (SEO matters)
  • ✓ Simple deployment (no SignalR)
  • ✓ Lower server resources
  • ✓ Progressive enhancement
  • ✓ Traditional MVC patterns