As I’ve mentioned a few times, HTMX is really growing on me for building web things lately. When stacked on top of Django, it lets me mostly write server side code, which is my comfort zone, but get pages that load and behave the way people expect them to in 2022. It doesn’t free me from all need to write stuff that runs in the browser, though. Here’s what I’ve found useful lately.

I started off watching this excellent set of videos. It’s a great orientation toward how nicely HTMX plays with Django’s templates.

Benoit Blanchon’s articles and videos about modal forms and toasts also caught my eye. The way he uses empty responses is very interesting. And the demonstration of handling HTMX events is easy to pick out and instructive. I wound up adapting his approach to use TailwindCSS and Alpine because that matches up better with the things I tend to use. The modal works a little differently than it does with bootstrap. That may be worth its own post, but not today.

This article by Owen Jones shows the same approach using hyperscript with HTMX, and I really like it. I used to write a lot of HyperTalk in the early 1990s, and doing web things with hyperscript feels very much like the spiritual successor to that. I’m not sure that I’m ready to use it “in anger” yet. It hasn’t seen a release its author considers “stable”, it does require shipping a “runtime” down to the browser when you use it, and I’m concerned that it could be a challenge to hand an application that makes heavy use of hyperscript off to someone else for long term maintenance. But I’m really tempted in spite of those 3 reservations.

I’ve been asked why I like to keep as much as I can on the backend. I’m sure some of it boils down to age. When I started making web things, there was only backend. Javascript was just emerging and was primarily used for annoying junk. That doesn’t mean I disliked it… I had a lot of fun writing my share of annoying junk. But even as it evolved into something more useful, you still needed to write backend code to build most of the things I was interested in making. And in my opinion, the various “javascript on the server” things have not caught up to something like Laravel, Django or Rails. Given that I can’t avoid targeting the server, the more I can move “front end” things into server templates, the faster I can build. I see a certain appeal to the idea of separating API from front-end for large teams. But when you’re starting small, that slows things down. And I don’t think the opposite is true; it’s relatively easy to overlay an API on a backend that’s geared towards producing hypertext, and I’m not sure doing things in that order slows down the development of the API at all in many cases.

This link dump got longer than I wanted it to. I should probably delete the last paragraph but I won’t. The real point of this post is to throw links to the articles from Owen Jones and Benoit Blanchon, along with my demo project for doing similar things with Tailwind and Alpine, where I can easily find them and share them.


I’m trying on Kev Quirk’s “100 Days To Offload” idea. You can see details and join yourself by visiting 100daystooffload.com.

This is day 8.