Housekeeping
housekeepingOne dispatcher for the recurring cleanups the installed blocks contribute (purges, expiries): maintenance() runs each due job and records its outcome, and maintenance_schedule() registers it with pg_cron.
Automationmanaged
Install
It needs no other module.
npx better-supabase add housekeepingConfigure
The blocks entries in your config, with the default mode.
import { defineConfig } from "better-supabase/config";
export default defineConfig({
blocks: {
// Modes: "managed". The default is "managed".
housekeeping: { mode: "managed" },
},
});Migrations
The files
npx better-supabase add housekeeping writes into your declarative schema with the default layout.Client
This block is SQL only: call its functions from your policies, RPCs and the other modules.
Events
With the outbox installed, the module writes these in the same transaction as the change.
This module writes no outbox events.
Dependencies
No dependencies
It installs on its own and integrates with no optional module.
Recipes
No UI recipe uses it yet. See all recipes.
More in Automation
- Job queuequeueTyped jobs on Supabase Queues (pgmq) or a plain table (blocks.queue.options.backend): leases, retries with backoff, dead letters, deduplication keys, queue stats, and schedules with pg_cron or the drain route.
- Idempotency keysidempotencyStores responses by Idempotency-Key so retried requests replay the first result instead of running twice.
- Webhook inboxwebhook-inboxStores verified webhooks once per message id, per tenant when given, then processes them with leases, retries and checkpoints, in its own table or one of the app's.
- Write rate limitsrate-limitFixed-window limits on Data API writes (POST, PATCH, PUT, DELETE) per user or claim, checked by pgrst.db_pre_request. Over the limit: 429 with Retry-After.
- OutboxoutboxEvents written in the same transaction as the change, read by named consumers with their own cursor and lease, kept for history and relayed as CloudEvents.
- Durable streamsstreamsOrdered text chunks a writer appends and any reader resumes from an index: idempotent batches, a cancel flag the writer reads on its next append, owner reads through RLS, a payload-free Realtime ping on a private topic per stream, and a purge for expired streams.