From SQL to Flow: clean offline-first architecture with Kotlin 2.x
summary
Claims a concrete offline-first system built with Kotlin 2.20+, Room, Flow, coroutines and WorkManager that actually works: GPS at 1,800 rows per 30 minutes drives chunked uploads with offset claiming to guarantee no duplicates eventual delivery, periodic WorkManager pings (>=15 min) pick up residuals, and retention auto-deletes to shrink DB and save battery. Uses zero-cost value classes, sealed sync states, guard conditions; replaces a 400-line monolith with a generic interface where each entity needs ~20 lines. Repo and app exist.
AI-written summary · about
chapters (17)
- 0:00Introduction
- 1:05Offline-first challenges
- 2:10Requirements for sync
- 3:12Offline-first with Kotlin
- 4:36Fixing stringly typed code
- 5:39Sync status with sealed
- 7:04Database resilience
- 8:11Chunking and sync logic
- 9:15Generic sync contract
- 10:19Orchestrating entity syncs
- 11:02Residual data and WorkManager
- 12:27Sync lifecycle
- 13:08Battery-efficient sync
- 14:13Performance wins
- 14:55Generic architecture
- 15:37Open-source repo
- 16:20Final thoughts








