(This library was previously called "Reactive-CRDT")
SyncedStore is an easy-to-use library for building collaborative applications that sync automatically. It's built on top of Yjs, a proven, high performance CRDT implementation.
https://yousefed.github.io/SyncedStore/
Have a look at the collaborative Todo list examples (React, Vue) to get up to speed.
- Open live demo: React or Vue (Of course, open multiple times to test multiplayer)
- Edit / view on Codesandbox React / Vue
Source in: examples/todo-react and examples/todo-vue.
Yjs is a very powerful CRDT, but it's API is mostly targeted to create high-performant data bindings for (rich text) editors.
I wanted to explore whether we can abstract the existing Yjs API away, and make it extremely easy to integrate it as a Collaborative Data Store into existing applications.
There were two major design decisions:
- Instead of data types like Y.Map, and Y.Array, can we just use plain Javascript objects and arrays?
- e.g.:
store.outer.inner.property = value
instead ofdoc.getMap("inner").getMap("outer").getMap("inner").get("value")
- e.g.:
- Instead of having to call
.observe
manually, can we integrate with a Reactive Functional Programming library to do this automatically?- e.g.: wrap your code in
autorun
or useuseSyncedStore
(React), or Vue's reactive model and automatically observe all used values from the store.
- e.g.: wrap your code in
Would love to hear your feedback!
SyncedStore builds directly on Yjs and Reactive. It's also inspired by and builds upon the amazing work by MobX and NX Observe.