In 45 minutes I made a #kotlin#javalin application from scratch, which uses #webjars to include #htmx from a #maven pom file. It uses static #HTML files for the first load, and then renders HTML from #jte templates for #SSR of the parts of the pages that need that kind of interaction. There's no #springboot (or any #spring at all) and no #SPA like #angular or #react.
Now because simply setting up a project says close to nothing about its real world viability, next step is an actual usecase ( :
I haven't worked with Thymeleaf; I used to do SSR using #JSP and later #Freemarker.
As for natural templating: I expect it to make my fragments more clear when the serverside directives are explicitly not in the HTML, like with JTE, whereas the clientside directives are, as HTMX. Less confusing than when clientside and serverside logic are both inline in the same HTML template.
If in #DassaultSystemes they would hear about #HTMX and rewrite that hot mess of #3DEXPERIENCE#Enovia, perhaps, the product itself and modifications from partners would become worthwhile... We have long outlived iframes for emulating #SPA environment.
Sometimes, when I talk to frontend developers about how #HTMX requires you to have more presentation awareness in the projection side of your server application as you generate content in HTML, which in the #Java world is pretty much what we did with #JSP, Freemarker and Thymeleaf, I'm met with amazement.
No dis, but be aware: There's a generation of capable professional frontend developers who don't know backend servers can serve HTML just fine, and not just Json over HTTP.
Can't recommend enough the Hypermedia Systems ebook to web developers. Not only a great resource for learning and "getting" #htmx, and acquiring key best practices for using it, but it also makes the case for the classic #hypermedia system architecture, which has been somewhat disregarded over the last decade or two. Should be a worthwhile read, regardless of the framework or app architecture you intend to use. https://hypermedia.systems/#webdev#html
This is a great rapid-fire intro to #HTMX. Too fast for good retention of course, but a great way to survey HTMX capabilities and style in 8 minutes. https://www.youtube.com/watch?v=TT7SV-bAZyA
Would be sweet if I can have a static #HTML / #CSS website that uses #HTMX for interaction with a backend written in Kotlin and compiled to #wasm running on an edge location using #wasi .
Also, not immediately relevant to your current issue but something that might be worth considering for the future: using the htmx websocket extension, you can basically implement a streaming HTML approach (example using Kitten: https://ar.al/2024/03/08/streaming-html/) where you can just stream errors to the page as they happen.
#htmx tip: if using "htmx.ajax()" API call to trigger an HTMX request, and you need to push the URL to your history, return response with "HX-Push-URL". (django-htmx has a handy "push_url()" function for this).
I made a ServiceWorker intercept #HTMX calls and manage state inside of the ServiceWorker process all in-browser.
The downside is it takes a few seconds for the service worker lifecycle to start, so it's likely only available on page refreshes. Still a neat concept.
@jjude One could create an audio app that leverages #htmx.
You would need to leverage in-browser JavaScript to capture the audio, using the MediaRecorder API (or a library), but the app can use Htmx for the rest.
Every few months, I come back to rewriting a #todo app in #aspnetcore, sometimes it's with Blazor, sometimes it's Razor Pages, and this time with #Htmx (although I may have already done HTMX 😅)
I got some quality-of-life improvement issues entered to help make #JetBrainsRider better, too. So that's a win!
> [HTMX] can get you 80% there with radically less complexity. No extra dependencies, no build step, no advanced tooling (now re-written in Rust!), no complicated state management, no “double data” problem, no hydration mismatch… Just write your HTTP server and return HTML!
@quii Just stumbled on your post and found you on Mastodon. Excellent write-up!
I remember visiting frontend conferences where people were struggling to explain the value of progressive enhancement. Then one year, the frontend movement discovered AngularJS and from there every few months a new SPA thing emerged to solve the mess the previous incarnation left behind.
I am so glad #HTMX is catching on with full stack developers.