Store Classes
Store provides typed handles for records, events, blobs, key-value data, search, vectors, graphs, queues, and more.
Overview
Every Store client exposes typed storage handles, each optimized for a different data pattern. You access them from the client returned by createStore.
Records
Records are key-value documents where each key maps to a JSON object. Records support versioning and conflict resolution during sync. Use records for structured data like user profiles, settings, or entity models.
const projects = store.record("projects");
await projects.put("project:42", {
name: "Store",
status: "active",
members: ["alice", "bob"],
});
const project = await projects.get("project:42");
const activeProjects = await projects.query({ where: { status: "active" } });
Events
Events are append-only log entries. Once written, events are immutable. Use events for audit trails, activity logs, or event-sourcing patterns.
const deploys = store.event("deploys");
await deploys.append({
service: "api",
version: "2.4.1",
triggeredBy: "ci",
});
const recent = await deploys.query({ limit: 10 });
Blobs
Blobs store binary data (files, images, backups). Blob storage supports streaming reads and writes and integrates with adapters like S3 for large object storage.
const backups = store.blob("backups");
await backups.put("backup/2026-05-11.tar.gz", buffer);
const backup = await backups.get("backup/2026-05-11.tar.gz");
Key-Value (KV)
KV is a simple string-to-string store for lightweight data like feature flags, counters, or cached tokens. KV operations are atomic and fast.
const flags = store.kv("flags");
await flags.set("feature:dark-mode", "enabled");
const flag = await flags.get("feature:dark-mode");
await flags.delete("feature:dark-mode");
Choosing the right class
| Handle | Storage class | Pattern | Best for |
|---|---|---|---|
record() | record | Key-value documents | Entities, settings, models |
event() | event | Append-only logs | Audit trails, event sourcing |
blob() | blob | Binary objects | Files, images, backups |
kv() | kv | JSON key-value data | Flags, counters, tokens |
queue() | queue | FIFO work queues | Jobs and background tasks |
search() | search_index | Text search | Discoverable content |
vector() | vector_index | Embedding search | Semantic retrieval |
graph() | graph | Nodes and edges | Relationship models |