5 ms·
For those of you who don't think Datastar is good enough for realtime/collaborative/multiplayer and/or think you need any of the PRO features. These three demo
by andersmurphy 1y ago
For those of you who don't think Datastar is good enough for realtime/collaborative/multiplayer and/or think you need any of the PRO features.
These three demos each run on a 5$ VPS and don't use any of the PRO features. They have all survived the front page of HN. Datastar is a fantastic piece of engineering.
- https://checkboxes.andersmurphy.com/ https://checkboxes.andersmurphy.com/
- https://cells.andersmurphy.com/ https://cells.andersmurphy.com/
- https://example.andersmurphy.com/ https://example.andersmurphy.com/ (game of life multiplayer)
On both the checkboxes/cells examples there's adaptive view rendering so you can zoom out a fair bit. There's also back pressure on the virtual scroll.
- afavour 1y ago> They have all survived the front page of HN Right but this says “bring your own backend” in big letters on the splash page. So surviving HN isn’t really something Datastar is doing here.
- nchmy 1y agoI don't understand what point you're trying to make. He shared examples of some immensely dynamic apps that are running on a potato and survived HN, showing that this simplifies things greatly and can scale. Hypermedia-first is a very viable, and simplified, approach.
- afavour 1y agoI think my point is pretty straightforward. Datastar is a front end framework. If any frontend framework can’t survive HN traffic it’s doing something wrong in a truly unholy way. Surviving, or not surviving, a traffic influx is a backend restriction.
- nchmy 1y agoAnd yet, most frontend frameworks barely on even the simplest of sites. This is not only well documented, but most of them have now moved towards some sort of SSR hybrid - at great complexity cost.
- afavour 1y agoI disagree with “most”. 99% of the sites featured on HN do just fine. OP is a talented developer that wrote a backend capable of surviving a ton of traffic. Other developers on the internet have written backends that cannot sustain a ton of traffic. The choice of frontend framework is separate from both. You can write a performant web app that uses React. I’m sure you can write one that falls over immediately with Datastar.
- andersmurphy 1y agoThank you for the kind words. I think for me the key thing is Datastar lets me keep most of my state on the backend, which makes the backend much simpler to write. It also lets me do immediate mode streaming of the HTML, which again is non trivial in something like react without a lot of added complexity. So it's an enabler in that sense. But, yes it's totally possible to write a backend that falls over with datastar like any technology. I also agree, that Datastar does benefit from backend experience and if you don't have that experience it can to some extent feel like: "Draw some circles. Now draw the rest of the Owl".
- nchmy 1y agoThat's a fair point. But I think that the real point that /u/andersmurphy was trying to convey was that hypermedia is VERY performant because immensely talented C++ engineers have optimized precisely this, for decades. The notion that "frontend" devs have that the DOM can and must be managed via JS is simply ridiculous, and is one of the primary things that datastar and hypermedia approaches in general are trying to combat. In fact, he openly states elsewhere how the sites' backends are actually done in a deliberately dumb, unperformant way, where the backend streams the ENTIRE DOM with each sse message, which gets morphed into the DOM. He could have done something more granular, like streaming only the checkboxes that have changed, but it wasn't at all necessary because the dumb way worked well. Moreover, the SSE streams benefit from immense compression ratios because somehow the compression window overlaps across messages. Something like 95+%, IIRC.
- afavour 1y ago
- markusw 1y agoIt's a frontend framework and a backend SDK in multiple languages, for SSE and more.
- sudodevnull 1y agoData star is a backend agnostic backend framework that happens to have a 10kb on the frontend. You should probably read the guy before coming to conclusions on what it is
- andersmurphy 1y agoSure. You're not wrong. I'd argue Datastar's fat morph model is what lets me write a much simpler backend that's amenable to batching/better compression. It's also fast enough on the client that this immediate mode style rendering of HTML is actually possible. I'm also not doing anything fancy on the backend, I'm using a dynamic language not known for it's speed (Clojure). Really, most of the work here is being done by SQLITE, batching, and brotli compression, which you can all use from any language. I will concede that languages with access to real threads (GO, JAVA, C# etc) do better out of the box for this kind of CQRS architecture.
- miroljub 1y ago[flagged]
- andersmurphy 1y agoIt's global multiplayer, you can see everyone changes simultaneously. There's no client side state for the checkboxes they are all on the server.
- jakewins 1y agoThe whole point of this framework is that a ton of the logic remains on the backend, with live connections to the frontend. At least for me the performance and hosting cost implications of that was the first question that came to my mind when I looked at this, I don’t understand how answering this question isn’t relevant here.
- dang 1y agoCan you please not post like this here? It's against the site guidelines: https://news.ycombinator.com/newsguidelines.html https://news.ycombinator.com/newsguidelines.html
- miroljub 1y agoYou're right. Sorry, can't delete the comment now.