Adapters
Pluggable storage backends that let you swap between SQLite, Postgres, S3, and P2P without changing application code.
What is an adapter?
An adapter is a storage backend implementation that conforms to the Store adapter interface. Your application code uses storage handles such as store.record("users") or store.blob("media"), while the active profile decides which local and remote adapters back each storage class.
import { createStore } from "@cuitty/store/client";
const store = await createStore({
module: "app",
profile: {
id: "team",
name: "Team",
local: { adapter: "local.sqlite", path: ".cuitty/store/app.sqlite" },
remotes: [{ id: "records", adapter: "postgres.record", dsnRef: "secret://pg" }],
routes: [{ namespace: "users", class: "record", localAdapter: "local.sqlite", remoteAdapters: ["records"] }],
encryption: { atRest: "preferred", remote: "required", p2p: "disabled" },
sync: { mode: "manual" },
},
schema: { users: { class: "record" } },
});
await store.record("users").put("user:1", { name: "Alice" });
Adapter registry
Store discovers built-in adapters through the adapter registry. Inspect exact adapter IDs, delivery modes, and supported classes from the public catalog.
import { listAdapters, testAdapter } from "@cuitty/store/adapters";
const adapters = listAdapters();
const postgres = await testAdapter("postgres.record", {
dsnRef: "secret://store/postgres/url",
});
Capability matrix
Not every adapter supports every store class. The capability matrix shows what each built-in adapter provides:
| Adapter ID | Records | Events | Blobs | KV | Sync |
|---|---|---|---|---|---|
local.sqlite | Yes | Yes | Yes | Yes | Local |
postgres.record | Yes | Yes | No | Yes | Proxy / native |
s3.blob | No | No | Yes | No | Object |
p2p.libp2p | Yes | Yes | Yes | Yes | P2P |
See the complete Adapter Matrix for every adapter and storage class.
Choosing an adapter
- SQLite is the default for local-first applications. Zero configuration, embedded, WAL-mode for concurrent reads.
- Postgres is suited for server-side workloads or when you need full-text search and relational queries.
- S3 (and S3-compatible services like R2) handles large binary objects.
- P2P enables direct device-to-device replication over libp2p without a central server.
See the individual adapter guides for detailed setup instructions.