Skip to main content
The mobile package provides delta synchronization helpers for building offline-first mobile applications. Sync tokens enable efficient incremental updates without re-downloading entire datasets.

Quick Start

Sync Tokens

Sync tokens are opaque strings that encode a timestamp. Clients store the token and send it back on subsequent syncs to receive only changes since that point.

Creating Tokens

Token Methods

Response Header

Sync Request

Parse sync parameters from the client:

Parsing Requests

Request Methods

Delta Response

The Delta type represents changes since the last sync:

Creating Delta Responses

Wrapped Response

Complete Example

Database Schema

Model

Repository

Handler

Conflict Resolution

Handle conflicts when the same item is modified on client and server:

Detecting Conflicts

Resolving Conflicts

Multi-Resource Sync

Sync multiple resource types in a single request:

Client Implementation

iOS (Swift)

Android (Kotlin)

Flutter (Dart)

Best Practices

Use Soft Deletes

Never hard-delete records. Use a deleted_at timestamp so clients can receive deletion events.

Index Updated Timestamps

Ensure updated_at and deleted_at columns are indexed for efficient delta queries.

Handle Large Initial Syncs

For large datasets, paginate initial syncs:

Implement Retry Logic

Clients should retry failed syncs with exponential backoff.

Store Sync State Atomically

Store the sync token only after successfully applying all changes locally.

Next Steps

Push Notifications

Cross-platform push token management

Deep Links

Universal and App Links

API Reference

Complete API documentation