Will HTMX be the future ?

HTMX is now getting popular. A lot of people have started using it their day to day smaller projects and now it is part of Github accelerator. Chances are the Django and Rails community is going to adopt this new savior of full stack frameworks very soon.

Chris James writes:

Learning React is an industry in itself. It moves quickly and changes, and there are tons to learn. I sympathise with developers who used to make fully-fledged applications being put off by modern frontend development and instead were happy to be pigeonholed into being a "backend" dev.

I've made reasonably complex systems in React, and whilst some of it was pretty fun, the amount you have to learn to be effective is unreasonable for most applications*. React has its place, but it's overkill for many web applications.*

The hypermedia approach with HTMX is not hard to grasp, especially if you have some REST fundamentals (which many "backend" devs should have). It opens up making rich websites to a broader group of people who don't want to learn how to use a framework and then keep up with its constantly shifting landscape.

The FrontEndEng.dev blog writes:

There was a time when we used technologies like PHP to build websites. It was all about rendering an entire page on the server and sending it to the client. Some Javascript was used to do things like animations and validations on the client. This was the model of "Multi Page Apps" or MPAs which refers to the face that we had many pages that user navigated to as they explored the web app. Javascript libraries like jQuery helped do the basic scripting for the client side.

However, with time, applications became complex. Imagine a website like Facebook or Instagram without infinite scrolling and every click on a button or like refreshes the entire page. So people started using javascript to update the parts of the page in page without navigating to a new page. This sort of approach resulted into people creating front end frameworks like React and Angular.

React or Angular helped people do whats called "Single Page apps", a single page is loaded first and then for everything user does we only updates relevant parts of the page, fetching only necessary things from the server. The disadvantage here is that maintenance of the code for both client and server gets complex and also the browser is overburdened.

Bad SPAs give terrible experience to user and their code is very hard to follow. Also SPA tech does not work well with old frameworks like Django, Rails and PHP frameworks which were primarily designed for MPAs.

Something like HTMX is likely to help DJango, Rails and Laravel like frameworks to build more rich applications that behave like SPAs but with MPA like approach.

Conclusion

HTMX is most certainly interesting and very likely something that will find adoption in another major popular framework.

Did you find this article valuable?

Support Random Draw Engineering Blog by becoming a sponsor. Any amount is appreciated!