Quickback Docs

Using KV

What the Quickback Stack keeps in Cloudflare KV, and caching in your own handlers

Cloudflare KV is a namespace your handlers can use for caching. The compiler itself keeps very little in it.

What the compiler stores in KV

  • JWT revocation stamps — with auth.jwt.revocationCheck: 'kv' the generated auth writes a timestamp when a user is banned or a membership is removed or changed, and the JWT fast path refuses tokens issued before it.

What is not in KV

  • Sessions live in the auth database. The compiler does not configure Better Auth secondaryStorage; see Session Handling.
  • Auth rate-limit counters live in the auth database on Cloudflare (rateLimit.storage: "database", the default there). See Auth Security.

Caching

You can use KV in custom action handlers for caching frequently accessed data:

// In an action handler
execute: async ({ db, ctx }) => {
  const kv = ctx.env.KV;

  // Check cache first
  const cached = await kv.get("expensive-query-result", "json");
  if (cached) return cached;

  // Compute and cache
  const result = await db.select().from(analytics);
  await kv.put("expensive-query-result", JSON.stringify(result), {
    expirationTtl: 300, // 5 minutes
  });

  return result;
}

See Also

  • KV Setup — Namespace creation and wrangler bindings
  • Auth Security — Rate limiting and cookie security configuration

On this page