4 ms·
I have a system I’m working on that is all HTMX but I am thinking about options. The system is a document management tool which can be configured to be a lot o
by PaulHoule 2y ago
I have a system I’m working on that is all HTMX but I am thinking about options.
The system is a document management tool which can be configured to be a lot of different things like an image sorter or an RSS reader or an information extraction tool. The key design point is that it has to be easily configurable.
I worked on a similar system at a startup that used an SPA and boy was it a bear because changing anything involved making both front end and back end changes. We had to change directions all the time to keep up with our customers and the monolithic SPA sure slowed us down.
My current back end has a query builder that can generate queries with a complex structure as is supported by OWL DL, like
(Temp > 95 AND Temp < 100) or (IS warm)
but with HTMX I can best use URL query parameters like
?temp:gt=95&temp:lt=100
that are all ANDed. I am thinking about making little applets with svelte that could do what HTMX can’t.
- WickyNilliams 2y agoCould you not have ?query={entire query goes here} Rather than splitting it up into multiple query params? Feels like it's one indivisible param rather than multiple facets. You could always base64 encode if it starts getting complex
- PaulHoule 2y agoIf it just comes to having buttons to add and remove tags I guess the server could generate those packed query strings (that HTMX will GET or POST to) Full text fields would be harder as the front end is going to want to put them in their own query parameter although one attack on the problem is to have the query as a parameter and have parameters that define a command that changes the query and have the back end mash that into the query. The user interface for nested queries would be more complex than for the flat queries (which can usually be updated incrementally, adding or removing just one tag) but could probably be redrawn from the back end whenever it changes.
- Izkata 2y agoDoes it really need to be generated on the backend and passed around like that? It seems like you're doing a ton of extra work to fit it into htmx, where coming from jquery and react, it's much more natural to generate it entirely on the frontend using plain arrays and objects, then send it as a whole to the backend in one serialized json string. Of course with one final validation on the backend, possibly with a transformation into whatever query language the backend is using. But no need for round-trips to construct it like that.