Khaled Elfakharany
Back to Projects
professionalcompleted

Airmee Offline-First Logistics System

Airmee
May 2020 - Jul 2020
Team of 2
Overview

A sophisticated offline support system for Airmee's iOS courier application that enabled delivery operations in buildings without network coverage. The system featured background synchronization services running at OS level with heartbeat monitoring, hybrid storage combining SQLite, CoreData, and caching layers, and intelligent queue management for chronological sync operations. Delivered in 6 weeks without requiring any backend modifications.

Problem Solved

Couriers delivering packages inside buildings frequently lost network connectivity, preventing them from taking photos, scanning QR codes, and completing deliveries until they regained signal

My Role: Senior iOS Developer (Contractor)
  • Architected offline-first system design handling all delivery operations without network
  • Built background sync service with OS-level execution surviving app lock and backgrounding
  • Implemented hybrid storage architecture using SQLite, CoreData, cache, and UserDefaults
  • Designed chronological sync queue ensuring delivery sequence integrity
  • Created comprehensive validation and fallback systems for data conflicts
Key Outcomes
  • Delivered complete offline support system enabling couriers to work in zero-network buildings
  • Built background service running at OS level with heartbeat monitoring that survives app lock
  • Implemented hybrid storage architecture combining SQLite, CoreData, cache, and UserDefaults for optimal data management
  • Created chronological sync queue maintaining delivery sequence integrity when back online
  • Designed comprehensive validation system with both server-side and client-side checks
  • Built full fallback system handling data conflicts and duplicate prevention
  • Achieved zero backend changes - pure client-side solution
  • Completed entire system in 6 weeks under first Toptal contract

Performance

  • Zero backend modifications required
  • 6-week delivery timeline

Technology Stack

Primary Technologies
SwiftCoreDataSQLite
Secondary Technologies
BGTaskSchedulerBackground fetchUserDefaults
Infrastructure
Local storageBackground services
Tools
XcodeInstrumentsGit
Challenges & Solutions
Technical

Challenge

Couriers entering buildings with no network signal needed to complete full delivery flows including photo capture, QR scanning, and delivery confirmation without any connectivity

Solution

Built offline-first architecture with local queue storing all operations chronologically, deferred synchronization triggered when connectivity restored, and intelligent retry mechanisms

Impact

Couriers could complete deliveries regardless of building network conditions

Architecture

Challenge

Background sync needed to occur even when phone was locked in courier's pocket, requiring true OS-level service execution

Solution

Implemented OS-level background service using BGTaskScheduler with heartbeat monitoring, triggered by network availability detection, backend push notifications, and timeout thresholds

Impact

Automatic synchronization without requiring any user interaction or app foregrounding

Data Integrity

Challenge

Ensuring no data loss or duplication when transitioning between offline and online states, especially with multiple deliveries queued

Solution

Designed chronological ordering system with idempotent operations, dual validation (client-side before sync, server-side confirmation), and comprehensive fallback system for handling conflicts

Impact

Zero data loss incidents with reliable conflict resolution

The Story

Situation

Airmee's courier app was failing when delivery drivers entered buildings with poor mobile network coverage. Couriers couldn't complete deliveries, scan packages, or take proof-of-delivery photos until they exited buildings and regained signal. This created significant operational inefficiency and delivery delays.

Task

Design and implement a complete offline support system that would allow couriers to perform all delivery operations without network connectivity, with automatic synchronization when back online.

Action

Khaled architected an offline-first system with a sophisticated hybrid storage layer combining SQLite for persistent data, CoreData for object graph management, NSCache for temporary data, and UserDefaults for state flags. He built an OS-level background service using BGTaskScheduler that would continue running even when the phone was locked, with heartbeat monitoring to detect connectivity changes. The sync queue maintained strict chronological ordering to preserve delivery sequences. Dual validation ensured data integrity - client-side checks before queuing and server-side verification before committing. A comprehensive fallback system handled edge cases like duplicates and data conflicts.

Result

The complete offline support system was delivered in 6 weeks without requiring any backend modifications. Couriers could now complete full delivery workflows in buildings without network coverage, with automatic synchronization occurring in the background. This first Toptal contract proved the ability to deliver high-impact technical solutions through elite consulting engagements.

What I Learned

Technical

  • Offline-first architecture patterns for mobile applications
  • iOS background services and BGTaskScheduler deep expertise
  • Hybrid storage strategies combining multiple persistence layers
  • Sync queue design with conflict resolution
  • Client-side validation and fallback system design

Soft Skills

  • Elite platform consulting through Toptal
  • Working with senior technical leadership remotely
  • Delivering complex technical solutions under tight timelines

Key Insights

  • 💡 Offline-first design is critical for logistics applications where operations must continue regardless of connectivity
  • 💡 Pure client-side solutions can deliver significant value without requiring backend team coordination
  • 💡 Background service reliability requires multiple trigger mechanisms working in concert