RBAC (role-based access control)
RBAC, role-based access control, is a way of granting access where people get roles and each role carries the permissions a job needs, so access is managed by role instead of person by person. In Meadowstack 2.1 every module keeps its roles and their actions in one table, `domain/permissions.ts`, and every screen asks that table instead of comparing roles.
By Bohuslav PoláčekChecked
const own: Action[] = [
"request.read",
"request.create",
"request.edit",
"request.submit",
"request.withdraw",
"request.delete",
"request.comment",
];
const decide: Action[] = ["request.approve", "request.reject", "request.reopen"];
const roleActions: Record<Role, Action[]> = {
member: own,
approver: [...own, ...decide],
admin: [...own, ...decide],Why it matters in a business app
A business app has a handful of jobs: the person who asks for a purchase, the person who approves it, the person who runs the system. RBAC matches that. When someone moves from the warehouse to purchasing, you change one role, not forty switches, and an auditor can read who may approve by reading one list.
The model stops at the record. "An approver may approve" is a role rule; "but not their own request" depends on whose record it is. That half is ABAC, and most real apps need both.
How Meadowstack handles it
- One table per module.
roleActions(above) maps each role to the actions it may ever take, named<thing>.<verb>. The app's own actions (settings, the team) live intemplates/starter/src/workspace/permissions.ts. - Components ask, never decide. Screens call
<Can>,useCanorusePermission;if (role === "approver")in a component breaks the rule in AGENTS.md. - Actions people cannot take are hidden, and a page they cannot open shows
NoAccessunder its header. - The backend is yours in 2.1. The simulated api asks the same function before every change, the way your api must, and
docs/recipes/examples/supabase/0001_requests.sqlmirrors the rules in the database. Meadowstack 3.0, coming as an update to every licence, moves the rules into one policy file per app that also generates the database policies.
The whole recipe is docs/recipes/permissions.md; the screen side is in the permissions pattern.
Common mistakes
- A role per person. Twenty roles for twenty people is a permissions list with extra steps. Keep a few roles that match jobs.
- Roles compared in components. The rule then lives in two places and the backend cannot share it.
- A hidden button as the only check. Anyone can call the api without your interface; the server and the database ask too.
- Letting people change their own role. The starter refuses it, so the app always keeps an admin who can put a mistake right.
Roles as people see them
Sources
Questions
What is the difference between RBAC and ABAC?
RBAC decides by the person's role. ABAC decides by attributes of the person, the record, the action and sometimes the context, such as whose record it is or which status it is in. Most business apps use roles for the broad lines and record attributes for the exceptions.
How many roles should a business app have?
As few as the jobs require. The starter has three, member, approver and admin, and adds conditions on the record instead of inventing a role for every exception.
Is hiding a button enough for RBAC?
No. Hiding is for the person; the protection is the same check in the api and in the database, because a request can be sent without the interface.
Two ways
Build it yourself, or have it built
Build it yourself
Build your app on the framework
Get the codebase these apps stand on and build yours with Claude Code, Cursor or Codex.
One payment, lifetime updates
Get the frameworkHave it built
Have us build your app
Tell us how your team works. We plan the app with you and build it on the same framework at a fixed price.
After launch, Care keeps it improving, from €99 a month.
from €1,990
Describe your app