When to choose worker-sync-db
Short decision guide vs Dexie / idb / hosted sync products. Not a feature bake-off — pick the stack that matches your sync plane.
Prefer worker-sync-db when you need most of
- Offline-capable SPA / PWA data in IndexedDB with TypeScript schema types
- Live updates across tabs via SharedWorker fan-out (no hand-rolled
BroadcastChannel) - Bring-your-own remote sync — your auth, retries, and API (
pull/pushor REST URLs) - Optional React live queries (
worker-sync-db/react)
See the live demo and REST starter.
Prefer Dexie (or similar) when
- Single-tab CRUD is enough and multi-tab SharedWorker sync is not a goal
- You already use Dexie Cloud, Firebase, Supabase realtime, etc. as the sync plane
- You need CRDTs, a rich query DSL, or a large plugin ecosystem first
Hard constraints (do not invent features)
- Browser-only — initialize behind
useEffect/ client entry; no SSRcreateDatabase - Pass
sharedWorkerUrl/dedicatedWorkerUrl(or package defaults) — do not use barenew URL('worker-sync-db/…', import.meta.url)in apps - Same
dbName+ sameschemaon every tab - Safari / some WebViews: no SharedWorker → dedicated fallback; default
crossTabFallback: 'auto'uses BroadcastChannel for livesubscribe(not a shared sync leader). CheckgetWorkerMode()/getCrossTabTransport()/getDiagnostics() - Soft deletes; LWW on
_updatedAt/_version(inspect withonConflict— not CRDT)
Install
bash
npm install worker-sync-dbNext: Getting started · Remote / BYO sync · Architecture