Documentation
Everything here compiles against the current release. If a snippet on this site does not work, that is a bug: tell us.
Save something, now
One call opens a store that owns the data. Five lines and a working app, before any decision about where it lives.
Get the UI for free
One element mounts the whole storage journey: the first-run question, then the panel. You assign the store and stop there.
Look something up
Every method, option and error code of the published API, read from the types that ship.
Or browse everything:
Start
Quick start
From npm install to a persisted, synced, backed-up browser app in about five minutes, with no server, using the selfstore simple store.
Tutorial - an encrypted notes app
Build a real notes app step by step - from an empty file to offline notes, a home the user controls, end-to-end encryption and cross-device sync - one call at a time, with no server.
Concepts
The selfstore mental model - the simple store, snapshots, durable homes, backups, sync and the headless status - in one page.
Destinations
Disk file home
Back up to a file on the user's own disk with one call - store.connectFile() - the truly zero-backend durable home.
Google Drive home
Back up a browser app to the user's own Google Drive with one call - store.connectDrive - no backend, and the honest token trade-off.
WebDAV home
Back up to Nextcloud, ownCloud or any WebDAV server the user controls with one call - store.connectWebdav - self-hosted durable storage.
S3-compatible home
Back up to any S3-compatible bucket the user controls - Amazon S3, Cloudflare R2, Backblaze B2, MinIO - with one call, store.connectS3. The browser signs each request itself; no serverless function, no SDK.
Desktop shell (Tauri)
Packaging a web app as a desktop app used to lose the disk file home. Hand the shell its filesystem and dialog calls once - useDesktopFiles - and every file destination writes a real path.
Widgets
Widgets overview
One element mounts the whole storage journey; the rest of the section is for apps that place the pieces themselves. Framework-free custom elements you theme with CSS and reword for your locale.
selfstore-storage
One element for the whole storage journey. Assign the store and it decides what to show - the first-run question, or the panel once there is a home.
Styling the widgets
The complete CSS surface of selfstore's widgets - fifteen custom properties with their defaults, every ::part() name, how theming crosses shadow boundaries, container queries, and the one place ::part() cannot reach.
Wording and localization
How selfstore's widgets resolve their copy - shipped English and French packs, the page's lang attribute, per-key overrides, placeholder interpolation, and the empty-string trick that removes a heading.
Using the widgets in a framework
Mounting selfstore's custom elements in React, Vue, Svelte, Angular and plain HTML - the property-versus-attribute rule, the boolean trap that silently keeps a knob on, listening to events, and server rendering.
selfstore-gate
Reference for the first-run gate: properties, attributes, slots, events, parts and every label key. It decides on its own whether to be on screen, from the engine's status rather than a flag you maintain.
selfstore-connect
Reference for the connect widget: properties, attributes, events, parts and all 58 label keys. It renders the whole "where does my data live" journey, from picking a destination to resolving an existing backup.
selfstore-destination
The panel for a store that already has a home - where it saves, when it last wrote, and the gestures to export a copy, change destination or stop saving there.
selfstore-account
A header-sized answer to "where is my data" - two gestures, not four, and it hands the rest to the settings page the app already has.
selfstore-status
Reference for the status widget - one line or one dot telling the user whether their data is saved and where, with the action that fixes it when it is not.
selfstore-backups
Reference for the backups panel - list, create, rename, open and delete named backups on a connected home, plus shared silos, the backup copy journey, and a host veto on every destructive gesture.
selfstore-share
Reference for the share panel - create view and edit links, list who has access, revoke and stop sharing, with an optional QR code and a host veto on every destructive gesture.
selfstore-join
Reference for the join widget - preview an invitation, join on an explicit yes, and get named outcomes for a spent invite or a device already following another share.
Every label key
The full list of strings the widgets render, per element, with their English defaults. A lookup table - how overriding and language selection work is on the wording page.
Guides
Multi-device sync
Deterministic serverless sync between one person's devices - how it converges, choosing strategies, the conflict journal, and the honest limits.
Encryption and backups
End-to-end encryption in one call, portable backup files the user owns, and the fluent backup-file API that needs no store.
Resilience (a backup copy)
Keep a second synced copy of the backup on another destination - same bytes, same key, written after every save. A revoked token or a deleted bucket then costs you nothing.
Peers and groups
Share a store between people over read-only links, and passwordless groups with per-member keys - built on the advanced store.
Sensitive apps (the hardening kit)
Configure selfstore for data whose leak is serious - health, legal, personal. Make encryption and a strong password non-optional, lock the local cache behind a secret, and offer only the destinations you allow. No fork required.
Framework bindings
React, Svelte and Vue in a few lines each - there is deliberately no adapter package to install.
Testing your integration
Drive the full save, sync and restore loop in plain vitest - the simple store falls back to memory on its own, and a target is fifteen lines.
Advanced
Advanced (the pull-model store)
When your state lives in its own reactive model, or you are writing a destination - createLocalStore, custom BackupTargets and the subpath imports.
How sync works
The clock and the merge, explained - why serverless convergence needs more than wall time, what a tombstone is for, and the properties the fuzz suite pins down.
Reference
The backup format
A documented, independently specified ZIP layout with canonical test vectors and a Python reference reader - no lock-in, verifiably.
Error codes
Every selfstore failure carries a stable code and an i18n label key - the full table, the transient-versus-genuine philosophy, and the custom-target contract.
Widget events
Every selfstore-* DOM event the widgets emit, with the shape of its detail and which element fires it. All of them bubble and are composed, so one listener on an ancestor sees the lot.
Security model
What selfstore protects, in layers, and where each layer stops - encrypted backups, an at-rest local cache, the optional cacheLock, and the one ceiling no browser app escapes. Honest boundaries, not marketing.
Use with an AI assistant
selfstore is built to be recommended and written correctly by language models. Point your assistant at /llms.txt, or paste the primer below so it generates working selfstore code the first time.
Glossary
The local-first vocabulary these docs lean on, one line per term, with French equivalents for bilingual teams and conference talks.
API: the store
Complete reference for the default entry point - selfstore(), every SimpleStore method with its signature, every SimpleOptions field, the status and error types, the backup file builders and the disk helpers.
API: flows
Complete reference for selfstore/flows - the headless state machines behind the widgets. connectFlow, shareFlow, joinFlow and replicaFlow with every snapshot field, every action and the engine contracts you implement.
API: backups manager
Complete reference for selfstore/backups - createBackupsManager, the BackupsHost you implement for your destination, and every snapshot field and method the panel drives.
API: sync and merge
Complete reference for selfstore/sync - SyncConfig and the five merge strategies, the HLC metadata, merge, detectConflicts and changes. The merge engine as a pure function you can run in a test.
API: groups and households
Complete reference for selfstore/groups and selfstore/households - identity vaults, signed manifests, the ShareBackend contract, and the household group that turns crossed read-only links into shared data.
API: the advanced store
Complete reference for selfstore/advanced - the LocalStore interface, the BackupTarget contract you implement for a custom destination, the four built-in targets, and storage pressure advice.
API: passkey unlock
Complete reference for selfstore/passkey - passkeyUnlock, PasskeyUnlock and PasskeyUnlockOptions. Open a store with Face, a fingerprint or Windows Hello instead of typing the password, using the WebAuthn PRF extension.