Sync / Replicated state

Replicated state: foldkit-sync + foldkit-durable

When users edit data offline, reload the page before a request settles, or collaborate across multiple devices, plain server fetches lose edits or overwrite each other. You need edits to apply immediately in the UI, persist locally across reloads, and converge to one shared order on the server.

foldkit-sync and foldkit-durable solve this by replaying durable application Messages over an authoritative log:

  • foldkit-sync keeps pending edits in a browser outbox, applies them immediately through your update, and rebases them whenever the server commits or rejects operations.
  • foldkit-durable runs on the server, committing operations in one global order in SQLite and deduplicating retries by operation ID.

Your Model, Message, and update stay the single state machine—a durable edit is simply a Message from your existing union recorded in the log. Sync works with any server speaking its exchange protocol, and Durable journals any operation stream.