TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: SyncedStore CRDT – build multiplayer collaborative apps for React / Vue

144 pointsby YousefEDover 3 years ago

11 comments

YousefEDover 3 years ago
Hi HN!<p>With CRDTs (Conflict-free Replicated Data Types) becoming more mature and getting more attention lately, I decided to dive in and use it as the basis for a new project. I love the technology, and how it enables me to create Google Docs style collaborative apps, that seamlessly sync data across users &#x2F; devices but also work offline.<p>However, I also found that it&#x27;s not yet trivial to build! This is why I started building a library that makes developing multiplayer apps super-simple, with a very minimum API surface. (basically, you can just modify plain javascript objects and changes are shared across users).<p>I&#x27;m now excited to share SyncedStore - and looking forward to your feedback :)<p>It&#x27;s designed specifically for React, Vue, Svelte but also works with plain JS. By using Javascript Proxies, the data store looks like plain javascript objects, except that they&#x27;ll now sync automatically across devices &#x2F; users!
thingificationover 3 years ago
Would you care to compare this with for example @localfirst&#x2F;state, automerge and automerge-rs (latter two provide the CRDTs, i.e. similar to Yjs)?<p><a href="https:&#x2F;&#x2F;github.com&#x2F;local-first-web&#x2F;state" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;local-first-web&#x2F;state</a><p><a href="https:&#x2F;&#x2F;github.com&#x2F;automerge&#x2F;automerge" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;automerge&#x2F;automerge</a><p><a href="https:&#x2F;&#x2F;github.com&#x2F;automerge&#x2F;automerge-rs" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;automerge&#x2F;automerge-rs</a><p>By the way despite that particular repo (@localfirst&#x2F;state) last being touched 6 months ago, Herb Caudill definitely seems still active in this space (I believe he&#x27;s been working on other parts of this more recently -- e.g. ideas about authentication), and I think automerge development itself (Martin Kleppmann) is quite active right now leading up to a 1.0 release which seems fairly imminent, for which a lot of fundamental work has been done, also coordinating with automerge-rs.
评论 #29490072 未加载
yawnxyzover 3 years ago
Wow this is so awesome!<p>How&#x2F;where does the data get saved for later? I&#x27;m guessing from the example, you don&#x27;t need a database? E.g. I can just save the data to a document database, and next time someone works on it, just sync with the database? Or do I not need it at all because it&#x27;s stored on the browser? And how would the information be associated with accounts, if someone wanted that feature?<p>Also curious how&#x2F;where the demo site is deployed (guessing Vercel doesn&#x27;t work since they don&#x27;t seem to support websockets? I see that Hocuspocus is mentioned — is that required as a backend to make it all work?<p>Sorry I&#x27;m new to all of this and it sounds like magic, but I&#x27;d LOVE to learn how to implement this; especially on something like Vercel, if possible
评论 #29485917 未加载
评论 #29486090 未加载
JoeOfTexasover 3 years ago
Pretty interesting project. I&#x27;m curious what the data structure looks like that is sent over the network for diffs. I found the part about state-vector, but not about the actual data.<p>Does it diff the JSON string, or the objects&#x2F;array themselves? Does it serialize the data or leave as plain text?<p>I ask, because I have a similar setup, that needs to sync dynamic data structures, but also keep the data deltas as small as possible when sharing them as JSON strings to save bandwidth.
评论 #29500911 未加载
hanspagelover 3 years ago
So cool to see libraries like yours coming out! (am in love with Y.js)
BiteCode_devover 3 years ago
How does the y-websocket handles network failure ?<p>Does it autoreconnet? On reconnection, does it sync back changes that happened on or since failure ? Can you notify the user when it&#x27;s happening ?
评论 #29487993 未加载
orliesaurusover 3 years ago
Love this! Thanks for sharing, I have some amazing use cases for this type of work and I can&#x27;t wait to dig into the code to learn more. The future for CRDT is indeed hot right now and everyone wants it into their app, Google paved the way and now other big names, like Figma, Invision etc are getting on this hard!
评论 #29488854 未加载
dkerstenover 3 years ago
FYI, the examples don&#x27;t work for me in Brave browser on linux:<p>React example: &quot;&#x2F;App.tsx: Cannot read property &#x27;getItem&#x27; of null (2:0)&quot;<p>Vue example: &quot;file:&#x2F;&#x2F;&#x2F;src&#x2F;store.ts: Cannot read property &#x27;getItem&#x27; of null (1:0)&quot;<p>Works fine in Chromium and Firefox though, so not sure what&#x27;s up.
评论 #29485138 未加载
mvf4z7over 3 years ago
This is awesome to see. I have gotten interested in CRDTs in the last couple years due to them being used in the Elixir&#x2F;Phoenix ecosystem.<p>One question though, how do you integrate a backend into your library? I don&#x27;t see anything mentioned in the docs.
评论 #29484876 未加载
评论 #29485945 未加载
jorisover 3 years ago
Awesome! I assume you’ve been using this in another project?<p>How did you handle&#x2F;implement undo-redo?
评论 #29487940 未加载
gardnrover 3 years ago
How does this compare to other libraries like GUN.js?