# pg_permissions > Authorization store and check engine in Postgres: RBAC, OpenFGA relationships and Cedar policies. Call from your backend or optionally enforce access with RLS. Use current guides and reference for implementation. Research records include historical designs and superseded plans. Guides show JavaScript examples first and include the equivalent SQL where available. Markdown exports preserve every language example. ## Guides and reference - [Overview](https://permissions.dev/markdown/overview.md): pg_permissions is an authorization store and check engine for Postgres. It stores roles, sharing relationships and policies alongside your application data. A backend can check... - [Install](https://permissions.dev/markdown/install.md): Install the extension once in each Postgres database that will store permissions. It creates the permissions schema for RBAC, OpenFGA and Cedar. Then connect your application... - [Quickstart: check permissions](https://permissions.dev/markdown/get-started/quickstart.md): Give Alice permission to read documents in Acme. Then ask the same question about Alice and Bob. The only data you need are a role and an assignment. - [Choose a permission model](https://permissions.dev/markdown/get-started/choose-a-model.md): Choose the model that describes how your application grants access. Every model stores permission data and provides check and list functions you can call from your backend. You... - [Check access in your application](https://permissions.dev/markdown/integrations/checks.md): Use pg_permissions as the authorization store and check engine behind your API, server functions, or background jobs. Store roles, relationships or Cedar policies in Postgres,... - [Identity and request context](https://permissions.dev/markdown/integrations/identity.md): Identify the subject before a permission check or a query protected by RLS. All three permission models use the same identity functions. Identity works independently of RLS; it... - [JavaScript setup](https://permissions.dev/markdown/integrations/javascript.md): Use the permissions package to call the extension from Node, browsers, Deno, or Bun. A server connects over SQL; a browser or edge function uses PostgREST. - [Client and admin privileges](https://permissions.dev/markdown/integrations/privileges.md): Application clients can check their own access. A trusted backend manages roles, models, tuples, policies and entities. Use createServerClient(pool) for admin writes. A subject... - [Delete users and clean up permissions](https://permissions.dev/markdown/integrations/cleanup.md): When your application deletes a user, call permissions.admin.deleteSubject({ type, id }) on its server client. The SQL equivalent is permissions.delete_subject. The extension... - [Roles and permissions (RBAC)](https://permissions.dev/markdown/models/rbac/overview.md): Use RBAC when access follows a role, such as viewer, editor, or administrator. Assign roles across the application or within a scope such as an organization. Roles can inherit... - [App-wide roles](https://permissions.dev/markdown/models/rbac/app-wide.md): Check permissions that apply across your application. You can use the result in a backend request handler, or optionally enforce the permission on a table with RLS. - [Tenant-scoped roles](https://permissions.dev/markdown/models/rbac/tenants.md): Give a user different permissions in different organizations. A scope is a text ID chosen by your application. - [Manage roles and assignments](https://permissions.dev/markdown/models/rbac/manage.md): Assign, revoke, and replace roles from a trusted backend. - [Relationships (OpenFGA)](https://permissions.dev/markdown/models/openfga/overview.md): Use relationships to share individual documents, nest teams, and inherit access from folders. Store the relationships in Postgres and ask questions such as “Can Anne view this... - [Define an authorization model](https://permissions.dev/markdown/models/openfga/models.md): Describe the relationships your application supports, then write the model to Postgres. - [Share objects and manage tuples](https://permissions.dev/markdown/models/openfga/tuples.md): A tuple records a relationship, such as a user viewing a document or belonging to a team. - [Check and list access](https://permissions.dev/markdown/models/openfga/checks.md): Check access to one object, list accessible objects, or inspect stored tuples. - [Conditions and request context](https://permissions.dev/markdown/models/openfga/conditions.md): Attach a CEL expression to a relationship when access depends on a value such as an expiry time or an IP address. The model declares the condition; a tuple names it and can... - [Expiry, networks, and conditional shares](https://permissions.dev/markdown/models/openfga/condition-examples.md): Use conditions to grant access for a limited time or from a particular network. - [Condition evaluation and context](https://permissions.dev/markdown/models/openfga/condition-behavior.md): Condition errors, model changes, and the source of context affect whether a relationship grants access. - [Update models](https://permissions.dev/markdown/models/openfga/update-models.md): Write a new model when your authorization rules change. Existing models remain available by ID. - [OpenFGA compatibility](https://permissions.dev/markdown/models/openfga/compatibility.md): The extension follows OpenFGA schema 1.1 and uses its public test suites as an oracle. It runs inside Postgres, so storage, errors, and some evaluation behavior differ from the... - [Policies (Cedar)](https://permissions.dev/markdown/models/cedar/overview.md): Use Cedar to express authorization rules as policy text. A policy can check who is making a request, what they want to do, and attributes of the resource they want to access.... - [Write policies](https://permissions.dev/markdown/models/cedar/policies.md): Create policies that permit or forbid access, then update or delete them as your rules change. Each policy has a stable id; writing to the same id replaces it. - [Store entities](https://permissions.dev/markdown/models/cedar/entities.md): Store the users, teams, folders and documents that your policies talk about. An entity has a type, an id, attributes, parents and tags. - [Use policy templates](https://permissions.dev/markdown/models/cedar/templates.md): Use a template when several policies share a rule but apply to different principals or resources. Write the rule once, then create links that fill its slots with specific entities. - [Check access](https://permissions.dev/markdown/models/cedar/checks.md): Check whether a principal can perform an action on a resource, then inspect the policies behind the decision and any evaluation errors. - [Extension types](https://permissions.dev/markdown/models/cedar/extensions.md): Use the Cedar extension types to compare IP addresses, decimal numbers, dates and durations. Cedar has four: ipaddr, decimal, datetime and duration. The extension supports all... - [Cedar compatibility](https://permissions.dev/markdown/models/cedar/compatibility.md): The extension targets Cedar 4.14 and checks its behavior against Cedar's integration tests. It runs inside Postgres, so storage, errors and some limits differ from the Cedar... - [Read and write policies](https://permissions.dev/markdown/rls/policies.md): RLS is an optional integration for enforcing permissions when application clients query a table. You can use all permission models through application checks without it. Choose... - [Combine permission models](https://permissions.dev/markdown/rls/combine-models.md): Keep organization roles and add individual shares on the same table. Separate permissive policies grant access through either model. A restrictive policy can deny access across... - [Denies, row attributes, and trusted context](https://permissions.dev/markdown/rls/denies-and-context.md): A model check does not read your application tables. RLS can add rules on row attributes and enforce denies across models. - [Performance and query plans](https://permissions.dev/markdown/rls/performance.md): A read policy should compute its accessible IDs once per query and let Postgres use the table index. The policy shape can matter as much as the permission check. - [Shared API](https://permissions.dev/markdown/reference/shared.md): Identity and cleanup functions are shared by the permission models. Use these calls to inspect the identity attached to a request or clean up a deleted account. - [RBAC API](https://permissions.dev/markdown/reference/rbac.md): The JavaScript examples use a server client called permissions, created with throwOnError: true so a failed call stops the example. See JavaScript setup to create the client. - [OpenFGA API](https://permissions.dev/markdown/reference/openfga.md): The JavaScript examples use a server client called permissions, created with throwOnError: true so a failed call stops the example. See JavaScript setup to create the client. - [Cedar API](https://permissions.dev/markdown/reference/cedar.md): The JavaScript examples use a server client called permissions, created with throwOnError: true so a failed call stops the example. See JavaScript setup to create the client. - [JavaScript client reference](https://permissions.dev/markdown/reference/javascript.md): The client maps methods to SQL functions. Client methods answer for the current subject; admin methods accept explicit subjects or change permission data. - [Errors](https://permissions.dev/markdown/reference/errors.md): Errors include a message for people, a stable detail code for programs, and a hint describing the fix. The JavaScript client returns database errors in error; its reason field... - [Limits](https://permissions.dev/markdown/reference/limits.md): Explicit-subject and current-subject API limits differ. In particular, the OpenFGA admin list functions cap their results, while the current-subject list functions return every... - [CEL support](https://permissions.dev/markdown/reference/cel.md): OpenFGA conditions use a CEL subset implemented in PL/pgSQL. Expressions are compiled when a model is written. Unsupported syntax is rejected at that point. - [Changelog](https://permissions.dev/markdown/changelog.md): Cedar joins RBAC and OpenFGA in the permissions schema. You can store Cedar policies, templates and entities, check a request, or list resources a subject can access.... - [Benchmarks](https://permissions.dev/markdown/benchmarks.md): This page has the current benchmark numbers for pg_permissions. It shows how long the policy functions take on a table of 10 thousand to 1 million documents. Each release gets... - [pg_permissions documentation](https://permissions.dev/markdown/guide.md): Use pg_permissions as your application's authorization store and check engine in Postgres. Manage roles, relationships and policies with the JavaScript client or SQL, then... ## Blog - [Blog](https://permissions.dev/blog/): Release stories and design essays. Each post links to a plain Markdown version. ## Research and design records - [Research and design records](https://kiwicopple.github.io/pg-extensions/pg_permissions/): Design records, benchmark reports, reviews and the build journal, on the separate research site. ## Contributing - [pg_permissions test suite](https://permissions.dev/markdown/contributing/test-suite.md): The tests are the spec. Each file in spec/ is one goal from ../research/goals.md. This page also describes the benchmark harness in bench/. - [Documentation conventions](https://permissions.dev/markdown/contributing/style-guide.md): Write for a developer building an application. Use plain English, precise technical terms, and enough context to make each example usable. Prefer natural sentences over rigid...