I've been using HTMX quite a bit recently, so I went ahead and updated the 
Simple Twitter repository I had <https://github.com/ajusa/simple-twitter>. With 
HTMX, you have something similar to the original post where interactions hit 
the server, but you control where the HTML goes. This usually means increased 
performance as you are manually specifying where HTML goes after doing a 
request. This still has the same latency issue however, for example if you 
clicked "Edit" in my updated code and have lots of latency you'll need to wait 
for the Edit form to be fetched. The Karax version doesn't have that issue. 
However, with stuff like Cloudflare workers (Nim runs on that with the JS 
backend) and AWS Lambda, latency is becoming less of an issue.

For what it's worth, the HTMX version is around 60 lines of code, without crazy 
golfing (I did use the fancy syntax that Norm offers, but that was it). It also 
uses my WIP forms library <https://github.com/ajusa/dalo>, which helps slightly 
with clarity. If you're willing to live with the potential latency issues, I 
think that this is a really solid stack to build web applications in Nim. I'm 
still experimenting with <https://hyperscript.org>/ (from the HTMX folks) to 
see if that could help reduce latency by moving certain interactions to the 
client side, but it isn't quite as clean as it could be.

Reply via email to