Problem
The Cuban judiciary needed a field tool for judicial assistants who monitor the social reintegration of sanctioned individuals — presentations, controls, evaluations, family situation reports — and feed those observations back into a central ERPNext (Frappe) system at the Tribunal Supremo Popular.
The hard constraint was connectivity. Field workers operate across the entire country, including municipalities where mobile data is unreliable for hours or full days. A failed sync at the wrong moment can mean a missed control or a lost evaluation — and in this domain, missing data is not just inconvenient, it has legal consequences for the person being monitored. The system had to behave correctly with NO network, then heal itself when network returned, with zero loss.
Approach
I architected the mobile client as a local-first SQLite-backed Flutter app that treats the network as an enhancement, not a dependency. Every write — a presentation logged, an evaluation filled, a notification opened — commits to the local SQLite database first, before any network call. A background sync engine then reconciles with the ERPNext backend over REST when connectivity is available. Conflicts resolve via timestamped last-write-wins.
The non-obvious decision was the API contract, not the storage layer. I led a contract-first REST documentation effort with the backend team: versioned endpoints, explicit pagination, and delta-fetch semantics with checkpoint resume — so the sync queue could pick up exactly where it left off after a long disconnect, instead of re-syncing the entire dataset on every reconnect. That single design choice was what kept hours-long offline windows fully operational.
Outcome
Field workers can run a full day offline — log presentations, fill evaluations, record notifications — and the queue reconciles transparently the next time they reach signal. No data was lost in the months observed after rollout. The sync visualization (the screen above, paused at 30%) became a recognizable trust signal for the operators: they could see the queue draining and know nothing was stuck.
The contract-first API discipline reduced cross-team integration friction enough that a second mobile surface (an internal admin tool) was scaffolded against the same endpoints without a backend rewrite.
Most product fields and identifiers in the screenshots are blurred or test data — the production system is operated by the Tribunal Supremo Popular and is not publicly accessible.




