Rendering modes

Swift Rust supports four rendering modes. You pick one when you scaffold your project, and you can change it later in swift-rust.config.json.

ssr — Pure server-rendered HTML

The default for content sites. Every request is rendered on the server and sent as plain HTML. No client-side JavaScript is shipped to the browser. This is the fastest first paint and the lowest memory footprint.

swift-rust.config.json
{
  "rendering": "ssr"
}

Best for: blogs, marketing pages, documentation, e-commerce product pages.

ssr-wasm — SSR with WASM hydration

The default for app-style sites. Server renders the initial HTML, then a WebAssembly bundle hydrates the page in the browser. React components run in both the Rust runtime (for SSR) and the browser (after hydration), with the same code.

swift-rust.config.json
{
  "rendering": "ssr-wasm"
}

Best for: dashboards, interactive apps, anything that needs client-side state.

ssr-htmx — SSR with HTMX

Server renders the HTML, and HTMX handles progressive enhancement. Forms, links, and partial updates work without writing client-side JavaScript. The whole UI is interactive via HTML attributes like hx-get, hx-post, hx-target.

swift-rust.config.json
{
  "rendering": "ssr-htmx"
}

Best for: CRUD apps, admin panels, anything where you want to keep client JS minimal.

wasm — Full WASM SPA

The whole app is compiled to WebAssembly and runs in the browser. The server only ships a shell HTML and the WASM bundle. After the initial load, navigation is client-side.

swift-rust.config.json
{
  "rendering": "wasm"
}

Best for: highly interactive apps, when you want a single binary that can serve multiple SPAs.

Choosing a mode

If you're not sure, start with ssr-wasm. It's the most flexible and matches the behavior of most modern Next.js apps.

Next steps

Continue to Data fetching.