Postgres Rls Pattern

Use when writing or reviewing Postgres queries in a multi-tenant SaaS where every table row must be scoped to a single organization. Enforces the FORCE ROW LEVEL SECURITY + USING + WITH CHECK triple on every tenant-bound table, and wraps application queries in an `orgQuery(orgId)` helper that sets `app.current_org_id` before each statement. Do NOT use for cross-org system queries such as billing cron jobs or admin panels (those bypass RLS intentionally via the service role); use a service-role query wrapper instead.

jacob-balslev 50ffc02 2 files · 6.0 KB Updated

File contents

jacob-balslev/skill-graph/tree/main/examples/projects/saas-stripe-postgres/skills/postgres-rls-pattern commit 50ffc020c2

Frequently asked questions

npx skillmds@latest add jacob-balslev/postgres-rls-pattern