2026-11-18 · Architecture

Local-First Sync Without a Heavyweight Backend

Most personal productivity tools do not need a globally distributed database cluster. What they need is an append-only history of small edits that remains readable decades from now even if the original sync server is long gone.

In GridSync, every mutation is written to a local SQLite table with a hybrid logical clock (HLC) timestamp and a compact entity key. Periodically, the client packs unshipped rows into a compressed segment and uploads it to plain object storage.

CREATE TABLE change_log (
  hlc       TEXT NOT NULL,
  entity_id TEXT NOT NULL,
  field     TEXT NOT NULL,
  value     BLOB,
  device_id TEXT NOT NULL,
  PRIMARY KEY (entity_id, field, hlc)
);

Because each segment is immutable once uploaded, conflict resolution stays deterministic: last-write-wins at the field level with HLC tie-breaking by device ID, while full edit history remains inspectable for recovery.

The payoff is operational simplicity: zero background workers, near-zero idle cost, and instant offline startup on every device.