Htmx and Hypermedia

Hypermedia Systems by: Carson Gross

This article is a random book report on "Hypermedia systems" by Carson Gross and his team available online, Hardcover and paperback at hypermedia.systems

The Web Development Problem

As long as I have been a web developer web tools have been evolving and often the solutions are complicated to Implement. Web development has always had its pros and cons in this respect. Unless your website is simple html and css, websites in general get complicated very quickly and it takes effort to keep the code manageable. Because html has never been a true programming language using javascript or server side languages has always been a necessity and the passing of data between them has always added additional layers of complexity and still does. To add to this in order to provide a great user experience additional levels of complexity have emerged that are not always very reliable and create a long term management nightmare unless a coder creates their own strict structure and even then the constantly evolving frameworks and libraries can often break things forcing the coder to repair what seemed like perfeclty good code.

Enter Htmx

What would normally take some complex javascript to implement, htmx has extended html to resolve. While it will not solved all web development problems it handles several very common and popular features.

Popular features htmx simplifies

hx-boost

The simplest htmx feature to implement and the first mentioned in the book is hx-boost. hx-boost allows you to AJAXify your page with a simple hx-boost="true" attribute inside the body tag. All elements inside the body tag will now load individually when updated instead of loading the entire page. making your page smoother and less clunky. Most of htmx is explicit so this is not a good over all example of what to expect. However it is worth mentioning as it's so easy to implement the benefits could improve your entire site.

Installing htmx

Installing htmx is very simple. A simple script tag in the header of your page and you are ready to use it. See details here.

What is hypermedia?

While I am not sure I fully understand what hypermedia is the book does a good job of painting the picture. htmx is an example of using hypermedia and putting http the delivery protocol to its full use in html where only get and post were available now several more can be used and any interaction can become an http request. Logically it modularizes some things in a way that makes code more readable. Where you might need a jumble of complex javascript you might be able to use explicit htmx(which is written in javascript) to solve many common features found on modern websites. I found the book very readable and recommend it to any web developer who wants to update their website or make it easier to maintain.