HTMX Gaining Popularity Rapidly?

It seems in the past few weeks, I am seeing many posts and so many comments about HTMX. As someone who has never heard of HTMX until now, what is the reason for it's seemingly rapid rise in popularity? Is it something you would suggest to new Django developers to delve into?

23 thoughts on “HTMX Gaining Popularity Rapidly?”

  1. I don’t know what it is, and at this point I am too afraid to ask, literally me right now.

    Glad someone was brave enough to ask

    Reply
  2. Get comfortable with Django first, then get to htmx.

    It’s gaining popularity because it’s a much better alternative to React/Vue/Svelte, etc.

    It allows you to use Django the way it was designed to be used, and not reinvent the wheel with a completely separate frontend.

    Reply
  3. Hi there, I’m the creator of htmx.

    I think htmx managed to catch a wave of discontent with existing javascript frameworks that are very complicated and often turn Django into a dumb-JSON producer. htmx plays better with Django out of the box because it interacts with the server via HTML, which Django is very, very good at producing, so it lets Django developers stay in Django & Python, rather than kicking out to Javascript for 50+% of their web applications.

    I was invited on a few Django/Python podcasts and it kind of took off from there:

    [https://djangochat.com/episodes/htmx-carson-gross](https://djangochat.com/episodes/htmx-carson-gross)

    [https://talkpython.fm/episodes/show/321/htmx-clean-dynamic-html-pages](https://talkpython.fm/episodes/show/321/htmx-clean-dynamic-html-pages)

    What’s funny is that htmx is really intercooler.js 2.0, which I started working on back in 2013. In 2020, I rewrote intercooler.js without the jQuery dependency and renamed it to htmx, which I think better captures the idea (extending HTML). So this is another example of a decade-long overnight success 🙂

    I’m very surprised and very glad that the Django community has embraced it as quickly and dramatically as they have!

    Reply
  4. I shipped a project with HTMX today, and I plan to use it a lot in the future.

    HTMX allows you to “access ajax, css transitions, websockets and server sent events directly in html”.

    An example for htmx:
    Django is Server Side Rendered. Meaning that every time you want click on a link to a page the whole website needs to be refreshed. With htmx you can load only that piece of html you need without refreshing the entire page.

    This makes the application feel like a single page application like something built with frontend frameworks such as vue or react.

    Check out the examples at https://htmx.org/examples/

    Reply
  5. We’re all incentivised by /u/_htmx to promote htmx in the Django community. For real though – you can sprinkle in some SPA-like interactivity without having to code JavaScript.

    The other thing that’s nice is because it’s directly in the HTML tags, it’s quite verbose of what an element is actually doing, instead of having to rely on knowing *some function somewhere does some magic with this div-node*

    Reply
  6. Can’t wait for more django htmx specific tutorials to come out. I’m pretty intermediate at django but have used HTMX in production with great success. Just need a little more help for some more advanced stuff I want to do.

    Reply
  7. Is this a promotion post? Surely the creator of this unknown library lurks the Django 24/7 just for this post. I’ve been working with Django for 5 years and never heard of it.
    Django templating is very limited. Most new websites want a JS framework not a gimick.

    Reply
  8. htmx lets you do certain really valuable things, and it does it in a way that an extremely natural fit for the Django metaphor. In plain Django, when the browser interacts with the server, the server generates a whole new page using templating, and the browser refreshes the whole page. With htmx, a bunch of stuff is possible but the main part is that the front-end can trigger a route on your server that generates a partial HTML and htmx injects the result into the existing page. So a button to add a row to a table can do that without a full page refresh. Or you could do pagination and just update the row-portion of the display. Or, if you have a dashboard URL, you could have that update every 15 seconds. All with a fairly simple amount of htmx attributes added to your elements on the front end.

    Reply
  9. Three cheers for the Django-HTMX stack!

    I’d say learn Django first, and don’t worry about adding in jQuery, because HTMX will save you a ton of time when you get to that point.

    Reply
  10. Don’t try to do anything complex (at least on the frontend) and you’ll probably be fine. I already got burnt hard trying to do dynamic forms with HTMX – what a nightmare!

    Reply
  11. Is HTMX competitive with React/Vue/Angular though?

    I’ve never used it, and honestly I’ve only been using fetch API for AJAX-like functionality.

    Reply
  12. Just asking here because of laziness, does HTMX has some kind of state management API / store or something like that?

    I’ve quickly see the docs, awesome job u/_htmx, thank you!

    Reply
  13. I feel the same way as OP! But still have not tried it. What are the limitations of HTMX relative to something like React?

    Obviously the con of React is it’s it’s own mess that requires it’s own expertise etc etc but what are maybe some pain points or limitation that someone who is used to React would not like about HTMX?

    Reply
  14. I do Django as a hobby, and I’m “full stack”…except for JS. I set up and maintain the VM, OS, systemd, security, DB, Django, ngnix and gunicorn.

    A couple of months ago I did a watched a couple of jQuery video courses, then added some to one of my sites. It kept breaking, and I’d have to spend a couple of hours looking through the JS code to remember how it worked. I eventually gave up fixing it and that particular feature is still broken.

    On another site I used htmx to get async file uploads. It took me a little bit to understand how I needed to change my websites workflow. But it’s much closer to how the rest of Django works, so it’s not such an effort to remember how it works.

    With htmx I feel that I can get 90% of what I need for 10% of the effort of learning all of JS or jQuery.

    Reply
  15. There’s a saying: overnight success takes 10 years. The author has been working on it for a long time (originally in the form of intercooler.js), and is now promoting it quite a bit. He also has some interesting things to say about how the web is supposed to work (see the essays on HATEOAS on the htmx website), and that makes it more enticing to me at least. I’ve experimented with it a little, and so far it’s worked pretty well.

    Reply
  16. I run a DNS hosting service, [SlickDNS](https://www.slickdns.com/), which is a Django app. Several months ago I rewrote the main SPA-like DNS record editor page from Vue.js to htmx. The htmx code is much simpler and the overall performance is very close to the previous Vue implementation.

    I use a Django Bootstrap library so form validation in particular is much simpler with htmx as you don’t need any special case JavaScript client-side logic to handle form validation errors.

    Probably the only area where the Vue solution was better was in client-side record filtering, which is very zippy in Vue/React, as it didn’t need to make a server-side call. The htmx implementation is definitely noticeably slower as it does the filtering server-side, but as it’s a rarely used feature I decided the tradeoff was acceptable.

    Reply
  17. I’m currently using htmx with Django and I’ve been very pleased with it.

    There’s one area I think Django doesn’t come along well with htmx; Form class-based views. Django forces you to follow post/redirect/get pattern, not through general views but in form mixins, which makes it unavoidable. With htmx, there’s no need of redirection. You can simply return template in response of form submit. To working it around, I had to override `form_valid` functions completely and repeat some mixins codes there, and then return a `TemplateRespone` instead of `RedirectResponse`

    Reply

Leave a Comment