Is HTMX a Joke??

20,797
25
Published 2024-02-05
Scott and Wes unravel the mysteries of HTMX, exploring the essentials for getting started, its powerful capabilities, limitations, and possible stacks for building primarily server rendered applications.

Show Notes

00:00 Welcome
02:07 Brought to you by Sentry.io
02:53 What exactly is HTMX?
04:30 What you need to know before working in HTMX.
04:35 You need a server.
05:35 You'll most likely need a templating engine.
06:42 You most likely do not need as much client-side JS.
08:33 You don't work in JSON
11:15 Not something you can swap out your UI with in a SPA.
11:48 Brings back AJAX
13:32 So, what can it do?
15:20 And what it doesn't do.
18:25 It doesn't do server-side responses.
19:09 What about animations?
19:20 What about CSS?
19:57 What about Web Components?
20:06 What about third-party client-side JS?
20:18 What about WebSockets and SSE?
20:30 What about extensions?
21:00 Wes' "bomb" question.
24:16 What Scott likes about HTMX.
25:45 What Scott doesn't like about HTMX.
30:33 Hype, Meta Framework.

All links available at syntax.fm/726

------------------------------------------------------------------------------
Hit us up on Socials!

Scott: twitter.com/stolinski
Wes: twitter.com/wesbos
Randy: ‪@randyrektor‬
Syntax: twitter.com/syntaxfm

www.syntax.fm/

All Comments (21)
  • @TarlanT
    Used HTMX in my last project. Saved bunch of time for me.
  • @OttoVanluchene
    It also gives backend devs and option to create UIs without the need to learn react, nextjs, Svelte,... For like internal tooling or Apps.
  • @ohLyln
    This might be a strange analogy but what Next did for react devs is what HTMX does for backend devs. Theo had a good video about this but just like Next (or Remix) allows your react app to reach into the backend sphere, HTMX allows those using templating engines to reach a little further into front-end interactivity. I have been liking HTMX so far, I made a tiny search engine with it on a Go server and it felt natural to tap back into the PHP days except my users don't need a full browser reload when I return some hypermedia (or when navigating with the app with hx-boost). You can keep that similar paradigm but give your users a little more of that more cohesive SPA feel.
  • @jas0x139
    I was toying around with HTMX and went a little crazy and ended up re-creating my personal website with it. Went with an Express server and was kinda shocked I was able to pull it all off without a template engine. On the server I just used template strings, pushed to an array and ended with a res.send(content.join(' '). I was even able to create a markdown editor with a live preview. Got a bit excited because I was using Django and that was a pain in the ass to deploy on my dedicated server via docker.
  • @shofada
    HTMX is awesome, feels natural. Haven't needed anything else.
  • @klmcwhirter
    The good thing is that it is just another JS library like knockout or lodash. Use it where you can get its benefit but continue to use Angular, React, Vue, Solid, etc. where you need to use something more sophisticated! Most of the enterprise apps I have built in the last 10 years have a pretty rich set of app configuration screens. Most of those are perfect for the simplicity of HTMX. Reducing the implementation cost and reducing maintainability cost of those screens will help sell them to the PM. Your users will thank you. Your users will also thank you for the decision to use a richer framework for the heart of the app. It is not one size fits all. Use the tool that best fits the functional and non-functional requirements being implemented. HTMX is just one more tool in the dev's tool belt to please the customer and the PM.
  • @angstrom1058
    I like it because I don't have to learn a new language/framework. I just decorate, route the requests and send back HTML (in this case snippets of templates from Go). It gives me opportunities and lightens the client side coding.
  • @7:16 - Alpine is not a competitor of HTMX, they work synergistically. While HTMX fetches the state from the server as a snippet of HTML, Alpine allows you to handle the state on the client-side end, both done in the hypertext. That way, HTMX does the talking with the server and Alpine does the reactivity. While I am worried about the HTML getting bloated, I look at the stuff going on in my javascript tags or linked js files sometimes and just think that maybe it's better that way.
  • @Rtzoor
    a live coding session would be much appreciated. It was a great talk!
  • @drumforhim
    This is a very insightful conversation. A lot of good points made!
  • I skipped the whole front-end javascript framework craziness of the last decade. For me, this feels like the logical next step after the jQuery + server side rendering of 2 decades ago :-D
  • @sheriffderek
    I really like this style of discussion today. It's like Scott kinda prepped to be the expert, and then Wes played the first reactions or student or maybe skeptical side - and then they could explore the middle ground. Maybe it's just that I've never seen it on video? (I haven't listened in a while). Something I've been toying with when creating video lessons - is to have more people involved and to have pairing instead of just one person going through their steps. This reminds me of that feel.
  • @crab-cake
    htmx is so refreshing. rsc's is too much. i'm back in school to do something else long term. i've worked in the industry for around 10 years. enough is enough for me.
  • @jeremybuckets
    24:06 I think you should revisit this question. You hashed out the strawman version of it, which is that React’s virtual DOM is terrible and that’s why everyone is moving away from virtual DOMs. But that’s not the Sveltekit strategy. In Svelte land I can be 100% server rendered for as long as I want and then opt-in to a little bit of client side in seconds if the use case pops up. It seems like that flexibility is going to be a massive win over HTMX for long lived projects that need to grow and evolve. I don’t know if I’m actually right about that because I feel like I still don’t quite get HTMX. I would love to hear someone who’s really familiar with HTMX make the argument against “modern”, non-vDOM frameworks like Svelte or Vue.
  • @echobucket
    With HTMX you don't have to have "Client side state management". No React Context, no Redux, no complexity. HTML IS the state.
  • HTMX looks amazing! How does it handle optimistic rendering? It seems the SPA's might still have the edge for that? Great explanation as always.
  • @jeffparent2159
    The part i struggle with is that I don't seem to ever write dynamic pages that work without an event bus. One action has a cascade of effects. You click a filter and that triggers an updated search, a pill pops up at the top, the head banner changes, etc. With htmx I'd end up just reloading the entire page. Unless I'm going to SSR my entire site its weird to only do it for small specific parts. It's making my design more complicated, not less.
  • @cmdr-reflipd
    I am enjoying HTMX, it is so simple to learn and even simpler to use. I use HTMX 2, ALPINEJS, TWIND CSS, HONO.JS, CLOUDFLARE WORKER, D1, KV, AND R2. No node, no Python, no GO, simple and serverless.
  • @nic_s3385
    In 2019 I was looking at doing a rewrite and I wasn't happy with all the javascript. So I started to look at at moving as much as I can to the server. I was still returning JSON, but sometimes that JSON would have HTML to replace parts of the page and sometimes that JSON will have a single value to update a single textbox. I had full control over what I replaced, how much, and when. My stack was just C#, HTML, vanilla JS, and a little bit of CSS. No other libraries was needed. Then HTMX get release in late 2020. People looked down on my idea pretty hard... then comes 2023 and suddenly doing it all on the server is cool again and HTMX becomes popular. /Insert guy flipping table here...
  • @oWeRQ666
    How quickly everything is forgotten, a little over a decade ago used this approach everywhere, I think the new generation does not realize how difficult it is to support such applications, and where it was enough they continued to do without htmx