If you want a solid demo of what you can do with datastar. You can checkout this naive multiplayer game of life I wrote earlier in the week. Sends down 2500 divs every 200ms to all connected cliends via compressed SSE.<p><a href="https://example.andersmurphy.com/" rel="nofollow">https://example.andersmurphy.com/</a>
Reading tfa I kept wondering "is this yet another framework where every click is a server round trip?" Judging by the demos¹, the answer is yes?<p>If this is "the Future", I'm branching off to the timeline where local-first wins.<p>¹. <a href="https://data-star.dev/examples/click_to_edit" rel="nofollow">https://data-star.dev/examples/click_to_edit</a>
Datastar author here... AMA, but know that Datastar is pure yak shaving for me to do real work stuff so I have no golden calves, just approaches I've seen work at scale.
The TODOS mini application at data-star.dev is slow and doesn't work correctly for me (checking/unchecking items isn't reliable). To me, this highlights one common problem I've seen with frameworks that insist on doing everything on the server.
I've been working with datastar for a bit now and have really been enjoying it. If you are looking to try it out, I created a boilerplate template that distills some of the examples from the datastar site to get up and running with:<p><a href="https://github.com/zangster300/northstar/tree/main">https://github.com/zangster300/northstar/tree/main</a>
This matches 100% my experience and thoughts.<p>I really enjoy HTMX and it's a blessing for my small-scale reactivity web interfaces, but I can immediately tell: "Well, this is hard to organize in a way that will scale with complexity well. It works great now, but I can tell where are the limits". And when I had to add alpine.js to do client-side reactivity, it immediately was obvious that I'd love to have both sides (backend and frontent) unified.<p>Still need more time opportunities to roll some stuff with datastar in it, but ATM I'm convinced datastar is the way to go.<p>For reference, my typical "web tech stack": Rust, axum, maud, datastar, redb.
Nitpicking but<p>> SSE enables microsecond updates, challenging the limitations of polling in HTMX.<p>How is this true? SSE is just the server sending a message to the client. If server and client are in opposite sides of the world, it will not be a matter of microseconds...
<a href="https://www.youtube.com/watch?v=0K71AyAF6E4" rel="nofollow">https://www.youtube.com/watch?v=0K71AyAF6E4</a><p>I found this talk really interesting. It's a cool framework for very interactive applications.
Really well-written and well-structured post! I'll seriously evaluate Datastar in my next toy project because of the author's praises!<p>For people who are looking for HTMX alternatives, I think Alpine AJAX is another choice if you are already using AlpineJS
The section on the author's background could have almost been written by me. I'm also a PeopleSoft developer, and the ability to build fully-functional CRUD apps without needing to know about HTML, JavaScript, Browsers, etc, is severely underappreciated. For very simple CRUD pages, no code is required. For developing line-of-business apps it's actually an incredible toolset.
I just wanted to say I love this entire "ecosystem", if I may call it. Hypermedia is cool. HTMX looks like the natural evolution of HTML we all were expecting from the 90s. The simplicity of hx tags and the fact they get the work done is really refreshing. Datastar looks promising as well. It is already on my radar for a hobby project. Kudos to the dev team!
This is the second post I’ve seen praising Datastar in the last 24 hours, and once again no mention of the requirement to punch a gaping hole in one’s Content-Security-Policy.<p>If this is the framework of the future, cyber criminals are going to have a bright future!
> Did I mention I hate javascript ... Avoid Javascript ... Javascript makes me queezy ... I broke out in hives because I hate JavaScript<p>Web development may not be your thing.
Correct me if I'm wrong, but isn't half the point of htmx to allow for adaptive web design (ie, if js fails to load or is disabled it can still function via the form submission)?<p>It seems like Datastar is doing away with that entirely and binding the UI more tightly to JavaScript to function correctly.
On thing about datastar vs htmx: Datastar embraces htmx's OOB swap and makes it a first class concept.<p>HTMX's OOB swap appears to be an after thought.
> fresh perspective, embracing server-driven architecture<p>This is not fresh perspective. I used to be on "team everything on server" but it's a mistake on insist on that today.
This looks really good. Kudos to the authors!<p>It's great seeing a rise of web stacks that embrace small libraries and native web technologies, and reject mega monolithic frameworks. It's about time the industry moved away from the React/Vue/npm insanity.<p>I'm also intrigued by Nue, but Datastar fits nicely in a full stack solution. The choice of SSE is brilliant. It's great tech that's generally underutilized.
The other day I bumped again into Markus Lanthaler's hypermedia adventures with Hydra [0] "Hypermedia driven web API's" dating back from Semantic Web days, and later revived and stalled again as the W3C Hydra Community Group [1]. Though very different it hinted at the great power of hypermedia at the time. And I am very happy to see things getting explored again, in this different and refreshing approach. Greatly enjoyed watching the interview [2] of Delaney Gillilan on the hypermedia-tv Youtube channel.<p>[0] <a href="https://www.markus-lanthaler.com/hydra/" rel="nofollow">https://www.markus-lanthaler.com/hydra/</a><p>[1] <a href="https://www.w3.org/community/hydra/" rel="nofollow">https://www.w3.org/community/hydra/</a><p>[2] <a href="https://www.youtube.com/watch?v=HbTFlUqELVc" rel="nofollow">https://www.youtube.com/watch?v=HbTFlUqELVc</a>
One idea i found interesting on top: why not use a service-worker to mock the backend completely (<a href="https://mswjs.io/" rel="nofollow">https://mswjs.io/</a>) and mock the server answers with the service-worker.
Then you still have a local-only PWA-style frontend and can choose yourself, how to sync it back to a server if you really like or need to.<p>What datastar is great for is: throw all that overcomplicated frontend-junk away and concentrate on the real innovation or simply get things done. Not to forget: ignore the dependecy-hell of every nodejs-based project you can encounter. After the lowcode-initiative, now it's time for the "nodeps"-initiative. Deprecate npmjs.com.
first, great well structured and accessible post.<p>convinced me to maybe try datastar out next prototype where its applicable. reminds me of htmx with hyperscript if hyperscript wasnt kind of a joke. to clarify, the author of hyperscript calls it a sort-of joke and im not trying to slam it.<p>ive used htmx and hyperscript for prototyping because its entertaining and the novelty is motivating. i found similar issues as the author of this post where i talk myself out of using htmx for the product by the end of prototyping.<p>all that said we've been evaluating a react sdk provided by ESRI (experience builder) and diving into that makes me stare longingly at datastar where it seems like i could use signals to update client-side data from 3rd party apis
Future? Looking at some of the examples, this seems a lot like the same old web server frameworks we had like 15 years ago, maybe more. Granted they didn’t have SSE but regardless the DX was pretty bad. I don’t see a compelling reason to go back.
Also worth checking out is the recent release of RedwoodSDK: <a href="https://news.ycombinator.com/item?id=43657215">https://news.ycombinator.com/item?id=43657215</a>
From datastar's docs:<p><i>> Backend Setup</i><p><i>> Data star uses Server-Sent Events (SSE) to stream zero or more events from the web server to the browser. There’s no special backend plumbing required to use SSE, just some syntax. Fortunately, SSE is straightforward and provides us with some advantages.</i><p>As a django developer, this is very far from true. With htmx i get almost no backend changes (mainly in template code), where datastar would require me to rewrite it and may not be possible to implement at all.
I love the idea of datastar, but wonder how does one test it without using e2e testing?
Also, I think it would be amazing and so much simpler if instead of using SSE, it just included all the events in a response. Maybe with SSE as an option for those who need true server pushes? I feel like most apps don't require server push, and instead just need a list of events/things to update from an action.
The web framework of the future is for better or for worse what Vercel and YouTubers talk about.<p>Original thinking is sorely lacking in the majority of the web dev community.
As you escape the React/JSX intoxification, you can drop the XML syntax.<p>It took us a while back in the day after the XHTML arc, but for sure it'll be ok.<p>I know this looser SGML universe might feel a little kooky, but trust me it wears baggy trousers, rocks gifs with a hard g and offers great <hugs>.<p><pre><code> <thank><you>
<nothankyou/></code></pre>
This is probably a silly question, but how do I use loops? For example, if my backend returns an array of TODO items, how can i iterate through that and display on the frontend?
I'll just leave this here. At first you might be afraid, or petrified. But then you'll realize how you cannot live without this by your side.<p><a href="https://gonads.net/" rel="nofollow">https://gonads.net/</a>
Betteridge's law of headlines? ;)<p>[1] <a href="https://en.wikipedia.org/wiki/Betteridge%27s_law_of_headlines" rel="nofollow">https://en.wikipedia.org/wiki/Betteridge%27s_law_of_headline...</a>