Skip to content

Guides

Offline support

Keep your app fully functional without a connection.

On this page

Syndra is local-first: every read and write happens against a local replica, so going offline is just a special case of “slow network”. This guide covers persistence, status indicators and handling long offline sessions.

Enable persistence

Out of the box, replicas live in memory. Add a storage adapter to survive reloads:

ts
import { createClient } from "@syndra/client"
import { indexedDB } from "@syndra/client/storage"

const syndra = createClient({
  project: "acme-notes",
  storage: indexedDB(),
})

Show connection status

ts
syndra.status.subscribe((status) => {
  indicator.dataset.status = status // 'online' | 'connecting' | 'offline'
})

For per-document status, check doc.status 'pending' means there are local changes that haven’t been acknowledged yet.

Reconnecting

When the connection returns, Syndra exchanges version vectors with the server and sends only the operations the other side is missing. Even after days offline, the sync payload is proportional to what changed, not the document size.