vs SPA + API / Rust front-end frameworks
These render in a completely different place: an SPA hands the UI to a client framework (React / Vue / Svelte), and Leptos, Dioxus and Yew write the UI in Rust and compile it to WASM; this runtime keeps the UI in server templates.
What a traditional SPA + API needs
A "save customer" button:
Back end: route → handler → validation → JSON serialization
Front end: API client → call → check the status → draw field errors on 422 → notice on 403 →
ask to reload on 409 → error card on 500 → refetch the list on success → loading stateThe second half is rewritten for every module. With this runtime:
rust
"create" => {
let user = User::find_or_fail(context.user.parse::<i64>()?).await?;
if !may_create_customer(&user) {
return Ok(LinkerResponse::policy(messages::POLICY));
}
let name = text(&args, "name");
if name.is_empty() || name.chars().count() > 80 {
return Ok(LinkerResponse::validation([("name", "A name is required, at most 80 characters.")]));
}
create!(Customer { name: &name }).await?;
Ok(LinkerResponse::ok()
.then(Action::toast("success", "Created"))
.then(Action::render_fragment("#list", "customers", json!({}))))
}html
{{ cg_button("Create", attrs={"data-linker-call": "create", "data-linker-args": "form"}) }}The runtime does that whole front-end list in one place: field errors, permission notices, expiry notices, redrawing the list.
(may_create_customer and text() are illustrative; how to write authorization and validation is in Access control.)
Compared
| SPA + API | Leptos / Dioxus | This runtime | |
|---|---|---|---|
| Routing | Client + API routes | Shared Rust routes | Server; interaction needs no new routes |
| UI language | TS / JS | Rust (compiled to WASM) | MiniJinja templates + Rust builders |
| Data contract | API schema (JSON) | Server function types | Validation in call + data |
| Error handling | DIY | DIY | Fixed kinds, one handler in the browser |
| Bundle size | Framework + every page component | A WASM file (commonly hundreds of KB) | Core modules + the components used, loaded on demand |
| First load | Waits for JS | SSR, then hydration | Server HTML, usable immediately |
| Highly interactive UI (drag and drop, canvas, live editing) | Good at it | Good at it | Not good at it |
| Offline / PWA | Good at it | Possible | Not supported |
Mixing
You don't have to pick one. Highly interactive regions (a canvas, drag-and-drop sorting) can be standalone front-end components or WASM islands, while the rest of the page uses Linker:
- When a front-end component needs to call the server, it can still use the Linker endpoint and get the same error shapes.
- The PHP version's charts work this way: the browser draws, the data comes through Linker. The Rust version hasn't ported the chart component yet, but the runtime's JS is already here (see Sync).
When to choose an SPA or a Rust front-end framework
- The product itself is a highly interactive application.
- You need offline support, push, local data.
- Front-end and back-end teams are separate, and the API serves several clients (mobile apps) anyway.
- You want to share Rust types between front end and back end, and accept WASM's build and size costs → Leptos / Dioxus.