HomeBlogHow to Synchronize Mobile App Data...

Engineering Guide · 9 min read · October 27, 2026

How to Synchronize Mobile App Data Across Multiple Devices

Syncing mobile data using client timestamps and naive REST overwrites causes silent data loss whenever two devices edit offline. Reliable multi-device sync relies on server-assigned monotonic checkpoints, an idempotent local mutation outbox, soft deletes, and explicit conflict-resolution semantics.

Author
Smit Desai
Published
October 27, 2026
Read time
9 min read
Topic
Mobile Apps
Services
Custom Web · Mobile Apps · All Services

Everything looks synchronized when a single developer tests an app on Wi-Fi with one simulator. The moment a real user opens their account on an iPad on a flight, checks off three tasks, updates a fourth item on their phone over spotty LTE, and reconnects both devices an hour later, naive REST sync silently drops edits, duplicates records, or resurrects deleted rows.

Multi-device synchronization is one of the hardest problems in mobile app development because networks fail mid-flight and device clocks lie. You do not need an exotic distributed database to solve it cleanly—you need four disciplined primitives shared between your local SQLite store and your backend API.

Why Wall-Clock Timestamps Break Sync

The most common anti-pattern in mobile APIs is GET /items?updated_after=2026-04-23T10:00:00Z. It breaks in three ways:

  1. Clock skew: A device with its clock set three minutes ahead stamps an old edit in the future, or an older server transaction commits slightly after a newer updated_at timestamp was generated—causing delta queries to skip rows forever.
  2. In-flight transactions: Two concurrent API writes take 40ms and 120ms to commit. A polling client querying at millisecond 80 advances its updated_after cursor past the slower transaction and never sees it.
  3. Hard deletes vanish: Running DELETE FROM tasks WHERE id = ? leaves no trace for an offline tablet returning three days later.

Replace wall-clock cursors with a server-assigned monotonic sequence (server_seq) and tombstone soft deletes.

The Core Sync Schema (Backend + Local SQLite)

Whether your backend runs PostgreSQL or MySQL and your client runs Flutter (drift / sqflite) or React Native (op-sqlite / WatermelonDB), both sides share the same sync contract:

-- Backend authoritative table (PostgreSQL)
CREATE TABLE project_notes (
    id              UUID PRIMARY KEY,
    account_id      BIGINT NOT NULL,
    title           TEXT NOT NULL,
    body            TEXT NOT NULL,
    version         INTEGER NOT NULL DEFAULT 1,
    server_seq      BIGINT NOT NULL,
    deleted_at      TIMESTAMPTZ,
    updated_by      VARCHAR(64) NOT NULL,
    updated_at      TIMESTAMPTZ NOT NULL DEFAULT NOW()
);

CREATE SEQUENCE global_sync_seq START 1;
CREATE INDEX idx_notes_account_seq ON project_notes (account_id, server_seq);

-- Idempotency ledger to absorb mobile retries safely
CREATE TABLE sync_mutations (
    mutation_id     UUID PRIMARY KEY,
    account_id      BIGINT NOT NULL,
    applied_seq     BIGINT NOT NULL,
    response_body   JSONB NOT NULL,
    created_at      TIMESTAMPTZ NOT NULL DEFAULT NOW()
);

On the mobile device, never mutate synced tables directly from UI buttons and fire HTTP calls in the background without persistence. Write every user intent to a local outbox table inside a single SQLite transaction:

  1. Apply the optimistic change to the local project_notes table so the UI responds in under 16ms—keeping frame budgets clean as outlined in Flutter's performance guidelines and React Native's new architecture.
  2. Insert a row into local pending_mutations with a client-generated UUID (mutation_id), base_version, and serialized payload.
  3. A single background sync worker drains pending_mutations sequentially whenever connectivity is healthy.

Push First, Then Pull: The Two-Step Sync Cycle

Running push and pull in the wrong order causes local pending edits to get overwritten by stale server state mid-sync. Always execute Push -> Pull per sync cycle:

1. Push Local Outbox (POST /api/v1/sync/push)

The client sends a batch of pending mutations with each record's mutation_id and base_version:

{
  "device_id": "ios_9f42c1",
  "mutations": [
    {
      "mutation_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
      "entity": "project_notes",
      "record_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "op": "upsert",
      "base_version": 4,
      "payload": {
        "title": "Site Inspection #42",
        "body": "Replaced breaker panel cover."
      }
    }
  ]
}

Inside one database transaction, the server:

  • Checks sync_mutations for mutation_id. If found, it skips execution and returns the cached response_body (true idempotency).
  • Compares base_version against the current row's version.
  • If base_version == current.version, applies the update, increments version, assigns nextval('global_sync_seq') to server_seq, and records the mutation.
  • If base_version < current.version, applies the configured conflict rule and returns the winning state or conflict marker.

2. Pull Deltas (GET /api/v1/sync/pull?since_seq=18420&limit=200)

Once pending mutations are acknowledged and deleted from the local outbox, the client pulls changes where server_seq > last_pulled_seq ORDER BY server_seq ASC LIMIT 200. It loops until has_more is false, updating last_pulled_seq in SQLite only after each batch commits locally.

Choosing the Right Conflict Resolution Strategy

Different entities inside the same app often need different conflict rules. Pick deliberately rather than defaulting blindly:

Strategy How It Works Strengths Failure Mode / Risk Ideal Use Cases
Server-Ordered Last Write Wins Higher server_seq wins entire row Simple to reason about and audit Concurrent offline edits on separate fields overwrite each other User preferences, profile settings, status flags
Field-Level Merge (changed_fields) Client sends only dirty columns + base_version Preserves non-overlapping edits (e.g., Device A edits title, Device B marks done) Slightly larger mutation payload & merge logic Task managers, CRM records, inspection forms
Append-Only Event Log Mutations are immutable facts (add comment, check in, stock adjustment) Zero overwrite conflicts by design Requires derived projection tables for fast reads Financial ledgers, inventory counts, field logs
CRDTs (Automerge / Yjs) Mathematical merge on every character/tree op Real-time co-editing without central lock High storage overhead, hard schema migrations Collaborative docs, whiteboards, rich notes

For most multi-device B2B and consumer apps, append-only logs for activity/transactions + field-level merge for editable records eliminates 99% of user-visible data loss without the operational complexity of CRDTs.

Handling Real-World Mobile Edge Cases

  • Re-syncing after long offline gaps: Set a retention window on tombstones (for example, 90 days). If a device wakes up with since_seq older than your tombstone purge watermark, return 410 Gone (reset_required: true) so the client runs a clean full snapshot hydration instead of missing old deletions.
  • Large binary attachments: Never block JSON metadata sync on 15MB photo uploads. Sync the attachment record (upload_status: "pending") immediately, upload binaries separately via pre-signed S3/R2 URLs, and patch remote_url once uploaded.
  • Cross-device live nudges: Polling wastes battery. Keep sync authoritative over HTTP push/pull, and use silent push notifications (APNs content-available, FCM data messages) or lightweight WebSockets solely as a wakeup signal saying "new server_seq available—run pull now."
  • Tombstone cleanup without orphan resurrection: Never allow an old offline client to PUT an update to a row whose deleted_at IS NOT NULL unless your product explicitly supports "restore from trash."

Shipping Sync Without Burning Months of Runway

Sync bugs are notoriously expensive to retrofit after launch because every table, local cache, and optimistic UI hook assumes direct online reads. Getting the schema, outbox queue, and sequence cursors right upfront saves weeks of support pain later.

If you need an experienced principal engineer to design or debug your offline and multi-device sync layer, I work directly with product teams at $55/day (8–9 hours of focused engineering) or $1,999/month dedicated delivery—backed by 170+ shipped case studies across global SaaS and mobile products. You can also explore dedicated developer engagement or book a technical architecture review through our launch consulting page.

Building a multi-device mobile app and want a sync protocol that survives real-world networks? Get in touch here with your data model and stack.

Written by Smit Desai · Principal Full-Stack & FDSE

8+ years shipping production systems · 171 case studies · 300+ WordPress servers managed for Finland partners.

Next Steps and Recommended Resources

Next Steps · Recommended Resources

Pillar 1 · Cross-Platform & Native

Mobile App Development Services

Production iOS and Android apps built with Flutter, React Native, Swift, and Kotlin alongside scalable Laravel/Node backends.

Interactive Tool · Estimate Scope

Mobile App Cost Estimator

Calculate week-by-week scope for customer apps, offline sync, push notifications, and App Store / Google Play launches.

01 — Frequently asked questions

mobile apps

Why shouldn't mobile sync rely on client updated_at timestamps?

Phone and tablet clocks drift, users manually change timezones, and offline devices can hold edits for hours. If you compare client timestamps for last-write-wins, a device with a skewed clock can permanently overwrite newer server changes.

When do you actually need CRDTs instead of server-sequenced delta sync?

CRDTs are essential for real-time collaborative text or canvas editing where multiple users mutate the same object simultaneously offline. For 90% of SaaS, field-service, and productivity apps, server-sequenced delta sync with field-level or record-level rules is far simpler to debug and migrate.

How do you sync deleted records across devices that were offline?

Use soft deletes (tombstones) with a deleted_at timestamp and updated server sequence number. Hard-deleting rows prevents offline devices from ever learning that an item was removed when they pull deltas.

How does a local SQLite outbox prevent duplicate mutations on flaky networks?

Every local create, update, or delete gets a client-generated UUID idempotency key in a pending_mutations table. If the network drops right after the server commits but before the phone receives 200 OK, retrying with the same key returns the original result without creating duplicates.

03 — Have an engineering need?

hire the right expertise

Let's talk tech.

Deciding between an embedded forward deployed engineer or a senior full stack developer? Share your technical context and timeline.

Solitaire Corporate Park, Makarba, Ahmedabad, Gujarat 380015, India · IST (UTC+5:30) · --:-- IST · Mon–Fri 09:00–18:00 IST · US & EU overlap daily

No newsletter, no CRM. Just a reply.