Developer

Key-Value Storage (kv)

Simple per-applet key-value storage backed by applet-data.

ctx.sdk.kv is a small key-value store scoped to your applet. Use it for lightweight state such as sync timestamps, cursors, or cached flags. It is backed by applet-data/{applet_id}/storage/, so each applet has its own isolated namespace.

Scope required: storage:kv

Usage

await ctx.sdk.kv.set("lastSyncAt", Date.now());
const ts = await ctx.sdk.kv.get<number>("lastSyncAt");
await ctx.sdk.kv.delete("lastSyncAt");
const keys = await ctx.sdk.kv.list({ prefix: "user:" });

get<T> is generic so the stored value comes back typed. list takes an options object with an optional prefix to filter keys.

Manifest configuration

{
  "scopes": [
    "storage:kv"
  ]
}

Notes

  • Storage is backed by applet-data/{applet_id}/storage/, isolated per applet. You cannot read or write another applet’s keys.
  • Values are stored and returned as-is; use the get<T> generic to recover the type you set.
  • For structured per-resource data that needs SQL or migrations, use projectDb or typed entities instead.
  • Storage persists across app restarts and applet updates.