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 ◄── networkTwo 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
- You edit a page locally.
- Yjs produces a compact binary delta of the change.
- The delta is encrypted with your workspace key (AES-256-GCM).
- The encrypted delta is broadcast to connected peers over LAN, WAN, or both.
- Each peer decrypts and merges the delta into their local database.