HTMX Reinvents the HTML-Based Web
All those years and resources put into coding camps – pushing millions of young kids into this profession – now seems misguided since AI is so good at programming. Github’s Copilot, OpenAI’s Codex, and Google’s AlphaCode all augment even the best software engineers. Meanwhile, ChatGPT makes it so inexperienced or zero-experienced people can create software in less than a day.
Who knows how this will impact employment? Replacement? Displacement? Augmentation?
Nonetheless, developers’ backs are up against the wall. And it’s fascinating to see them develop new languages which the AI doesn’t yet understand or have enough training data to replicate. Two days ago I covered Mojo – the programming language for designing AI neural networks with ease. And now we have a development called HTMX which changes web development at the most fundamental level of HTML.
WTF? HTMX is What HTML Should’ve Been
User expectations of the web are now that you have this super-smooth no-reload experience. Unfortunately, it's an expectation that is usually delivered with single-page applications (SPAs) that rely on libraries and frameworks like React and Angular, which are very specialized tools that can be complicated to work with.
SPAs have allowed engineers to create some great web applications, but they come with a cost. Hugely increased complexity both in terms of architecture and developer experience. You have to spend considerable time learning about frameworks. – Chris James
HTMX is a new language created by Big Sky Software that addresses the complexities of creating reactive web pages. In essence, it augments the browser. HTMX allows you to design pages that fetch fragments of HTML from your server to update the user's page as needed without the annoying full-page load refresh. It’s like adding a little salt and pepper to a finished dish for flavoring instead of remaking the entire dish from scratch each time it doesn’t seem quite seasoned right.
All HTMX does is make the browser better at hypermedia by giving us more options regarding what can trigger an HTTP request and allowing us to update a part of the page rather than a full page reload.
By embracing the hypermedia and not viewing the browser as merely a JavaScript runtime, we get a lot of simplicity benefits:
1) We can use any programming language on the server side.
2) We don't need lots of libraries and other cruft to maintain what were basic benefits of web development. (Caching, SEO-friendliness, The back button working as you'd expect, etc.)
3) It is very easy to support users who do not wish to, or cannot use JavaScript. – Chris James
HTMX is way easier to learn than React, which is constantly moving and changing. You can use whatever programming language you like to deliver HTML.
As a developer, HTMX takes only a few minutes to understand but has a rich collection of features that we can build any UI experience. Using HTMX we can follow conventions so little to no additional JavaScript is necessary. Additionally, if we need to use an existing JavaScript library, HTMX plays nicely with the existing ecosystem. Regardless of your preference, HTMX works with your philosophies, not the other way around. – JetBrains
It also re-empowers the union of front-end and back-end development, allowing one person to achieve both relatively easily with HTMX. This is a breath of fresh air considering we’ve siloed frontend and backend development for so long with increasingly complex languages and architectures.
For further understanding of HTMX:
- Chris James makes an in-depth case for how and why HTMX will change web development forever.
- The author of HTMX has written a free book explaining hypermedia.
- The examples section on HTMX.org shows what’s possible with this.
Member discussion