Mina Sameh — Software Engineer (React Native, TypeScript, AI)

Mina Sameh

Building Offline-First with MMKV

AsyncStorage is dead. Here's how MMKV + a sync queue architecture handles insurance claims offline.

·

AsyncStorage served us well, but at scale it becomes a bottleneck. MMKV — backed by memory-mapped files — is orders of magnitude faster.

For MedGulf's insurance app, offline capability isn't a nice-to-have. Field agents operate in areas with spotty connectivity, and claims need to be filed regardless.

Our architecture:

  1. MMKV as the local truth store
  2. A write-ahead log for mutations
  3. Background sync queue that retries with exponential backoff
  4. Conflict resolution using last-write-wins with server timestamps

The key insight: treat local storage as the primary database, and the server as a sync target. This inverts the typical client-server relationship.

Performance numbers:

  • Read: 0.01ms (vs 6ms AsyncStorage)
  • Write: 0.02ms (vs 15ms AsyncStorage)
  • Batch 1000 items: 2ms (vs 800ms AsyncStorage)

The result: the app feels instant, even when the network doesn't cooperate.