I've a hard time taking htmx serious for building a modern web app/site. It makes is impossible to build features that users have come to expect:
* Faceted search with configurable filters, like filter date on before, between or after, but only show the filter if the user wants it.
* Configure result view with different columns or even different views like maps or drawing something on a canvas like charts. You can maybe do some of this stuff with htmx but at some point you'll just need the json.
Even Angular can do this, and with something like SolidJS it is actually a pleasant thing to do.
A JSON api can be re-used by other apps while htmx feels like someone reinvented Thymeleaf
You can check this talk out https://youtu.be/3GObi93tjZI I was thinking the same but in the video they specifically talk about faceted search and how they did it with htmx.
For the second part you probably go with your own javascript or get away with hyperscript
That is the talk I've watched before coming to the above conclusion. The faceted search demonstrated in the talk is still an order of magnitude simpler then what I have build. It is still a cool example of what you can do with htmx and it certainly pushes the envelope but the UX choices are dictated by what is possible in htmx. I also think that the talk is somewhat dishonest, it is by a backend developer that want to keep writing Django while I would suggest replacing that with Postgrest. I estimate that what is shown here can be done with 500 to a 1000 lines of SolidJS for the entire app.
> what is shown here can be done with 500 to a 1000 lines of SolidJS
If you replace a 22,000 LOC React + Python app with 1,000 LOC of whatever framework you choose, I would be very, very, very, very impressed. I don't believe you.
Impossible is a strong word. I've looked at their API and I can certainly imagine ways to do everything you list above in HTMX. I would need to build and use it in anger to know if it's a good way to do so but I can imagine scenarios where it definitely is.
The point about a JSON API is a good point and if you need a public API then you should probably factor that into your decision making but not everything has this constraint.
In a well-designed system, these two are not mutually exclusive but simply two facets of the same request pipeline. The JSON API simply serializes the model as JSON.
The HTMX-specifc API applies a template/transform over the model and returns HTML instead. If one thinks of hypertext as another serialization target, it's easy to see how one would easily be able to serve both JSON for pure APIs and hypertext for HTMX.
Oh definitely. You could control it with the `Accept: text/html` http header too so you can use the same endpoint. But as I said, you need to take that into consideration if you adopt htmx.
On the topic of filtering, this is literally something I tend to do only client side anymore, unless it is something where the size of the payload matters. Even smartphones don't have any issue with search through tables with a thousand lines.
So for such things I would give the user a very broad set of data via htmx and then allow for further (realtime) filtering via JS.
If I want them to be able to search through data that isn't displayed initially I just deliver it with a hidden css class and remove that class if it is searched for.
Htmx, like any technology, is very well suited for a certain set of problems — iif you don't try to make it do tricks it is not good at, you should be fine.
Depends on the framework and what you're using to render the html with. For example, in PHP Swytch Framework, you can just `$this->rerender($state)` in an api response.
* Faceted search with configurable filters, like filter date on before, between or after, but only show the filter if the user wants it.
* Configure result view with different columns or even different views like maps or drawing something on a canvas like charts. You can maybe do some of this stuff with htmx but at some point you'll just need the json.
Even Angular can do this, and with something like SolidJS it is actually a pleasant thing to do.
A JSON api can be re-used by other apps while htmx feels like someone reinvented Thymeleaf