FORMATION ONLINE// open source · MIT// Node.js & Bun
RBAC Evolution roles & permissions, cultivated.
Everything you love about spatie/laravel-permission, for Node.js and Bun. One typed core, every framework, every database.
$ pnpm add @anievo-id/rbac-evolutionCOPY
Guardians of the sect
Formation bound to
React Next.js Vue Nuxt Express Hono Fastify NestJS Node.js 20+ Bun React Next.js Vue Nuxt Express Hono Fastify NestJS Node.js 20+ Bun Prisma Drizzle Kysely Mongoose PostgreSQL MySQL SQLite SQL Server MongoDB Memory Prisma Drizzle Kysely Mongoose PostgreSQL MySQL SQLite SQL Server MongoDB Memory 01 Roles & permissions
The API you know from Laravel Create permissions, bundle them into roles, assign roles to users and ask can() anywhere. Fully typed, with typed role and permission names.
assignRole, givePermissionTo, hasRole, can Wildcards like articles.* Learn more → src/rbac.ts await rbac.role ('writer' ).givePermissionTo ('edit articles' )
await rbac.for (user).assignRole ('writer' )
await rbac.for (user).can ('edit articles' )→ true
02 Every framework
Guards for the stack you already run Middleware and route guards for Express, Fastify, Hono, NestJS and Next.js, plus <Can>, useCan() and v-can for React, Vue and Nuxt.
401 for guests, 403 for missing access Server checks first, UI helpers second Learn more → src/server.ts app.use (rbacMiddleware ({ rbac, getSubject }))
app.put ('/articles/:id' ,
requirePermission ('articles.edit' ),
handler)→ 403 FORBIDDEN without the permission
03 Any database
Bring your ORM, keep your tables Prisma, Drizzle, Kysely and Mongoose adapters for PostgreSQL, MySQL, SQLite, SQL Server and MongoDB. Or write your own adapter in one file.
Same five tables as spatie A shared contract test suite for custom adapters Learn more → src/rbac.ts import { PrismaAdapter } from '@anievo-id/rbac-evolution-prisma'
export const rbac = createRbac ({
adapter: new PrismaAdapter (prisma),
})→ adapter ready
04 Teams & super-admin
Multi-tenant by design Scope roles to a team, give one role every permission, and listen to every change for audit logs.
Same user, different roles per team superAdminRoles and a before() hook Learn more → src/rbac.ts const rbac = createRbac ({
adapter,
teams: true ,
superAdminRoles: ['sect-master' ],
})
await rbac.for (user, { team: 'east' }).assignRole ('elder' )
await rbac.for (user, { team: 'west' }).hasRole ('elder' )→ false
05 CLI & seeding
php artisan permission, for Node Create roles, assign them and inspect everything from the terminal, or sync a whole seed file in one command.
create-role, assign-role, show sync with --dry-run before it writes Learn more → terminal npx rbac-evolution create-role writer "edit articles"
npx rbac-evolution assign-role writer 1
npx rbac-evolution sync --dry-run → plan printed, nothing written
Meet the Sect
Every part of the docs has a guardian Yue
Yue Super-admin Sect Master
“The seal of the Sect Master opens every gate — use it sparingly.”
Yue holds the one seal every gate obeys. Give a role to superAdminRoles, or decide in a before() hook, and every can() check says yes for that subject, across every guard and team.
Learn super-admin → 2D Chibi Anime
Start cultivating in five minutes Install the core, pick an adapter, guard your first route.
$ pnpm add @anievo-id/rbac-evolutionCOPY