Storage that outlives the browser it was born in.
localStorage disappears the moment a tab, a device, or a factory reset does. PrefsDB doesn't. Hash a phrase into a key, and read the same data back from any device — no server to run, no account to create.
// before — trapped in this browser localStorage.setItem("theme", "dark"); localStorage.getItem("theme"); // after — same shape, works everywhere const db = await PrefsDB.getkey("my-app", [yourPhrase]); db.setItem("theme", "dark"); const { value } = await db.getItem("theme"); // value === "dark", from any browser on any device
PrefsDB bridges the gap between ease of localStorage and a flexibility of a backend.
Key/Value Storage
I created PrefsDB because not all projects warrant a full fledged backend or require centralized control over their users' data.
Cross-Device Data
PrefsDB never sees your phrase, only its hash. No email, no password, nothing stored about who you are.
No-Accounts / No-Logins
- Document data types: key/value, list, file data type
- No logins, no accounts: devs or their user do not create accounts to work with the data.
- Cross-device: restore data on any device or browser.
- Security: - API key bound per-user isolation, - RLS via key isolation - Credentials never leave client/browser, - End-to-end encryption, - No accounts to hack.
- No limits: no 5 MB or other limitations associated with localStorage.
- Offline mode: your apps work when your users go offline
- Optimistic updates: straight out of the box.
- Real-time sync: change a value on one device, get a callback on another
- Magic links: Users still have access to their data when.
- No vendor lock-in: users can import/export their data.
- No-cost: free to devs, free to dev's users, power-user-pays model
- Self-hosted: coming soon
- Developer tools: collect console output from multiple devices/browsers in one place
PrefsDB was built to fill the gap that exists between localStorage convenience and a power of a backend.
| localStorage | Your own backend | PrefsDB | |
|---|---|---|---|
| Works across devices | No | Yes | Yes |
| Survives a wiped device | No | Yes | Yes |
| Storage ceiling | ~5–10MB / origin | whatever you provision | no practical cap |
| Servers you maintain | 0 | 1+ | 0 |
| Accounts your users create | 0 | usually 1 | 0 |
| Cost to developer | 0 | High @ scale | 0 |
| Off-line mode | Yes | No | Yes |
| Optimistic updates | No | No | Yes |
| Multi-device console.log | No | No | Yes |
Add PrefsDB to your project
Domains, lists, filters and expiry are opt-in — use the plain drop-in shape above, or reach for these when your data grows up.
<script src="https://prefsdb.com/prefsdb.v1.min.js"></script>
Initialize the client
Credentials are never stored anywhere and never leave the client. Ideally provided by your user on as-needed basis.
await db = PrefsDB.createkey("name",["s1", "s2"]);
All done. We now read+write data
Settings unique for your user can now be read across multiple devices and browsers.
await db.setValue("theme", "dark"); const R = await db.getValue("theme"); const theme = R.success ? R.value : defaultValue
Structure it when you need to.
Manage your data by with grouping commands, lists, filters and TTL — All data is accessible to your users with UUID links generated on the fly and returned with each response.
await db.domain("prefs").key("theme").write("dark");
await db.list("recent-searches").add("tape delay pedals");
const all = await db.domain("prefs").readAll();
await db.ttl(7).key("invite-code").write(code);
const R = await db.putObject(file)
const R = await db.project("my-game") .subdomain("game-stats") .key("score") .write(200)
const R = await db.putObject(file)
RLS, API token isolation, end-to-end encryption, no accounts
Everything localStorage promised, minus the catch.
Write on your phone, read on your laptop
The same key resolves to the same data anywhere — five minutes or five years later.
Survives a wipe
Data lives on PrefsDB's servers, not in a browser profile a factory reset or cache clear can erase.
Outgrows 5–10MB
That's localStorage's per-origin cap. Store a handful of settings or thousands of list entries — the browser stops being the limit.
Call it straight from client JS
Nothing to provision, deploy, or patch at 2am. The API is the backend.
No login stands in the way
A key comes from hashing a phrase you choose. No email, no password, no signup screen between a user and their data.
Nothing to phish
There's no password database to breach and no account to take over — just an opaque key that only works because you already know the phrase behind it.