webstudio-is / webstudio

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.
https://webstudio.is
GNU Affero General Public License v3.0
5.4k stars 664 forks source link

Explore realtime collaboration #46

Open kof opened 2 years ago

kof commented 2 years ago

There is a lot of things to consider when building a realtime multiplayer UI, here are a few:

  1. DX and State management
    • We are building on top of immer, using immerhin as a Developer facing interface for transactions. This interface results in JSON patches, after that we can decide where to go considering all other aspects.
  2. Server architecture
    • How will this work with cloudflare workers type of env and a single container env?
  3. Database
    • Can we do that on top of SQLite?
    • RxDB?
  4. Conflicts resolution
  5. Change types:
    • Ephemeral (not important - can be dropped, doesn't need permanent storage)
    • transactional (atomic, very important, has context, needs permanent storage, e.g.: color: was changed to red)
    • blob (non-atomic, e.g. text has changed, no idea what part)
  6. Offline-first

Other links

TrySound commented 2 years ago

Lexical supports yjs CRDT implementation out of the box. We can consider it when start building collaboration.

https://github.com/yjs/yjs https://lexical.dev/docs/collaboration/react

kof commented 2 months ago

POC for reference once we work on it https://github.com/webstudio-is/webstudio/pull/1130