htmx gives you access to AJAX, CSS Transitions, WebSockets and Server Sent Events directly in HTML, using attributes, so you can build modern user interfaces with the simplicity and power of hypertext
htmx is small (~14k min.gz’d), dependency-free, extendable, IE11 compatible & has reduced code base sizes by 67% when compared with react
I’d go a step further and suggest, make your backend itself an API that uses JSON and whatever. Then the web backend talks to the API and spits out HTML. And it can do whatever is needed to support HTMX without having to worry about how it will affect the API and you can’t end up with web exclusive features unintentionally.
And you don’t have logic duplication where you can forget to add an auth check to a web controller or the API.
I’d go a step further and suggest, make your backend itself an API that uses JSON and whatever. Then the web backend talks to the API and spits out HTML. And it can do whatever is needed to support HTMX without having to worry about how it will affect the API and you can’t end up with web exclusive features unintentionally.
And you don’t have logic duplication where you can forget to add an auth check to a web controller or the API.