
Francisco Moschetti
HTMX pilled
So I decided to give HTMX a try in the least suited project for such thing: a websockets heavy app.
The core pieces of soundbits.live rely on HTMX - Handling a new websocket message and showing it in the livestream is all handled by the websockets plugin provided by HTMX. Of course Iām also using it to make the UI experience feel better, even though this product doesnāt need to support a lot of user interactions in the admin.
The modules for SSE and websockets make HTMX a great tool to use in AI apps (stream chat respones), or just any async and reactive stuff really.
I kinda wanted to put it to the test and see in wich scenarios HTMX makes the most sense over a JS metaframework. After seeing how easy and familiar it was, I became an extremist (jk but not so much).
The realization
This sounds weird, but Iām really starting to believe there is only 2 ways of doing things:
- Server driven applications (BE framework + HTMX)
- Local first (Your favorite JS framework + indexed DB + some sort of sync)
Iām a BE dev, and the recent explosion of meta frameworks (NextJS, Sveltekit) sounded like the ideal scenario for me to start learning more about FE.
The problem is that the āmagicā of these frameworks abstract you from the standards you learn while doing BE, and it takes a lot of time to fully understand and use these frameworks well.
Not saying I donāt like them, I love Svelte. But is hard to ignore the anxiety I get when iām debating using one of these tools for a internal tool or any production project, not because of the āscalabilityā issues or whatever, but the fact that I know I will end up wasting 3 hours debuging an issue caused by a single line of code that changes how the framework renders a page or something very nuanced to the way the tool operates.
Currently building a local first app with svelte and itās been an amazing experience, it kinda depends on what you are building, how do you plan on monetize, and a lot of different factors, but i can say with enough confidence that 90% of the B2B SaaS ideas you can think of shouldnāt even consider anything over HTMX and a robust BE framework.
You can always āsprinkleā client side interactions with something like Alpine or petite-vue if you really need to in the worst cases.