vs htmx / Hotwire
htmx and Hotwire (Turbo + Stimulus) are both "HTML over the wire": the server returns HTML and the browser swaps it in. Render fragments belong to the same family, and like htmx they don't care about the back-end language, which is exactly why the same JS could move from PHP to Rust. The differences are in three places.
1. Where in-progress state lives
| htmx / Turbo | This runtime | |
|---|---|---|
| Expanded sections, tabs, unsaved input | Usually in the DOM (classes, hidden, field values) | Client state (data-state-*) |
| After the HTML is replaced | Kept by morphing or preserved regions, otherwise lost | The new nodes read the old values back when they're bound |
That's why render fragments dare to "replace the whole thing without diffing": what needs to be kept was never in the DOM being replaced.
2. How the server directs the browser
| htmx | Turbo Streams | Linker | |
|---|---|---|---|
| Form | Events triggered by response headers, hx-swap-oob | <turbo-stream action="…"> | Named actions in a pipeline |
| Scope of actions | Swapping sections + custom events | append / replace / remove… + custom actions | The few registered in the action table |
| Business data | Wrapped in HTML | Wrapped in HTML | data written to state; data-state-* display themselves |
Linker separates "data" from "HTML": updating a single number doesn't need a block of HTML.
3. Who can be called
| htmx / Turbo | This runtime | |
|---|---|---|
| Endpoints | Any URL; whatever the attribute says gets requested | Fragments: only names registered with render::register; Linker: only registered aliases + METHODS |
| Endpoint location | Up to you | Under one prefix derived from APP_KEY; four fixed routes |
| Permissions on front-end attributes | None | The render object's allow list (a development-time boundary) |
Compared: a search box
htmx style (the Rust back end writes a route that returns HTML):
<input name="q" hx-get="/customers/search" hx-trigger="input changed delay:400ms" hx-target="#results">
<div id="results">…</div>This runtime:
<main{{ panel_attrs }} data-state-init="keyword=">
<input name="keyword"
data-state-bind="keyword"
data-linker-call="search"
data-linker-on="input"
data-linker-debounce="400"
data-linker-args="keyword">
<p><span data-state-text="matchCount">{{ total }}</span> matches</p>
<table>…<tr class="hidden" data-linker-ref-dom="customers">…</tr>…</table>
</main>What you gain: only listed methods can be called, the server validates arguments and authorization (user.authorize), error handling is fixed, the count doesn't have to be HTML, the list uses dom.repeat without going through the HTML parser, and the search box keeps its text after a redraw. The full version is in the searchable list tutorial.
The cost: more concepts (render objects, state, Linker), whereas htmx gets you started with one attribute.
When to choose htmx / Hotwire
- You want the fewest concepts and the largest ecosystem.
- Page interaction is simple, and state in the DOM can safely be replaced.
- You don't need to share screens with the PHP CGWebFramework.
In the Rust ecosystem, htmx with axum / Askama is a very mature combination; if you don't need Linker's state model and action table, that path is simpler.