Your field technician stands in a basement mechanical room. No signal. No Wi-Fi. The work order loads instantly anyway â schematics, asset history, checklists all there. They complete the job, tap sync, and walk away. That's not magic. That's offline-first architecture done right.
Why Offline-First Matters in 2026
Enterprise mobile apps face a hard reality: connectivity is unreliable. Field ops, logistics, healthcare, manufacturing â these environments have dead zones, metal interference, and security policies that block cloud access. Users expect apps to work regardless. Offline-first isn't a feature; it's table stakes.
Kotlin Multiplatform (KMP) changed the equation. Share business logic, data layer, and sync logic across Android and iOS without sacrificing native UI. SQLDelight gives you a type-safe, reactive database that compiles to SQLite on both platforms. Ktor handles networking. Compose Multiplatform (or native SwiftUI/Jetpack Compose) renders the UI. The stack is mature.
The Architecture: Local-First, Sync-Second
Core principle: the local database is the source of truth. The UI reads from SQLDelight flows. Mutations write locally first. Background workers reconcile with the server when connectivity returns. No loading spinners. No "pull to refresh" as a crutch.
SQLDelight: Shared Schema, Native Performance
Define your schema in `.sq` files. SQLDelight generates Kotlin APIs for both platforms. Queries return `Flow>` â reactive, lifecycle-aware, zero boilerplate. Migrations are versioned SQL files. No ORM magic, no runtime surprises.
Sync Engine: Deterministic, Resumable, Observable
Build a sync coordinator that runs in a `WorkManager` (Android) / `BGTaskScheduler` (iOS) worker. Steps: pull changes since last `server_version`, apply locally with conflict resolution, push local `PENDING` items, update `server_version`. Each step is idempotent. Failures retry with exponential backoff.
Conflict Resolution: Last-Write-Wins Isn't Enough
Field apps generate concurrent edits. A technician updates a checklist while dispatch reassigns the work order. Last-write-wins loses data. Implement three strategies: server-wins for reference data, client-wins for user-generated content, and merge for structured fields (checklists, counters). Surface `CONFLICT` status to UI for manual resolution.
| Data Type | Strategy | Example |
|---|---|---|
| Asset metadata | Server wins | Serial number, location |
| Checklist answers | Merge (union) | Completed steps |
| Notes/photos | Client wins | Technician observations |
| Status transitions | State machine | OPEN â IN_PROGRESS â CLOSED |
Testing Offline Behavior
Simulate network conditions in CI. Use `MockWebServer` with latency, errors, and partition scenarios. Test: cold start with stale data, sync during active edits, conflict resolution flows, battery-constrained background sync. SQLDelight's `TransactionManager` lets you test migrations in-memory.
âĻ
Offline-first with KMP and SQLDelight isn't theoretical â it's shipping in production apps today. Start with the data model. Make local writes instant. Build sync as a background concern. Your users in the basement, the tunnel, the secure facility will never know the difference. They'll just know the app works.









