HTMX: Interactivity Without SPA Framework
Actualizado: 2026-05-03
HTMX 2.0, released in June 2024, arrived with a sober message: the library is considered finished. There is no frenetic roadmap, no forced integration with this month’s framework, no runtime rewriting the DOM behind your back. That quietness is precisely the selling point. While React, Vue and Angular iterate at the pace of modern frontend, HTMX argues the web never needed to leave the model that already worked: a browser asking for documents and a server returning them.
Key takeaways
- HTMX ships no JavaScript by default: interactivity is declared with HTML attributes over server-rendered HTML.
- The hypermedia model (HATEOAS) eliminates the duplicated state between client and server that generates bugs in SPAs.
- For small teams with Django, Rails, FastAPI or Spring backends, HTMX removes the stack bifurcation and API/client version synchronisation.
- Not the right tool for real-time collaboration, canvas editors, offline apps or any case where instant response is the product.
- Version 2.0 signals maturity: the pace of change is measured in years, not weeks.
Hypermedia philosophy versus SPA
To understand HTMX you have to recover a word most web developers learned in the abstract and then forgot: HATEOAS. The server does not only return data, it also returns the possible next transitions encoded as links and forms. That is the web Roy Fielding described, and it is the engine of original REST. SPAs broke that model when they decided the client would hold its own state, fetch JSON and build the interface from raw data. They gained perceived fluidity and lost something less visible: the coherence between the real state of the system and what the user sees.
HTMX recovers the hypermedia model without asking for nostalgia. A button with hx-get fires a request to a URL, the server replies with HTML, and hx-target specifies which part of the page gets replaced. The hx-swap attribute controls the semantics: replace the whole element, inject inside, prepend, append. With hx-trigger you fine-tune when the request fires: a click, a debounced keystroke, an interval, even when the element enters the viewport. With hx-push-url the browser URL updates and the back button works like on any site.
<input name="q"
hx-get="/search"
hx-trigger="keyup changed delay:300ms"
hx-target="#results"
hx-push-url="true">
<div id="results"></div>A single example is enough because the rest of the vocabulary follows: if you know where to inject, when to trigger and which HTTP verb to use, you already know eighty per cent of the API.
When server rendering pays off
The honest question is not whether HTMX is better than React, but in which kind of product the advantages of a SPA disappear.
An internal admin panel with a hundred CRUD screens gains nothing from client-side state. An e-commerce checkout does not either: the server has to validate each step, compute taxes, check stock, and the interface follows the result of that logic. An intranet, a news portal, a metrics dashboard refreshing every thirty seconds, a support backoffice: all of those fit the hypermedia model without effort.
There is a second criterion, less technical and more honest: team size. Setting up a serious SPA means deciding framework, state store, routing, forms library, build tooling, component testing, a deployment pipeline separate from the backend, and a dependency stack ageing at different rates. A team of two working on Django or Rails cannot sustain that complexity without sacrificing the product. HTMX removes that fork in the road: the same developer writing the backend view adds the attributes and gets interactivity.
The third criterion is operational: a single deployment, one domain, one process, one log. No separate asset CDN, no CORS, no version sync between API and client.
The real limits
HTMX does not replace everything. Applications with real-time collaboration with multiple cursors, canvas editors, vector drawing tools, and anything that must work offline fall outside the hypermedia model. Every HTMX interaction implies a server round trip, and while the payload is small and latency acceptable, it does not compete with the instant response of a SPA that already has all the state in memory.
It is also unwise to force it when the interface logic is genuinely complex on the client. A wizard with cross-validations between steps, a table with combinable filters and multi-column sorting, or a calculator with live preview are cases where Alpine.js complements HTMX well for local interactivity while HTMX handles what belongs to the server. That pairing covers most of the middle ground without introducing a full framework.
For sites with heavy static content where interactivity is secondary, Astro can be an even more radical alternative: HTML-first with React or Svelte islands where needed.
There is also an ecosystem caveat worth stating: PaaS platforms oriented to modern frontend are optimised for the SPA model. Deploying HTMX on Vercel or Netlify is possible but wastes their architecture. HTMX’s natural terrain is traditional hosts, containers and Kubernetes clusters.
Conclusion
HTMX is neither a fad nor a provocation. It is the acknowledgement that for fifteen years the industry accepted complexity that was not always justified. Version 2.0 signals the library has reached a maturity where the pace of change is measured in years, not weeks, and that is exactly what you want from a technological base on which to build products that last. For a small team with an expressive backend and a product that lives on content, forms and data views, choosing HTMX means spending energy on the business domain instead of on frontend plumbing. For a product that needs a rich disconnected client experience, it still does not fit. That margin of honesty is precisely what makes HTMX worth recommending: it knows what it is and what it is not.