In the fast-paced world of web development, amidst the craze of the latest frameworks, the best solutions often lie in simplicity. In a recent article, we touched on localization for dynamic web content with Go and htmx . In this article, we’ll explore the combination of htmx and Go further, best practices and maintainability. Taking a “Lindy” approach to web development. The Lindy Effect is that concept that asserts the future life expectancy of a non-perishable idea or technology is proportional to its current age; the older it is, the longer it is likely to be around.
To recap, htmx is a lightweight Javascript library that allows us to access modern browser features directly from HTML, eliminating the need for heavy client-side frameworks and especially, client state. I.e. writing Javascript (the htmx library) to avoid writing Javascript (on your website). The general philosophy of htmx aligns well with Go’s focus on simplicity. Still, the combination appears to be a contrarian stance one what “modern” web development constitutes.
The htmx Philosophy
At the heart of htmx lies the belief in lean code and agile development. Focused on creating a stateless client:
- HTML Over the Wire: htmx enables dynamic user interfaces by sending HTML over the wire, easing server-side development and maintenance, and minimizing client-side state. htmx adheres to the HATEOAS constraint , using Hypermedia as the engine of application state, by leveraging HTML.