All blocks

Billing & commerce

Usage metering and quotas

Usage counters per tenant, meter and day with idempotent increments, quotas per tenant or plan, within_quota() for policies and consume_quota(), which raises quota_exceeded. unreported_usage() feeds reportUsageToStripe.

DocsModes:managedcustom
terminal
npx better-supabase sql add usage
better-supabase.config.ts
import { defineConfig } from "better-supabase/config";

export default defineConfig({
  sql: {
    modules: {
      // Required by usage; sql add installs them too.
      "updated-at": {},
      tenant: {},
      access: {},
      // Modes: "managed", "custom". The default is "managed".
      usage: { mode: "managed" },
    },
  },
});