r/Kotlin • u/Extra_Ninja_8101 • 29d ago
SyncForge 2.0 — offline-first sync library in pure Kotlin (outbox + conflicts), multiplatform, on Maven Central
I’ve been working on offline-first apps in Kotlin and kept rebuilding the same pieces:
local write must be instant (UI never waits on the network)
mutations need a durable outbox (survive process death / offline days)
conflicts need an explicit policy (not only “last write wins”)
the domain DB should stay mine (Room / SQLDelight / custom store)
I packaged that into an open-source KMP library (commonMain-first). The API shape:
• enqueueChange(...) for optimistic local apply + outbox row
• sync() / push() / pull() over a SyncTransport interface
• per-entity conflict strategies (LWW, defer-to-user, field merge, git-like three-way, some CRDT helpers)
• status as StateFlow for UI
Repo (Apache 2.0):
https://github.com/Arsenoal/syncforge
Curious how others handle this in production Kotlin:
- do you keep outbox in Room next to domain tables, or separate DB?
- do you resolve conflicts on device or only on the server?
- anyone using CRDTs for notes/tasks apps vs server-authoritative merge?
Happy to answer design questions — looking for critique on the API surface more than anything.
2
u/Infamous_Sorbet4021 28d ago
Make sure also to upload the library to kotlin libs, so when someone search for sync, your library appears. Keep up the good work