S
Store

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

HandleStorage classPatternBest for
record()recordKey-value documentsEntities, settings, models
event()eventAppend-only logsAudit trails, event sourcing
blob()blobBinary objectsFiles, images, backups
kv()kvJSON key-value dataFlags, counters, tokens
queue()queueFIFO work queuesJobs and background tasks
search()search_indexText searchDiscoverable content
vector()vector_indexEmbedding searchSemantic retrieval
graph()graphNodes and edgesRelationship models