Hacker News new | past | comments | ask | show | jobs | submit login

Have you used HTMX?

I am yet to find a reason for using frameworks like React instead of HTMX.




React makes it fairly easy to implement your app in a way that makes it easily portable to different platforms. With things like HTMX, you'll more or less have to rewrite everything if you ever end up in a situation where you'd like to release the application on mobile, or as a desktop app, especially if you want it to work when you can't rely on the user having a stable internet connection.


I have used HTMX with Flask and Jinja. It makes the process much simpler to do the frontend development as a backend developer. But I can see its limitations. It's not suitable for anything bigger than a hobby project. Also, it doesn't help with keeping the frontend and the api totally separate. You have to return the html object from API which has its own set of problems.


> It's not suitable for anything bigger than a hobby project.

This is patently false. It is being used in multiple significant production systems:

https://www.commspace.co.za/

https://zorro.management/

https://www.contexte.com/

https://turboscribe.ai/

and many more. There are times where htmx isn't the right choice, but the idea that its not useful for anything more than a hobby project is simply false.


The middle 2 links are by solo developers - I wouldn't call those significant production systems. Generally tools like React are helpful for managing complexity across large systems where nobody understands the whole app and layers of of features, bug fixes and optimizations have been baked in over the years and nobody understands the whole app anymore


The reason "nobody understands the app anymore" is due to the complexity of React and not the application.

HTMX tries to reduce the complexity.


No, nobody understands the app because it is simply impossible to hold in your head 5-10 years worth of development by 100+ people across a complex product with complicated use cases and customer need (unless you were there the whole time and you are a very hard worker)

By the time you create the correct abstractions, customer needs and the market will have changed and thus your abstractions are now incorrect


It's both.

Sure, if you have project like facebook then you problably won't get away from complexity, and you NEED a tool to help you manage that.

But at the same time, if you assume you need such tool from the beginning, chances are you will over-complicate your solution and it will become a self fulfilling prophecy of trying to tackle complexity by adding more complexity


contexte is a (small & now full stack, after using react) team:

https://htmx.org/essays/a-real-world-react-to-htmx-port/


To be accurate in the past year we went from 3 to 7 in that team, and I think everyone has been using htmx at least once, and 4 of us are using it on a regular basis.


I would like to know more about these limitations. I haven't used HTMX on more than a hobby project myself.

>You have to return the html object from API which has its own set of problems.

If you mean that HTMX can't consume JSON. Can't you just create a separate end point for JSON responses?


Of course that is possible, but wouldn't that make the project more complex again?


What's the reason to use a framework like HTMX instead of React?


Cost.

React will require you to hire a React dev to handle all the complexity.

htmx will be mastered by your "back-end" devs (who actually are web devs) in less than a week.


What kind of web dev can't handle React? Meanwhile, htmx uses clunky, non-standard attributes that rely on logic and templates that are split up in a million different places. Plus it requires a context switch to do anything client side.


I know so-called "senior frontend engineers" whose speciality is React, and who can't handle React. So all others...

This thing (and others like Vue, let me be clear) adds many layers of complexity over the web platform (client-side routing, data fetching, state management, rendering, etc.) and many third-party JS libs that you have to constantly update. You just can't say that it's standard/base web development.


Don't underestimate the learning commitment it takes to learn react. Learning the basics of react and its component architecture is one thing, learning all the tricks and gotchas related to hooks, accidental re-renders, accidental no-renders, etc takes time.

Throw in the usual pile of libraries used with any larger react app and it can easily take months to really get moving.


Everything has tricks and gotchas, even htmx.


React is so simple to use that you definitely don't need to hire a "react dev" to "handle all the complexity". Like >95% of the effort is just understanding the basics of standard front end technologies (HTML, JS, and CSS), something that "back-end" devs (especially ones that label themselves as such) are by no means guaranteed to understand, which is an issue, since you'll have to understand these things even when working with htmx.


My feeling as an old-time "web developer" who has been bullied into becoming a "back-end dev" is: thank you, I think I know quite well the basics of standard front-end technologies, but suddenly some people started yelling at me "you're a grandpa, now you can't send HTML from the server anymore, it's lame, you have to send to the browser a JS app that will manipulate the DOM live instead". This new (in 2015) approach has flooded our brains with a deluge of libs, frameworks, tools, concepts, problems, etc. which are a lot more than 5% of the effort of bootstrapping a React app, let alone optimizing it and maintaining it. I know people who's main job is creating React apps and who are overwhelmed with the complexity of the stack. If you don't hire someone dedicated, the rest of your product (domain rules, database optimization, infrastructure, devops, etc.) will suffer.


It reduces development complexity.

- No complex build set-up (just link the script & use it)

- Less congitive load when reading the code. Especially if it's not yours.

- Very decent learning curve.


But all it is is fancier fetch()s. It can't remotely approach the functionality of React, so it just shifts any complexity to different places.


Yes, it shifts complexity to the backend. Which will already have it anyway (because it has to), has better tools to manage it, you can use literally anything you want instead of being forced to use javascript, has (relatively) instant access to the authoritative source of truth, and isn't resource constrained (at least not the same way that the client is).

so "just shifts it somewhere else" might be underselling it a little


And waiting much longer than an instant for a million server requests every time a template changes on a page is not a good use of those resources.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: