Skip to main content
Each template is a self-contained directory under docs/policies/templates/ in the repository (the policy.ts and README.md files are not rendered as pages on this site). It contains a policy.ts file with the permission definitions and a README.md with the scenario, expected decisions, and notes on engine limitations where relevant. Seed the exported arrays into theauth_permissions (and the supporting tables noted in each README), then call theauth.policy.evaluate() against them. Templates 08 and 09 also export engine config or use engine checks (policy.risk, subject.ownerId), described in their READMEs.

Templates

How to use a template

  1. Copy policy.ts from the template directory into your project.
  2. Seed the exported permission arrays into theauth_permissions using your database adapter.
  3. For templates that need supporting rows (delegation chains, ReBAC tuples, rate-limit counters), follow the instructions in the template’s README.md.
  4. Call theauth.policy.evaluate({ subject, action, resource }) in your request handler. See Policy engine for how decisions are combined.
The tests under packages/core/tests/policies/templates/ show exactly how each template behaves and can serve as integration tests in your own suite.
Last modified on October 16, 2026