silverbullet icon indicating copy to clipboard operation
silverbullet copied to clipboard

Implementing CRDTs for sync issues?

Open rocketteering opened this issue 2 weeks ago • 2 comments

I'm currently using Silverbullet on two devices. Mobile and desktop, where sometimes there's no connectivity and sometimes there is.

I'm not constantly updating devices so, there might be longer spots of time when other device SB doesn't sync. Offline mode handles it quite well.

However, when I do reconnect, I'm often struck with lot of "Conflicted"-pages. It's okay pattern in such that, it doesn't lose my data, but I find it annoying cleaning up the copies.

I was wondering. I've heard all that good stuff about CRDT's and I'm a dev. And I could probably do that work.

Is it in, any way feasible, to try to update the sync system on top of CRDTs?

rocketteering avatar Dec 18 '25 19:12 rocketteering

This is brought up from time to time. Yes this is possible, but it would be a massive architectural overhaul that I'm not willing to take on right now. There are codemirror libraries (the editor component we use) that give you a lot of this out of the box, and there even has been a time in SilverBullet's history where these were used, but they added a lot of complexity and edge cases the way I integrated back then. If I were to give this another shot, I'd need to dedicate a lot more time to this project than I can afford right now. Even if you were to offer doing this work, long term I'd have to maintain it so in that sense it would not help much 🙂

One of the technical goals of SilverBullet is that it should be a project that, complexity-wise can still be managed by just me. This is still the case today, but we're already nearing the limits with all the moving parts and this still being a side show for me.

zefhemel avatar Dec 19 '25 14:12 zefhemel

Thanks Zef! And totally, I'd not be looking it to place it on your shoulders, since you're already doing so much for the project, was just wondering on the feasibility.

I do wonder, do any other options come to your mind, rather than CRDT in-place of more, coherent sync?

rocketteering avatar Dec 19 '25 19:12 rocketteering

With coherent I suppose you mean to do something more fancy than simply generate a conflicting copy when a conflict occurs? Not that I can think of. In theory it would be possible to show a type of git-style diff view with the two version side by side, asking for direct user input to resolve the conflict (agian, similar to git), however that would be quite a project to build as well. The best way to avoid this problem is either to more regularly connect to your server (which I suppose is a problem in your case) or indeed that the sync model changes to something along the lines of CRDTs. Again, this may be something I may attempt again in the future, but I have plenty of other priorities for now :)

zefhemel avatar Dec 25 '25 11:12 zefhemel