Repository navigation
How Sync Works
Jimmy Pautz edited this page Nov 20, 2026
·
1 revision
Nimbus is engineered so that multiple offline devices can read, highlight, and sync without ever overwriting each other's data — with zero backend server required.
Under your configured remote root (default /Nimbus):
/Nimbus/
├── Books/
│ └── <Author> - <Title> [<book_id>]/
│ ├── <Filename>.<ext> # Supported: epub, pdf, cbz, mobi, azw3, fb2
│ ├── cover.jpg # Optional JPEG thumbnail (max 400px wide)
│ └── metadata.json # Per-book metadata snapshot
└── _sync/
├── schema_version.json # { "version": 1, "min_client": "0.1.0" }
├── catalog.json # Single-file library index of all books
└── devices/
└── <device_slug>/ # e.g. "Kobo-Libra-2_9f2a", "Web-Browser_1a2b"
├── device.json # Device identity, platform, last_sync_at
├── progress.json # Map: book_id -> latest position & status
├── annotations.json # Map: book_id -> highlights, notes & tombstones
└── sessions/
└── YYYY-MM.json # Monthly reading sessions shard
sequenceDiagram
participant K as KOReader (Kobo_9f2a)
participant C as Cloud (/Nimbus/_sync/devices/)
participant W as Web App (Web_1a2b)
K->>C: Write ONLY to Kobo_9f2a/progress.json
W->>C: Write ONLY to Web_1a2b/progress.json
K->>C: Read ALL sibling device folders
W->>C: Read ALL sibling device folders
Note over K,W: Deterministic merge runs locally on each client
-
Device Shards: A client only writes to its own
_sync/devices/<device_slug>/directory and reads from all sibling device directories. - Because no two devices ever write to the same
progress.json,annotations.json, orsessions/YYYY-MM.json, offline edits never cause file-level race conditions or lost highlights.
Each book in Nimbus receives an immutable 8-character lowercase book_id (e.g., a1b2c3d4). Once assigned, book_id never changes even if you rename the title or author.
Clients match local files to cloud books in this strict priority order:
-
Local Linked
book_id(client link map, Calibrenimbus:<book_id>identifier, or IndexedDB). -
Exact
partial_md5match — sampled 1024-byte reads at KOReader's exact exponential offsets (0,1024,4096, ...,1073741824), producing bit-identical hashes across Lua, Python, and TypeScript. -
Exact
sha256match — full-file SHA-256 digest. -
Fallback Metadata Match — normalized
(title, primary_author)orisbn(prompting confirmation where appropriate).
All three clients (Lua, Python, TypeScript) implement identical merge logic verified against shared golden test fixtures:
| Data Type | Winner / Merge Rule | Notes |
|---|---|---|
| Reading Progress | 1. Highest updated_at (epoch seconds)2. Highest percent3. Lexicographically greatest device_id
|
Ensures the newest reading position always wins deterministically. |
| Highlights & Notes | Grouped by stable id (ann_<10hex>):1. Highest updated_at2. deleted: true wins on tie3. Non-empty note, then device_id
|
Deletions propagate via tombstone records ("deleted": true) so offline devices don't resurrect deleted highlights. |
| Reading Sessions | Deduplicated by (device_id, book_id, start_time)
|
Keeps largest duration_sec, then pages_read; sorted chronologically. |
KOReader and the Web App use different rendering engines (crengine vs. foliate-js / pdf.js):
-
KOReader → KOReader: Uses exact
xpointer(reflowable) orpage(PDF/CBZ). -
Web → Web: Uses exact
cfi(EPUB) orpage(PDF/CBZ). -
KOReader ↔ Web: Seeks to the approximate
percent, then searches nearby text fortext_anchor(a normalized ~40-character snippet around the reading position) to snap to the exact paragraph.
Nimbus — Main Repository · Releases · Web App (PWA) · Report an Issue