Hypermedia Systems
hypermedia.systems
hypermedia.systems
This is a book that was in contract to be published but the publisher pulled out, so we are going to try to self publish it (never done this before, we'll see how it goes.)
It is in somewhat rough shape because we are redoing the book with a more conceptual bend than the publisher wanted: there are some repetitive sections due to re-arranging, typos and areas that need to be expanded, but the rough outline is about what we want and much of the content is pretty solid.
The book looks at hypermedia conceptually, then htmx for hypermedia-driven web applications, then HyperView for hypermedia-driven mobile applications.
We the authors all agreed to keep the online version available for free forever.
Hope people find it useful and interesting.
Can you share why? Did they think the topic was niche?
From htmx’s twitter:
> the book was initially in contract w/ a tech publisher, but was dropped because they didn't feel there was a big enough market
we were straining to make the book fit into what the publisher wanted, so this gives us a good opportunity to write the book that we want
Do I find my thesis particularly brilliant? No. More like, cute, some fun musings.
But this topic is really niche and my thesis exactly fills that spot. So it might be interesting to some.
Also, the history section with Vannevar Bush is a must read (not per se in my thesis, just in general). I also saw that this submission had Vannevar Bush mentioned, reading about the Memex is such a cool thing if you think about in what time this was written.
I had better luck at ximpel.net, taking a look at it now.
Frontend frameworks all have a way to unit- and integration-test their components without resorting to Cypress or Playwright. How do you integration-test the effect of your hypermedia enhanced applications without a (headless) browser? Using Chrome for a few end-to-end tests is fine. But it is not a replacement for in process RackTest (to give a Rails specific example).
From a quick glance testing is not addressed in this book either.
assert response.json() == {"detail": "Item already exists"}
You can write: assert f"<b>Item already exists</b>" in response.render().decode()
One thing I found using HTMX (or just HTML) is that the apps are less fragile. I know that if I return a chunk of HTML, the browser will render it the same way every time. With a JSON-based SPA, maybe that chunk of JSON ends up triggering multiple side effects, re-renders, etc. which can behave differently depending on the current application state. This all affects the amount of testing that I feel comfortable with.[0]: https://fastapi.tiangolo.com/tutorial/testing/?h=testing#ext...
HTMX writes quite a bit of the logic for us. We don’t need to test that logic because we can assume that it’s been tested. We only need to test the remaining logic, of which there is less and it’s less messy because it’s more declarative (if I understand HTMX).
If we use an input of type “email” we also don’t test if its validation works.
If I make it happen, the rebuild with HTMX should be a lot of fun!!
The section on mobile clients seems very timely. At least one fediverse server [1] is adopting elements of htmx and it would seem that the corresponding clients would be a canonical example using this technology.
Fixed! (It worked fine in the dev server...)
1. The approach is about grafting pieces of HTML inside a htmx-enabled HTML document. These pieces may also contain arbitrary htmx. This may lead to an explosion of possible states. What approaches and tools are offered to manage this explosion, and prevent states that don't make sense? (In the SPA world, things like React and Svelte do that.)
2. The approach forms an ever-changing HTML document. Most often you want such a document to match some server-controlled state. What approaches are suggested to make sure things are in sync? (Say, React can just completely re-render the logical state, only updating parts on the screen which need a visual update.) Classic HTTP and HTML are all about serving static files, even.when following links (GETs should be idempotent); this approach has no such limitations / guarantees.
I do think there would often be significant common parts between an htmx endpoint and json data endpoint, so to me it makes sense to implement these in a way where they can share common code or be built on a common layer.
To build a mobile hypermedia client (which is what Hyperview is) is a massive effort and building it on top of something like React Native makes a lot of sense. What matters isn't the underlying implementation details, but rather the hypermedia system (client, hypermedia format, etc.) that HyperView gives you.