Skip to Content
Sync & RelayHow Sync Works

How Sync Works

localWiki uses peer-to-peer sync so your team’s wiki stays up to date across devices without uploading anything to a central server. Every byte that leaves your machine is end-to-end encrypted before it hits the network.

CRDT-Based Merging

Under the hood, localWiki represents every page as a Yjs  CRDT document. When two teammates edit the same page at the same time, their changes merge automatically without conflicts. There is no “last write wins” — both edits are preserved.

Device A ──► local edit ──► encrypt ──► send delta Device B ◄── decrypt ◄── receive delta ◄── network

Two Transport Layers

Sync works over two independent channels:

  • LAN (mDNS) — Devices on the same local network discover each other automatically and sync directly. No internet required.
  • WAN (Relay) — For teammates in different locations, an optional relay server facilitates encrypted connections over the internet.

Both channels carry the same encrypted Yjs update payloads. You can use one or both.

The Relay Never Sees Your Content

The relay server acts as a forwarding node. It passes encrypted blobs between peers but has no decryption keys. Even if the relay is compromised, your wiki content remains private.

P2P sync for local first apps means your data stays yours. localWiki never stores plaintext content on any server, ever.

Sync Flow Summary

  1. You edit a page locally.
  2. Yjs produces a compact binary delta of the change.
  3. The delta is encrypted with your workspace key (AES-256-GCM).
  4. The encrypted delta is broadcast to connected peers over LAN, WAN, or both.
  5. Each peer decrypts and merges the delta into their local database.
Last updated on