Skip to the page

Guides · App patterns

Offline caches & reconnect sync

Mirror permitted rows into local SQLite or IndexedDB, queue idempotent mutations while offline and resolve version conflicts on reconnect.

In the schema
ext::auth::Identity

What you’ll build#

You will add a synced local store, instant offline reads and an ordered mutation outbox to a mobile or web app. Screens render immediately without signal and synchronize pending edits when connectivity returns, while every read and write executes through your deployed EdgeQL queries and the schema’s access policies on the server, so client code never repeats permission checks.

Napalm compiles access rules and constraints inside PostgreSQL on your cluster. Durable commits occur over the network rather than inside a device database. A local store and idempotent outbox give phones, tablets and field browsers instant cold starts and offline drafts while PostgreSQL stays authoritative.

Local SQLite outbox & reconnect bookmark reconciliation

napalm.sync mirrors permitted query rows and the latest Napalm-Bookmark into device SQLite or IndexedDB while an ordered local outbox queues client_mutation_id drafts offline and replays queued drafts sequentially on reconnect.

LayerWhere data livesResponsibility
Synced storeSQLite or IndexedDB on deviceResponsibilityHolds the caller’s rows of one deployed query and the bookmark the rows stand at. Lists open with no network round trip.
Mutation outboxSQLite or IndexedDB on deviceResponsibilityQueues offline creates, edits and archives in commit order and overlays pending drafts onto local reads.
Deployed queriesPostgreSQL on your projectResponsibilityEnforces access policies, deduplicates retried inserts by UUID and checks expected row versions on reconnect.
Live streamPOST /subscribeResponsibilityCarries the changes since the store’s bookmark on each connect, then a patch on each commit. napalm.sync writes each step to the synced store.

Model idempotent writes and versions#

Reliable offline sync starts in dbschema/default.gel. A mobile connection frequently drops after PostgreSQL commits a statement and before the HTTP response reaches the phone. Without an idempotency key and a row version on the type, replaying an outbox entry would duplicate inserts or silently overwrite a teammate’s newer edit.

dbschema/default.gel
using extension auth;using extension napalm; module default {  global caller := global ext::auth::ClientTokenIdentity;   type Note {    required owner: ext::auth::Identity {      default := global caller;      readonly := true;    }    # Client-chosen idempotency key so replaying an outbox entry never duplicates a note.    required client_mutation_id: uuid {      constraint exclusive;    }    required title: str {      constraint max_len_value(200);    }    required body: str;    # Monotonic version checked on offline edits so stale drafts never overwrite newer commits.    required version: int64 {      default := 1;    }    required updated_at: datetime {      default := datetime_of_statement();    }    # Archive time: an archived note leaves listNotes, and the sync drops the note from the device.    deleted_at: datetime;     # Keyset index for the watermark query, for a mirror larger than one result.    index on ((.updated_at, .id));     access policy owner_all      allow all      using (.owner ?= global caller);  }}
client_mutation_id
Generated on the device with crypto.randomUUID() when the person taps Save. The exclusive constraint guarantees that replaying the outbox entry returns the existing row instead of inserting a copy.
version
Starts at 1 and increments on every update. Offline edits send the version the user started editing so concurrent server commits are detected deterministically.
deleted_at
Archive timestamp. An archived note leaves listNotes, and the sync removes the note from the device. The watermark query below reads this column too.
((.updated_at, .id))
Composite keyset index for the watermark query below. A sync alone does not use this index.

Save four deployed queries under dbschema/queries/ and push the set with napalm queries push notes. listNotes is the synced read. The other three queries are the outbox’s writes, and each write returns the committed fields.

dbschema/queries/listNotes.edgeql
# dbschema/queries/listNotes.edgeql# The synced read: every note the caller may see, newest first.select Note {  id,  client_mutation_id,  title,  body,  version,  updated_at,}filter not exists .deleted_atorder by .updated_at desc then .id desc
dbschema/queries/createNoteOffline.edgeql
# dbschema/queries/createNoteOffline.edgeql# Replaying the same $mutation_id after a dropped cellular response returns the existing row.select (  insert Note {    client_mutation_id := <uuid>$mutation_id,    title := <str>$title,    body := <str>$body,  }  unless conflict on .client_mutation_id  else (select Note)) {  id,  client_mutation_id,  title,  body,  version,  updated_at,  deleted_at,}
dbschema/queries/saveNoteVersioned.edgeql
# dbschema/queries/saveNoteVersioned.edgeql# Returns zero rows when another device committed a newer version while this device was offline.select (  update Note  filter .id = <uuid>$id    and .version = <int64>$expected_version    and not exists .deleted_at  set {    title := <str>$title,    body := <str>$body,    version := .version + 1,    updated_at := datetime_of_statement(),  }) {  id,  client_mutation_id,  title,  body,  version,  updated_at,  deleted_at,}
dbschema/queries/archiveNoteVersioned.edgeql
# dbschema/queries/archiveNoteVersioned.edgeqlselect (  update Note  filter .id = <uuid>$id    and .version = <int64>$expected_version    and not exists .deleted_at  set {    deleted_at := datetime_of_statement(),    version := .version + 1,    updated_at := datetime_of_statement(),  }) {  id,  version,  updated_at,  deleted_at,}

Sync permitted rows to the device#

napalm.sync keeps a store on the device equal to the result of a deployed query. The subscription names the deployed query, so the sync works under --passthrough none. A screen shows the store’s rows at once and opens with no network.

The store keeps the bookmark the rows stand at. On each connect, the subscription passes that bookmark and the project sends only the delta: updated notes in full alongside the complete list of matching IDs. A note archived, deleted or hidden by an access policy while the device was offline is missing from those IDs and leaves the store. Later patch frames update the store by id and move the bookmark forward. A store with no rows yet takes the whole result.

src/offline/store.ts
// src/offline/store.tsimport { sqliteSyncStore } from 'napalm-client/expo'import * as SQLite from 'expo-sqlite' export const localDb = SQLite.openDatabaseSync('napalm-offline.db') // The rows of listNotes. The store keeps them in two tables of its own.export const notesStore = sqliteSyncStore(localDb, 'notes') localDb.execSync(`  CREATE TABLE IF NOT EXISTS mutation_outbox (    seq INTEGER PRIMARY KEY AUTOINCREMENT,    mutation_id TEXT UNIQUE NOT NULL,    kind TEXT NOT NULL,    target_id TEXT NOT NULL,    expected_version INTEGER,    title TEXT NOT NULL,    body TEXT NOT NULL,    status TEXT NOT NULL DEFAULT 'pending',    error_message TEXT  );   CREATE TABLE IF NOT EXISTS local_owner (    id INTEGER PRIMARY KEY CHECK (id = 1),    identity_id TEXT NOT NULL  );`) export type SyncedNote = {  id: string  title: string  body: string  version: number} export type VisibleNote = SyncedNote & {  syncState: 'synced' | 'pending' | 'conflict'  errorMessage: string | null} /** Lays pending outbox entries over the synced rows, so offline edits show at once. */export function readVisibleNotes(synced: readonly SyncedNote[]): VisibleNote[] {  const queued = localDb.getAllSync<{    kind: string    target_id: string    title: string    body: string    expected_version: number | null    status: 'pending' | 'conflict'    error_message: string | null  }>("SELECT kind, target_id, title, body, expected_version, status, error_message FROM mutation_outbox ORDER BY seq ASC")   const byId = new Map<string, VisibleNote>(    synced.map((row) => [row.id, { ...row, syncState: 'synced', errorMessage: null }]),  )   for (const entry of queued) {    if (entry.kind === 'archive' && entry.status === 'pending') {      byId.delete(entry.target_id)      continue    }    byId.set(entry.target_id, {      id: entry.target_id,      title: entry.title,      body: entry.body,      version: entry.expected_version ?? 1,      syncState: entry.status,      errorMessage: entry.error_message,    })  }  return [...byId.values()]}
src/NotesScreen.tsx
// src/NotesScreen.tsximport { deployed } from 'napalm-client'import { useSyncedQuery } from 'napalm-client/react'import { FlatList, Text, View } from 'react-native'import { notesStore, readVisibleNotes, type SyncedNote } from './offline/store' const listNotes = deployed<SyncedNote>('listNotes') export function NotesScreen() {  // The stored rows at once, then the project's. Every step lands in SQLite too.  const { rows = [], isStored, error } = useSyncedQuery(listNotes, {}, notesStore)  const notes = readVisibleNotes(rows)   return (    <View>      {isStored && <Text>Showing saved notes</Text>}      {error && <Text>{error.message}</Text>}      <FlatList data={notes} keyExtractor={(note) => note.id} renderItem={({ item }) => <Text>{item.title}</Text>} />    </View>  )}
isStored
True while the rows on screen come from the store. The flag turns false at the project’s first result. Show a saved-copy hint while the flag is true.
napalm.sync
The same rows outside React: napalm.sync(query, variables, store, { onRows, onError }). Call close() on the returned subscription to stop the sync.
Stores
sqliteSyncStore(db, name) from napalm-client/expo keeps rows in two expo-sqlite tables named napalm_sync_rows and napalm_sync_stores. indexedDbSyncStore(name) keeps rows in the browser’s IndexedDB. memorySyncStore() keeps rows in memory for tests.
One store per query
Two screens that sync one query with the same variables share one subscription and one store. A second store for that query is refused, and so is one store for two queries.
Refusals
A count or another result without object ids is refused with ids_required. A refusal leaves the store unchanged. The rows on screen stay.

Flutter#

napalm_client syncs into any SyncStore. The package depends on no database, so the adapter lives in your app. This adapter keeps rows in sqflite. A drift adapter implements the same four methods.

lib/services/sqflite_sync_store.dart
// lib/services/sqflite_sync_store.dartimport 'dart:convert'; import 'package:napalm_client/napalm_client.dart';import 'package:sqflite/sqflite.dart'; /// One synced query's rows in SQLite, under [name].class SqfliteSyncStore implements SyncStore {  SqfliteSyncStore(this.db, this.name);   final Database db;  final String name;   /// Makes the two tables every store shares. Call it from openDatabase's onCreate.  static Future<void> createTables(Database db) async {    await db.execute(      'CREATE TABLE sync_rows (store TEXT NOT NULL, id TEXT NOT NULL, row TEXT NOT NULL, PRIMARY KEY (store, id))',    );    await db.execute(      'CREATE TABLE sync_stores (store TEXT PRIMARY KEY NOT NULL, bookmark TEXT NOT NULL, ids TEXT NOT NULL)',    );  }   @override  Future<StoredRows?> read() async {    final kept = await db.query('sync_stores', where: 'store = ?', whereArgs: [name]);    if (kept.isEmpty) return null;    final order = (jsonDecode(kept.single['ids'] as String) as List).cast<String>();    final places = {for (final (index, id) in order.indexed) id: index};    final rows = [      for (final stored in await db.query('sync_rows', where: 'store = ?', whereArgs: [name]))        jsonDecode(stored['row'] as String) as Map<String, Object?>,    ]..sort((a, b) => (places[a['id']] ?? order.length).compareTo(places[b['id']] ?? order.length));    return (rows: rows, bookmark: kept.single['bookmark'] as String);  }   @override  Future<void> apply({    required List<Map<String, Object?>> changed,    required List<String> removed,    List<String>? order,    required String bookmark,  }) => db.transaction((txn) async {    final batch = txn.batch();    for (final id in removed) {      batch.delete('sync_rows', where: 'store = ? AND id = ?', whereArgs: [name, id]);    }    for (final row in changed) {      _put(batch, row);    }    batch.update(      'sync_stores',      {'bookmark': bookmark, if (order != null) 'ids': jsonEncode(order)},      where: 'store = ?',      whereArgs: [name],    );    await batch.commit(noResult: true);  });   @override  Future<void> replace(List<Map<String, Object?>> rows, String bookmark) => db.transaction((txn) async {    final batch = txn.batch()..delete('sync_rows', where: 'store = ?', whereArgs: [name]);    for (final row in rows) {      _put(batch, row);    }    batch.insert('sync_stores', {      'store': name,      'bookmark': bookmark,      'ids': jsonEncode([for (final row in rows) row['id']]),    }, conflictAlgorithm: ConflictAlgorithm.replace);    await batch.commit(noResult: true);  });   @override  Future<void> clear() => db.transaction((txn) async {    final batch = txn.batch()      ..delete('sync_rows', where: 'store = ?', whereArgs: [name])      ..delete('sync_stores', where: 'store = ?', whereArgs: [name]);    await batch.commit(noResult: true);  });   void _put(Batch batch, Map<String, Object?> row) => batch.insert('sync_rows', {    'store': name,    'id': row['id'],    'row': jsonEncode(row),  }, conflictAlgorithm: ConflictAlgorithm.replace);}
lib/pages/notes_page.dart
// lib/pages/notes_page.dart (the page's state)late final StreamSubscription<SyncedRows<ListNotesDataItem>> _notes;SyncedRows<ListNotesDataItem>? _synced; @overridevoid initState() {  super.initState();  // The stored rows at once, then the project's. Every step lands in SQLite too.  _notes = widget.napalm      .sync(        const LiveQuery.deployed('listNotes'),        widget.notesStore,        decode: (row) => ListNotesDataItem.fromJson(row as Map<String, dynamic>),      )      .listen((synced) => setState(() => _synced = synced));} @overridevoid dispose() {  unawaited(_notes.cancel());  super.dispose();}

Watermark pages for a large mirror#

Use a watermark query when a local mirror exceeds one subscription’s 16 MiB result limit, or when the project’s cluster keeps no change log and each reconnect sends the whole result. notesSince pages forward from a persisted (since_time, after_id) cursor and transfers only rows updated after that position. Because notesSince is an ordinary deployed query, it works under --passthrough none.

A watermark query returns only rows the caller may still read. Archive removed notes with deleted_at rather than hard-deleting rows so deletions appear in the delta page. Rows newly hidden by an access policy change remain in local storage until the next full resync.

dbschema/queries/notesSince.edgeql
# dbschema/queries/notesSince.edgeql# Keyset watermark page across active and soft-deleted rows permitted for the caller.select Note {  id,  client_mutation_id,  title,  body,  version,  updated_at,  deleted_at,}filter (.updated_at, .id) > (<datetime>$since_time, <uuid>$after_id)order by .updated_at asc then .id asclimit <int64>$limit
src/offline/watermarkMirror.ts
// src/offline/watermarkMirror.tsimport { isGap } from 'napalm-client'import { db, napalm } from '../lib/napalm'import { localDb } from './store' // A watermark mirror keeps tables of its own beside the outbox.localDb.execSync(`  CREATE TABLE IF NOT EXISTS mirror_notes (    id TEXT PRIMARY KEY NOT NULL,    client_mutation_id TEXT UNIQUE NOT NULL,    title TEXT NOT NULL,    body TEXT NOT NULL,    version INTEGER NOT NULL,    updated_at TEXT NOT NULL  );   CREATE TABLE IF NOT EXISTS sync_cursor (    feed TEXT PRIMARY KEY NOT NULL,    since_time TEXT NOT NULL,    after_id TEXT NOT NULL,    log_bookmark TEXT  );`) const ZERO_TIME = '1970-01-01T00:00:00Z'const ZERO_UUID = '00000000-0000-0000-0000-000000000000' /** Pulls committed inserts, edits and soft-deletes using deployed queries under passthrough: none. */export async function pullNotesWatermark() {  const cursor = localDb.getFirstSync<{ since_time: string; after_id: string }>(    "SELECT since_time, after_id FROM sync_cursor WHERE feed = 'notes'",  ) ?? { since_time: ZERO_TIME, after_id: ZERO_UUID }   let sinceTime = cursor.since_time  let afterId = cursor.after_id   for (;;) {    const { data, error } = await db.POST('/query/notesSince', {      body: { variables: { since_time: sinceTime, after_id: afterId, limit: 250 } },    })    if (error) throw new Error(error.error.message ?? error.error.code)    const batch = data.data    if (batch.length === 0) break     const last = batch[batch.length - 1]    localDb.withTransactionSync(() => {      for (const row of batch) {        if (row.deleted_at) {          localDb.runSync('DELETE FROM mirror_notes WHERE id = ?', [row.id])        } else {          localDb.runSync(            `INSERT INTO mirror_notes (id, client_mutation_id, title, body, version, updated_at)             VALUES (?, ?, ?, ?, ?, ?)             ON CONFLICT(id) DO UPDATE SET               title = excluded.title,               body = excluded.body,               version = excluded.version,               updated_at = excluded.updated_at`,            [row.id, row.client_mutation_id, row.title, row.body, row.version, row.updated_at],          )        }      }      localDb.runSync(        `INSERT INTO sync_cursor (feed, since_time, after_id) VALUES ('notes', ?, ?)         ON CONFLICT(feed) DO UPDATE SET since_time = excluded.since_time, after_id = excluded.after_id`,        [last.updated_at, last.id],      )    })    sinceTime = last.updated_at    afterId = last.id  }} /** Optional tail over GET /changes when endpoint passthrough permits authenticated callers. */export async function tailChangeLog() {  const saved = localDb.getFirstSync<{ log_bookmark: string | null }>(    "SELECT log_bookmark FROM sync_cursor WHERE feed = 'notes'",  )  const start = saved?.log_bookmark    ? { after: saved.log_bookmark }    : { since: new Date(Date.now() - 60_000).toISOString() }   for await (const page of napalm.changes({ types: ['Note'], ...start, limit: 250 })) {    let needsFullPull = false    for (const item of page.items) {      if (isGap(item) || !item.has_every_row) {        needsFullPull = true        continue      }      for (const row of item.rows) {        if (row.op === 'delete') {          localDb.runSync('DELETE FROM mirror_notes WHERE id = ?', [row.id])        }      }    }    if (needsFullPull) await pullNotesWatermark()    if (page.next) {      localDb.runSync("UPDATE sync_cursor SET log_bookmark = ? WHERE feed = 'notes'", [page.next])    }  }}

Queue and replay offline writes#

When the person creates or edits a note, write an entry to mutation_outbox first and render the merged list immediately. Trigger flushOutbox() right away when online, and again whenever network reachability or foreground state returns.

src/offline/outbox.ts
// src/offline/outbox.tsimport { db } from '../lib/napalm'import { localDb } from './store' export function enqueueNoteCreate(mutationId: string, title: string, body: string) {  localDb.runSync(    `INSERT INTO mutation_outbox (mutation_id, kind, target_id, expected_version, title, body)     VALUES (?, 'create', ?, NULL, ?, ?)`,    [mutationId, mutationId, title, body],  )} export function enqueueNoteEdit(mutationId: string, noteId: string, expectedVersion: number, title: string, body: string) {  localDb.runSync(    `INSERT INTO mutation_outbox (mutation_id, kind, target_id, expected_version, title, body)     VALUES (?, 'update', ?, ?, ?, ?)`,    [mutationId, noteId, expectedVersion, title, body],  )} /** Replays pending offline mutations in commit order and isolates policy or version conflicts. */export async function flushOutbox(): Promise<void> {  const pending = localDb.getAllSync<{    seq: number    mutation_id: string    kind: 'create' | 'update' | 'archive'    target_id: string    expected_version: number | null    title: string    body: string  }>("SELECT seq, mutation_id, kind, target_id, expected_version, title, body FROM mutation_outbox WHERE status = 'pending' ORDER BY seq ASC")   for (const item of pending) {    if (item.kind === 'create') {      const { data, error } = await db.POST('/query/createNoteOffline', {        body: { variables: { mutation_id: item.mutation_id, title: item.title, body: item.body } },      })      if (error) {        if (error.error.code === 'query_failed' || error.error.code === 'invalid_request') {          markConflict(item.seq, error.error.message ?? error.error.code)          continue        }        // Network or 503 availability error: leave pending and retry on the next reconnect.        return      }      const committed = data.data[0]      localDb.withTransactionSync(() => {        // Rewrite any queued follow-up edits that targeted the temporary offline UUID.        localDb.runSync('UPDATE mutation_outbox SET target_id = ? WHERE target_id = ?', [          committed.id,          item.mutation_id,        ])        localDb.runSync('DELETE FROM mutation_outbox WHERE seq = ?', [item.seq])      })      continue    }     if (item.kind === 'update') {      const { data, error } = await db.POST('/query/saveNoteVersioned', {        body: {          variables: {            id: item.target_id,            expected_version: item.expected_version!,            title: item.title,            body: item.body,          },        },      })      if (error) {        if (error.error.code === 'query_failed' || error.error.code === 'invalid_request') {          markConflict(item.seq, error.error.message ?? error.error.code)          continue        }        return      }      if (data.data.length === 0) {        markConflict(item.seq, 'Another device saved a newer version while this device was offline.')        continue      }      localDb.runSync('DELETE FROM mutation_outbox WHERE seq = ?', [item.seq])    }  }   // The open sync receives each committed note as a patch. Each replayed write also moved napalm.bookmark,  // so a sync opened later starts at or past the last write.} function markConflict(seq: number, message: string) {  localDb.runSync("UPDATE mutation_outbox SET status = 'conflict', error_message = ? WHERE seq = ?", [    message,    seq,  ])}
Sequential replay
Replay outbox entries one at a time in seq order rather than with Promise.all so an offline create finishes before a queued edit to that same note runs.
Temporary IDs
Offline creates use mutation_id as the temporary local note ID. Once createNoteOffline returns the server id, rewrite target_id on any later queued edits in the same local transaction.
Read-your-writes
db uses napalm.fetch, so every replayed write moves napalm.bookmark forward. The open sync receives each committed note as a patch. A sync opened later starts at or past the last write.

Resolve conflicts and refused writes#

Offline writes run against the current server state when replayed, which may be minutes or hours after the person drafted the change. Separate transient network drops from deterministic server refusals so one stale draft never blocks newer items behind it in the outbox.

Replay outcomeCauseOutbox action
Network error or 503Device entered an elevator, tunnel or brief cluster failover.Outbox actionKeep status = pending and stop flushOutbox(). Retry with backoff or on the next connectivity event.
400 query_failedAn access policy revoked write permission (for example, workspace admin removed the member) or a schema constraint failed.Outbox actionMark the entry status = conflict with error.message and continue replaying unrelated items.
Empty update resultAnother device committed a newer version or archived the row while this device was offline.Outbox actionMark the entry status = conflict. The synced store already holds the server version. Let the person keep the local draft or accept the server version.
401 invalid_sessionThe user’s session expired and refresh token was revoked while offline.Outbox actionPause outbox replay without deleting pending drafts until the same identity_id signs back in.

Clear local storage on sign-out#

NapalmClient clears every open sync store automatically when the active session changes, signs in or signs out, whereas closed sync stores and your mutation_outbox table keep rows on disk until your app clears those tables. Route sign-out through signOut() below to wipe local tables first, and call bindLocalOwner() on startup so a shared device clears prior data whenever a different identity_id signs in.

src/offline/localOwner.ts
// src/offline/localOwner.tsimport { signIn } from '../lib/napalm'import { localDb, notesStore } from './store' /** Deletes the synced rows and the unsent drafts on this device. */export async function wipeLocal() {  localDb.execSync('DELETE FROM mutation_outbox; DELETE FROM local_owner;')  await notesStore.clear()} /** Signs out and leaves nothing of the person on the device. */export async function signOut() {  await wipeLocal()  await signIn.signOut()} /** Wipes the device when a different person signs in. The same person keeps their unsent drafts. */export function bindLocalOwner() {  return signIn.onChange((session) => {    if (!session) return    const owner = localDb.getFirstSync<{ identity_id: string }>('SELECT identity_id FROM local_owner')    if (owner?.identity_id === session.identity_id) return    void wipeLocal().then(() =>      localDb.runSync('INSERT OR REPLACE INTO local_owner (id, identity_id) VALUES (1, ?)', [session.identity_id]),    )  })}

The local_owner row names the person whose drafts the device holds. A session that expires and comes back as the same person keeps the unsent drafts. A different person on a shared tablet starts with an empty device.

Check offline sync in airplane mode#

  1. Cold-launch the app in airplane mode

    Sign in once while online so the sync fills napalm_sync_rows. Force-quit the app, enable airplane mode and reopen the app. The notes list renders from SQLite with zero network requests, and isStored is true.

  2. Archive a note on the web while the phone is offline

    Take the phone offline and archive a note on the web app. Reconnect the phone. The first patch after the reconnect leaves the note’s id out of order, and the note leaves the list and the store in the same step.

  3. Create and edit the same note while offline

    Add a note and edit that note’s body while airplane mode stays on. readVisibleNotes(rows) shows the note with syncState: 'pending'. Disable airplane mode and watch flushOutbox() create the note, rewrite target_id, apply the follow-up edit and clear the pending badge.

  4. Replay an already-committed create

    Call createNoteOffline twice with the same mutation_id from napalm call. Both calls return the single Note UUID without duplicating the row.

  5. Trigger a version conflict across two devices

    Take the phone offline, edit a note on the web app so version advances to 2, then edit the same note on the offline phone at expected_version: 1 and reconnect. saveNoteVersioned returns zero rows, and the phone surfaces the conflict state instead of overwriting the web edit.

  6. Sign out and inspect local SQLite

    Call signOut() from localOwner.ts. Confirm napalm_sync_rows, napalm_sync_stores and mutation_outbox all report zero rows.

Next steps#

React Native
Pair Expo Keychain sessions, foreground live queries and resumable disk uploads with SQLite caching.
Flutter
Wire generated Dart Chopper clients, lifecycle-aware streams and local SQLite mirrors on iOS and Android.
Realtime & collaboration
Combine optimistic UI updates, fractional list ordering and live presence rooms while online.
Warehouse sync
Run server-to-server change-log replication with read-only service keys and webhook wakeups.

Type a word or two to search every docs page.