Building mobile apps that work seamlessly without an active internet connection sounds straightforward until financial transactions, simultaneous edits, or volatile cellular handoffs enter the picture.
The Idempotency Dilemma
When a user taps "Confirm Transfer" while driving through a tunnel, the request might leave their radio, reach the API gateway, execute the charge, and yet fail to deliver the confirmation response back to the client.
Event-Driven Outbox Pattern
Rather than issuing HTTP requests directly from UI viewmodels, write every intent to an encrypted SQLite outbox table first.
A background synchronization daemon drains this queue sequentially. If a network call drops midway, the transaction key guarantees safe replay.