Service principals
service-accountsNon-human tenant members backed by auth.users rows that can't sign in, with roles through memberships. Organization-owned workflow versions and service webhook endpoints run as the tenant's default principal.
Developer platformmanagedadoptcustom
Install
The command also installs updated-at, memberships, permissions, the modules it needs.
npx better-supabase add service-accountsConfigure
The blocks entries in your config, with the default mode.
import { defineConfig } from "better-supabase/config";
export default defineConfig({
blocks: {
// Required by service-accounts; add installs them too.
"updated-at": {},
memberships: {},
permissions: {},
// Modes: "managed", "adopt", "custom". The default is "managed".
"service-accounts": { mode: "managed" },
},
});Migrations
The files
npx better-supabase add service-accounts writes into your declarative schema with the default layout.Client
This block has no React entry yet. Its TypeScript side is in better-supabase/blocks/service-accounts, which runs on the server.
Events
With the outbox installed, the module writes these in the same transaction as the change.
- service_principal.created
- service_principal.disabled
- service_principal.role_changed
Dependencies
Recipes
More in Developer platform
- 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; adopt mode runs over an app's table.
- 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.
- Outgoing webhookswebhooks-outOutgoing webhooks: endpoints subscribed to event types, a delivery log unique per endpoint and event with leases and retries, direct dispatch, secrets in Vault with overlap while rotating, auto-disable after an endpoint keeps failing and redelivery.
- Incoming webhook endpointswebhooks-inPer-tenant trigger URLs with a hashed token, optional Standard Webhooks or HMAC verification, a body size limit, receive counters and the last status; deliveries go to the webhook inbox with the endpoint's tenant.
- API keysapi-keysHashed API keys for tenants and users with scopes, expiry, rotation with a grace period, a per-key rate limit and throttled last-used tracking. verify_api_key() backs apiKeyResolver; has_scope() and api_key_tenant() go in policies.React hooks