Convex component: convex-deployment-kv
  • TypeScript 100%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
phantasy 9094518800 Merge audit remediation
Merge verified audit remediation changes into canonical main.
2026-09-27 01:05:57 +00:00
dist feat: standalone Convex KV component without host auth coupling 2026-09-11 18:33:40 -04:00
example docs: add example app and GitHub homepage for the Convex directory 2026-09-11 18:46:07 -04:00
src merge main with audit remediation coverage 2026-09-26 21:02:32 -04:00
.gitignore chore: publish-ready Convex component package metadata 2026-07-05 17:42:22 -04:00
LICENSE feat: standalone Convex KV component without host auth coupling 2026-09-11 18:33:40 -04:00
package-lock.json feat: standalone Convex KV component without host auth coupling 2026-09-11 18:33:40 -04:00
package.json docs: add example app and GitHub homepage for the Convex directory 2026-09-11 18:46:07 -04:00
README.md feat: standalone Convex KV component without host auth coupling 2026-09-11 18:33:40 -04:00
tsconfig.build.json chore: publish-ready Convex component package metadata 2026-07-05 17:42:22 -04:00
tsconfig.json chore: publish-ready Convex component package metadata 2026-07-05 17:42:22 -04:00
vitest.config.ts feat: standalone Convex KV component without host auth coupling 2026-09-11 18:33:40 -04:00

convex-deployment-kv

Tenant-scoped key-value store for Convex: TTL, optimistic revision CAS, and JSON prefix queries.

This is a Convex component. Install it with app.use(...). Call it from your app's queries and mutations — do not expose these functions directly to clients. Put auth in those wrappers.

vs @hamzasaleemorg/convex-kv

@hamzasaleemorg/convex-kv convex-deployment-kv
Key model Hierarchical array keys namespace + string key
Multi-tenant No built-in tenant partition tenantId on every row
TTL units Milliseconds Seconds
Optimistic CAS No setIfRevisionMatches
JSON queries Prefix list / paginated scan queryJsonByPrefix with sort/filter

Use this package when you need tenant isolation, revision CAS, or prefix JSON queries from a Convex app or Node backend.

Install

npm install convex-deployment-kv
// convex/convex.config.ts
import { defineApp } from "convex/server";
import deploymentKv from "convex-deployment-kv/convex.config.js";

const app = defineApp();
app.use(deploymentKv);
export default app;
// convex/kv.ts — app wrapper (add your own auth here)
import { components } from "./_generated/api";
import { mutation, query } from "./_generated/server";

export const get = query({
  args: { namespace: v.string(), key: v.string(), tenantId: v.optional(v.string()) },
  handler: async (ctx, args) => ctx.runQuery(components.deploymentKv.kv.get, args),
});

export const set = mutation({
  args: {
    namespace: v.string(),
    key: v.string(),
    value: v.any(),
    tenantId: v.optional(v.string()),
  },
  handler: async (ctx, args) => {
    // e.g. require ctx.auth or an API key before writing
    return ctx.runMutation(components.deploymentKv.kv.set, args);
  },
});

tenantId defaults to "default" when omitted.