Offline-First Android System Design
Designing sync, conflict resolution, local projections, and UI states for Android apps that must work through weak networks.
User Trust Comes First
Offline-first architecture is not only about caching. It is about giving users predictable behavior when connectivity changes.
Core Pieces
UI -> ViewModel -> UseCase -> Repository
Repository -> LocalDataSource + RemoteDataSource + SyncManagerLocal Projections
Store local projections that are shaped for screen reads. This keeps the UI fast and reduces repeated mapping work.
Conflict Resolution
Use server timestamps for simple feeds, domain-specific merge rules for collaborative workflows, and explicit user decisions for destructive conflicts.
Observability
Track sync latency, queue depth, retry counts, and failed mutations. Production sync needs dashboards, not just optimistic code.