tijlleenders / ZinZen

Better together - an app to realize dreams together.
https://ZinZen.me
GNU Affero General Public License v3.0
37 stars 52 forks source link

Multi-device sync technology discussion #1934

Open tijlleenders opened 4 weeks ago

tijlleenders commented 4 weeks ago

Is your feature request related to a problem? Please describe. It's very annoying when you have to reinvent the wheel for replication.

Describe the solution you'd like Find an existing protocol that can be used to implement multi-device sync with a lot less effort.

Describe alternatives you've considered

  1. Make a custom sync. Too much effort.
  2. Make a simplified sync, like forcing you to pass around a lock when you switch devices. This is probably too cumbersome and feels underwhelming when other apps 'just work'.

Additional context Some ideas:

  1. Use CRDTs. Mind the rabbit hole! Some of the pro's and cons

CRDT requirements:

https://nextgraph.org/ looks promising but not production ready
There's a few more suggestions on https://restoration.software/posts/peer-to-peer-architecture-research/:
https://nostr.com/
https://tech.anytype.io/any-sync/overview
https://odd.dev/
https://p2panda.org/
https://socketsupply.co/
https://spritely.institute/ https://willowprotocol.org/
https://braid.org/antimatter
https://lofi.re/
https://smolweb.org/
https://www.w3.org/TR/activitypub/
https://veilid.org/
Hyphanet, GNUnet, SSB Matrix-based:

  1. ? Is there any alternative to CRDTs ?

Also:
The sync mechanism could also be used to backup a password-encrypted version to a trusted peer. If you do my backup - I'll do yours. Typically you'll want to choose someone other than your partner too, to avoid physically co-locating all the data and backups.

Side note:
Any Event Sourced system qualifies as using Commutative CRDT (CmRDT), since it's a Grow-Only set, like G-Set, at least under the condition that the events are representing operations and are modeled in such a way that order in the stream does not matter. Under these conditions it is mathematically proven that any conflict within the stream can also be resolved.

tijlleenders commented 4 weeks ago

@Tushar-4781 @vinaybadgujar102 Any suggestions or thoughts?