How-to guides¶
Recipes for specific tasks, for when you already know what you want to do. If you are new to the library, start with the tutorials; for exact signatures and every option, see the reference.
Model your permissions
Port an OpenFGA model: load an existing model and its tuples.
Rewrite a refused schema shape: read a refusal and apply the fix.
Common modelling patterns: groups, roles, parent inheritance, public access, block lists, requiring two relations.
Change a schema: move a store’s tuples to a new schema.
Test your permission model: a pytest fixture and tests for a schema.
Load and read data
Bulk-load or adopt an existing store: build the index for tuples you already have.
Find who can access what: list the users of an object, or the objects a user can reach.
Use async mode and freshness tokens: write without waiting for the index, and read your own writes.
Use the backends directly: open a set engine without a
Store: for tooling, experiments, and write-heavy loads where the graph index is the wrong trade (see Limits).
Run in production
Run on PostgreSQL: isolation level, sessions, several instances.
Turn on runtime checks in production: detect a corrupt index.
Cap write fan-out: refuse a write that would add too many index rows.
Handle errors: what to catch, and what to let through.
Maintain a running store
Recover a stalled index: clear a row the index cannot apply.
Prune the change outbox: stop the outbox table growing.
Upgrade from 0.0.x to 0.1: renamed names and changed answers.