Local-first storage
Typed collections in IndexedDB with CRUD, indexes, and soft deletes — works offline by default.
Live multi-tab updates and sync to your own API — TypeScript core, optional React hooks.
npm install worker-sync-dbimport {
createDatabase,
defineSchema,
sharedWorkerUrl,
dedicatedWorkerUrl,
} from 'worker-sync-db';
const schema = defineSchema({
todos: { keyPath: 'id', indexes: { byStatus: 'status' } },
});
const db = await createDatabase({
schema,
dbName: 'my-app',
sharedWorker: sharedWorkerUrl,
dedicatedWorker: dedicatedWorkerUrl,
});
await db.put('todos', { id: '1', title: 'Buy milk', status: 'open' });Continue in Getting started or try the live demo in two browser tabs.