Markus Stuppnig / Blog / HTMX and HATEOAS: why your frontend needs no JavaScript framework

HTMX and HATEOAS: why your frontend needs no JavaScript framework

Most 'REST APIs' are really RPC. HTMX brings true HATEOAS-based architecture back to the web and makes single-page apps unnecessary in many cases.

The SPA paradox

Single-page applications took over the web. But at what cost? A typical React app loads an empty HTML shell, then a 200 KB JS bundle that only then fetches the data from the server. The server renders nothing anymore; it just serves JSON. The entire rendering logic is duplicated on the client.

HTMX flips this model: the server delivers finished HTML, and the client only swaps the parts of the page that change. No state management, no virtual DOM, no npm install.

HATEOAS: the forgotten part of REST

Roy Fielding, the inventor of REST, wrote in 2008 that a hypertext-driven interface is what makes something REST. If state transitions are not driven by hypertext, it is not REST.

Why this matters in the age of AI

An LLM agent that receives a self-describing HTML document can decide, just like a human, which link to follow and which form to fill in. It needs no OpenAPI spec and no out-of-band documentation. The contract between server and client is the hypermedia itself.

Sources: htmx essay: HATEOAS · Roy Fielding: REST APIs must be hypertext-driven (2008) · Martin Fowler: Richardson Maturity Model · Carson Gross: HATEOAS is for Humans (2016)

htmxhateoashypermediaarchitektur

← All posts