Skip to content

Comment on Why you should choose HTMX for your next web-based side project (2024)parent

Comments

But why?

Fetching data from APIs I have no control over, or ones that serve multiple purposes and use a single response format

HTMX uses HTML snippets over the wire to replace HTML elements on the client. It's not supposed to grow to support every use case you can imagine.

If you're calling APIs that you have no control over, you do so on your server.

That's the entire point of HTMX: the minimal necessary addition to browsers/HTML to allow HTML REST APIs to update pages without full page loads.

Personally, I wouldn't consider HTMX to be a good fit for those scenarios.

Obviously you _could_, and it might even work well, but I think that's using the tool against its grain.

I guess I could see it for decoupling your need to control the API you're using. The case where you have an existing API, whether your own or someone else's, and just want to get a new frontend hooked up to it.

Just put any template rendering engine in-between.

Htmx is "bring your own backend", but you do have to have a backend, be it Haskell or Zig or Gleam, that talks to your API, and renders HTML.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.