# Offline-first & Data Synchronisation

> Design apps that work without a network: local-first reads, queued writes, sync strategies and conflict resolution. Free notes, key concepts, resources and a...

Canonical: https://www.internhack.in/roadmaps/tracks/mobile/offline-first
Last updated: 2026-11-28

Design apps that work without a network: local-first reads, queued writes, sync strategies and conflict resolution.

Advanced · about 10 hours · difficulty 4/5

Learn first: [Local Storage: Key-value, SQLite & Files](https://www.internhack.in/roadmaps/tracks/mobile/local-storage)

Mobile users go through tunnels, lifts and bad coverage. An offline-first app reads from local storage first and syncs with the server when it can, so it always feels fast.

### Core pattern

1. The UI reads from the **local database**, never directly from the network.
2. A sync layer fetches changes from the server and writes them locally; the UI updates reactively.
3. User writes go to the local DB immediately and into an **outbox queue**, which is sent when online.

### Decisions you must make

- **What must work offline?** Often reading recent data and drafting; not everything needs it.
- **Sync strategy**: pull with timestamps or cursors ("changes since X"), push the outbox, and handle partial failures idempotently (client-generated IDs help).
- **Conflicts**: last-write-wins is simple but can lose data; field-level merges or asking the user suit collaborative data. CRDT-based tools solve harder cases.
- **Connectivity awareness**: NetInfo, connectivity_plus or `NWPathMonitor`, but do not trust it fully; the real signal is whether requests succeed.

### Tools

WatermelonDB, PowerSync, and Firestore's offline persistence for React Native; drift plus a custom sync in Flutter; Room with WorkManager on Android; SwiftData with background tasks on iOS.

**Good enough to move on:** your app lets users create items offline, shows them immediately, and syncs them without duplicates when back online.

## Key concepts

- **Local-first reads**
- **Outbox queue for writes**
- **Pull sync with cursors**
- **Idempotency and client IDs**
- **Conflict resolution strategies**
- **Connectivity detection**
- **Sync engines and CRDTs**

## Mini project

Make your expense tracker offline-first: entries added in airplane mode appear instantly, sync when online, and never duplicate on retries.

## Check yourself

Why do client-generated IDs make retrying a queued create request safe?

## Free resources

- [Android: Build an offline-first app](https://developer.android.com/topic/architecture/data-layer/offline-first) (Android Developers)
- [Firestore: Access data offline](https://firebase.google.com/docs/firestore/manage-data/enable-offline) (Firebase)

Previous: [Local Storage: Key-value, SQLite & Files](https://www.internhack.in/roadmaps/tracks/mobile/local-storage) · Next: [Backend-as-a-Service: Firebase & Supabase](https://www.internhack.in/roadmaps/tracks/mobile/baas)

## More in Data: Networking, Storage & Offline-first

- [HTTP & REST APIs for App Developers](https://www.internhack.in/roadmaps/tracks/mobile/http)
- [Networking Clients & Server-state Caching](https://www.internhack.in/roadmaps/tracks/mobile/networking-clients)
- [GraphQL Clients](https://www.internhack.in/roadmaps/tracks/mobile/graphql)
- [Local Storage: Key-value, SQLite & Files](https://www.internhack.in/roadmaps/tracks/mobile/local-storage)
- [Offline-first & Data Synchronisation](https://www.internhack.in/roadmaps/tracks/mobile/offline-first)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [Mobile App Developer Roadmap](https://www.internhack.in/roadmaps/tracks/mobile)
