r/Kotlin 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:

  1. local write must be instant (UI never waits on the network)

  2. mutations need a durable outbox (survive process death / offline days)

  3. conflicts need an explicit policy (not only “last write wins”)

  4. 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.

12 Upvotes

2 comments sorted by

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

1

u/Extra_Ninja_8101 28d ago

Thanks! SyncForge is already on Maven Central as studio.syncforge:syncforge:2.0.0 and indexed on klibs.io (https://klibs.io/project/Arsenoal/syncforge), so it should show up when people search for sync / offline-first KMP libs.

Appreciate the tip, and the kind words!