All posts
architecturessrwasm

Why We Shipped Four Rendering Modes in One Config Line

SSR + WASM, Zero-JS SSR, SSR + HTMX, and Full WASM SPA. Pick the right architecture per project or per route without rewriting components.

Alex Chen··7 min read

Most React frameworks force every route through a single hydration model, shipping 90KB+ of client runtime even for pages that only toggle a menu or submit a form. We designed Swift Rust around four explicit, composable rendering modes that you can set globally in swift-rust.config.ts or override per route via export const mode:

- ssr-wasm (Default): Server-rendered HTML streamed from Rust, paired with a sub-3KB WebAssembly navigator and selective hydration for interactive "use client" islands. - ssr (Zero-JS): Pure server-rendered HTML with 0 KB of client JavaScript. Ideal for documentation, marketing pages, and content-heavy routes. - ssr-htmx: Server-rendered HTML enhanced with declarative partial swaps and progressive form mutations (~14 KB runtime). - wasm (Full SPA): Complete client-side application mode with instant sub-millisecond transitions for dense interactive dashboards and canvas tools.

Because all four modes share the same App Router conventions, layouts, and TypeScript types, switching modes takes a single line of configuration—never a rewrite.