scopes.json, a single configuration file that defines permissions, data access policies, and service access requirements. Enforcement is declarative — access control is never implemented as conditional logic in procedure handlers.
scopes.json
For the task tracker, define scopes that let admins view and edit all tasks, and restrict regular users to only see and edit their own:scopes— the available scopes for the app. These can be used to control access to procedures and pages.tables— defines row-level security on each table and the scopes required to bypass those restrictions.services— which services and tools the built-in AI agent can access on behalf of the user, and the user scopes required to do so.
How it works
We’ve set up thegetMyTasks procedure to only return the authenticated user’s tasks:
Task table so that only rows where userId matches the authenticated user are returned:
tasks:viewAll scope to do just that:
Defense in depth
All four enforcement layers derive fromscopes.json:
| Layer | Mechanism |
|---|---|
| Frontend routes | ProtectedRoute with requiredScopes |
| Backend procedures | scopedProcedure(['scope']) |
| Database | RLS policies generated from scopes.json |
| AI agent service access | services section of scopes.json |

