A localstorage alternative for AI coded apps.
No-accounts no-backend database for when full backend is too much, but local storage is not enough. You get: cross-device data, SSO, key/value, lists, maps, file storage, optimistic updates, off-line mode.
| 1 | |
| 2 | <!-- include prefsdb in your project --> |
| 3 | <script src="https://prefsdb.com/prefsdb.v1.min.js"></script> |
| 4 |
| 5 | // mint a key from a phrase only your user knows (first run: PrefsDB emails |
| 6 | // a one-time confirmation link - a security measure overridable by site owners) |
| 7 | |
| 8 | const db = await PrefsDB.getkey("my-app", ["email","passwd"], { email }); |
| 9 |
| 10 | // write a value |
| 11 | await db.setItem("theme", "dark"); |
| 12 | |
| 13 | // read a value, value === "dark" on any browser on any device |
| 14 | const { value } = await db.getItem("theme"); |
- setValue/getValue
- Lists & Maps
- File Storage
- SSO
- Undo & History
- Pub/Sub Channels
- TTL
- Off-line Mode
- Optimistic Updates
- Client-side encryption
When a traditional backend is too much but localStorage is not enough
True serverless "backend"
PrefsDB fills the gap between the convenience of localStorage and backend's flexibility.
You get data persisted across devices, secure object storage, offline mode, optimistic updates, key/value, lists, maps, and more.
No accounts ‐ no sign-ups
Many people feel strong aversion to creating ever more accounts. Many things actually do not warrant an account - but still need to store data. PrefsDB offers a new concept where devs can offer account-like functionality without creating accounts at the backend.
Outgrow local storage
Local in-browser storage APIs can be great but they suffer from significant trade-offs:
❌ 5-10MB storage limit,
❌ data loss on device wipe,
❌ no cross-device persistence,
❌ main thread blocking
Prefsdb fixes that. 👉 Learn more...
No cost to devs
✅ PrefsDB is free for developers. Every user of your app gets their own API key, and every key comes with a free allowance of requests and storage.
✅ Your costs don't grow with your user count: whether your app has 1 user or 1 million, it costs you nothing to run.
Your users own their data and they decide how to handle it — if at all — all depending on your app's goals.
👉 Learn more.
More than a basic key/value store.
Lists & Maps
Collections like list.add() , map.put() offer flexibility beyond basic key/value storage.
File storage
File uploads API stores all files encrypted with a embeddable link.
Undo & history
Turn on value history and undo() pops the most recent writes back.
Pub/sub channels
Publish to a named channel, subscribe from any device — lightweight, poll-based realtime.
Time-to-live
.ttl(7) expires a key automatically — invite codes, one-time tokens, caches.
Security
Your users' data is secure with multiple encryption levels: at-rest, in-transit, client-side encryption.
Off-line mode
Spotty connections, no WI-FI — your users will appreciate working apps even when offline.
Optimistic updates
Your apps will feel very fast ad responsive with optimistic updates feature.
Made for AI
Easy for humans — perfect for LLMs. Plain HTTP query params in, JSON out — no SDK to install and no auth wall beyond a header. A coding agent can go from docs to a working call without guessing.
- llms.txt — a machine-readable map of every doc page, built for LLMs and coding agents
- Every endpoint's request/response shape and error codes are documented in markdown any AI agent can understand.
- prefsdb.v1.js is unminified — a model can read the client source directly instead of guessing at behavior
- Tell your AI agent to read https://prefsdb.com/llms.txt to get going.
| 1 | # keep your agent's state between runs: plain HTTP, no SDK |
| 2 | # 1. end of a run: save where it left off |
| 3 | curl -s "https://prefsdb.com/api/v1/write/?last_task" \ |
| 4 | -H "X-Authorization: Token $PREFSDB_SERVER_KEY" \ |
| 5 | -H "Content-Type: text/plain" \ |
| 6 | --data-binary "refactored auth module, tests pass, next: docs" |
| 7 | |
| 8 | # 2. start of the next run, on any machine: pick it back up |
| 9 | curl -s "https://prefsdb.com/api/v1/read/?last_task" \ |
| 10 | -H "X-Authorization: Token $PREFSDB_SERVER_KEY" |
| 11 | # -> { "value": "refactored auth module, tests pass, next: docs", |
| 11 | # -> "count": 1, ... } |
A faster approach to storing data.
PrefsDB offers a different approach to traditional backend flow. User provided credentials automatically become a unique API token by which all of that user's data is gated. Your write your app as if for a single user. PrefsDB will do all the rest.- Hands-off approach — No setting up accounts for your users, no responsibility for handling their data.
- PrefsDB only works with the hashes of the token seed — credentials never leave the client side
- User-pays model shifts responsibility to the user.
- Files and all data at-rest are encrypted by default.
- PrefsDB can be used in GDRP compliant manner.
| 1 | // three steps: add the script, mint a key, read/write |
| 2 | const db = await PrefsDB.createkey("my-app", ["s1", "s2"], { email }); |
| 3 | |
| 4 | await db.domain("prefs").key("theme").write("dark"); |
| 5 | await db.list("recent-searches").add("tape delay pedals"); |
| 6 | const all = await db.domain("prefs").readAll(); |
Lists, maps, keys and values
Something about how most tasks need those three basic data storage types. They are searchable, redundant, secure - all with no backend.
- Secure — all values are stored encrypted at-rest by default.
- No vendor lock-in — all data belongs to you or your users. Download all data at any time via dashboard links or via the API.
- Offline mode — your users will not loose data just because they lost their Wi-Fi. Your app will continue as if nothing happened.
- Delightfully fast — with optimistic updates your app's UI will feel super fast and responsive.
- AI Ready — Tell your AI agent to read https://prefsdb.com/llms.txt to get started with PrefsDB.
| 1 | <!-- add to a list --> |
| 2 | await db.list("users").add("name"); |
| 3 | |
| 4 | <!-- get a list --> |
| 5 | const { names } = await db.list("users").read(); |
| 6 | |
| 7 | <!-- filtered read from a list --> |
| 8 | const { names } = await db.list("users").match("%yahoo.com").read(); |
| 1 | <!-- add to a map --> |
| 2 | await db.map("settings").key("theme").write("dark"); |
| 3 | |
| 4 | <!-- read a value from a map --> |
| 5 | const { theme } = await db.map("settings").key("theme").read(); |
| 6 | |
| 7 | <!-- get the whole map --> |
| 8 | const { entries } = await db.map("settings").read(); |
| 1 | <!-- set a key value --> |
| 2 | await db.key("level").write(2); |
| 3 | |
| 4 | <!-- read a key value --> |
| 5 | const { level } = await db.key("level").read(); |
| 6 | |
| 7 | <!-- read all values --> |
| 8 | const { value } = await db.project("project-name").readAll(); |
Data dashboards
Every API key receives a unique dashboard link allowing your users to review their data, search it, create backups, and manage quota limits. It is an optional step - it is up to you to expose this functionality to your users in your app.