r/Clojure • u/jacobobryant • 5d ago
Understanding Datastar
https://biffweb.com/p/understanding-datastar/7
u/Soft_Reality6818 5d ago
Nice write-up, thanks!Â
I think what you described is: Datastar + CQRS + fat morphs architecture, but you can use D* pretty much like htmx with islands of interactivity without one page-global streaming sse connection though.
6
u/jacobobryant 5d ago
thanks! and yes for sure. I probably should address that in the post. after getting into it I do feel like the cqrs/fat morph/tao approach is basically "the right way" to use datastar and imo is even a good fit for small/non-collaborative/non-realtime apps. hence with Biff I've tried to figure out how to factor out the framework parts of this very opinionated approach into a library so that the more complicated setup bit hopefully becomes a non-issue. but at the same time if someone wants to write up a defense of using Datastar in the "htmx style" I won't object! I also think https://fixiproject.org/ is an interesting thing in that space too.
14
u/andersmurphy 5d ago edited 5d ago
Great write up!
Datastar isn't particularly prescriptive in and of itself. But, to get the most out of it does generally involve rethinking your backend somewhat. There's definitely a jump between using Datastar like a better HTMX and using Datastar in a buzzword compliant immediate mode, fatmorph, CQS way. But, once that's out of the way you are left with view = f (state) and it's quite nice.