Rewriting PrayerMate Sync With PowerSync

submited by
Style Pass
2025-01-06 12:30:20

When I first went full-time on PrayerMate back in 2016, one of the very first major projects I tackled was to implement data syncing between devices. I hated every minute of it, and whilst the implementation mostly worked in most situations, there was a frustrating number of edge cases where it failed fairly spectacularly in unpredictable ways. It was remained one of our biggest sources of bug reports ever since – but, until now, it has seemed an impossible problem to untangle. Where do you even begin, trying to approach a problem like this?

Our old sync implementation was built on top of Firebase Real-time Database – something that was never really intended for our use case. We had separate native implementations on both iOS and Android, which was another major source of bugs, due to minor discrepancies in how they were implemented. I also often felt hampered by our commitment to building an app that could be used completely offline, and that supported anonymous usage where none of your data was synced to the cloud.

Then we discovered PowerSync. PowerSync describes itself as a “local-first” sync engine. It had a Flutter API, meaning that we could build a single implementation that worked across both iOS and Android. And it was completely designed with our use case in mind – building apps where the local database was considered primary, that worked fully offline – but then syncing that data to the cloud.

Leave a Comment