Skip to content

pg_permissions

Store permissions in Postgres. Check access from your application.

pg_permissions stores roles, sharing relationships and Cedar policies alongside your application data. Your backend can ask Postgres who can do what without calling a separate authorization service. If you want the database to enforce the same rules on a table, use row level security (RLS).

Can Alice read documents in Acme? With a server client, set the subject and ask for the permission in that organization. The quickstart walks through assigning the role and checking two users.

const { data: allowed, error } = await permissions
.as({ id: 'alice' })
.rbac.hasPermission({ permission: 'documents.read', scope: 'acme' })
if (error) throw error
if (!allowed) throw new Error('Forbidden')

Install the extension in Postgres 16, 17 or 18, then connect your application. The overview explains why we built it and how each model fits into an application.

Look up a method in the JavaScript client reference, or browse the shared, RBAC, OpenFGA and Cedar APIs.

OpenFGA compatibility, Cedar compatibility, API limits, and CEL support describe the boundaries of the implementation. A check returns a decision for your backend to enforce. If you add RLS, standalone checks do not include any extra rules defined only in those table policies.

The architecture guide explains how the three models share identity while keeping their rules separate. The Cedar design record describes how we compare decisions against Cedar’s own tests.

For latency and throughput measurements, see the benchmarks. Each workload includes the data size and test conditions.

For agents and other tools, the Markdown index links to plain-text versions of the documentation, including every language example.