What is selfstore?
selfstore is a local-first storage library for browser apps: an automatic working copy in IndexedDB, portable encrypted ZIP backups, durable homes (a disk file, Google Drive, WebDAV, an S3 bucket) and serverless multi-device sync. The front door is one call, selfstore(app): it opens a ready store that owns your data, with saving, syncing and multi-device merge already wired. MIT licensed, TypeScript, ESM, browser-first.
How do I actually start?
npm install selfstore, then: const store = await selfstore("todo-app"); await store.put("todos", { id: "t1", text: "ship it" }); store.all("todos"). That is a working, auto-saving, offline app. Add store.connectDrive / connectFile / connectWebdav / connectS3 for multi-device, and store.protect for end-to-end encryption, one call each.
Where is the data stored, and who can see it?
The working copy lives in IndexedDB, on the device (its collections sealed at rest under a per-device key). Nothing is sent anywhere by default: there is no selfstore server, so nothing could see it. When a backup leaves the device it is encrypted client-side first, so a connected Drive, WebDAV or S3 bucket only ever holds opaque bytes.
Where does createLocalStore live?
One import away. The pull-model store (createLocalStore, indexedDbCache, the targets) lives at the selfstore/advanced subpath; groups at selfstore/groups; the bare merge engine at selfstore/sync. Same install, and store.advanced on a simple store IS that store - the two styles compose.
Do I need a backend or user accounts?
No server is required anywhere in the loop: save, backup, restore and merge all run in the browser. A disk file needs nothing at all. Client-only Google Drive re-consents roughly hourly; a permanent Drive connection needs a small refresh-token broker, documented honestly.
Does it work with React, Svelte or Vue?
Yes, deliberately without adapter packages: store.subscribe() plus a referentially stable store.state binds to any framework in a few lines. The docs show the exact one-liners.
Can other software read the backup files?
Yes. A backup is a standard ZIP with a documented layout: SPEC.md specifies the format independently of the library, with canonical test vectors and a roughly 120-line Python reference reader. Unencrypted backups open in any archive tool.
Is it production-ready?
Yes, and here is what that rests on. The public API has been under semantic versioning since 1.0.0 (23 July 2026): a major is reserved for a change that breaks you, and there has not been one. The file format is stable and specified, and a backup written by any version keeps reading - test vectors pinned at 1.0.0 prove it on every run, and an independent Python reader opens the same files. 814 tests cover the library, including seeded fuzz tests on the merge. It already powers production PWAs.