Access control,
without the complexity.
A precise, hierarchical authorization engine for teams building applications that need to grow. Model roles, express conditions, and ship with confidence.
import { createRBAC } from '@rbac/core';
const rbac = createRBAC({
enableLogger: false,
roles: {
viewer: { can: ['docs:read'] },
editor: {
inherits: ['viewer'],
can: ['docs:edit']
}
}
});
await rbac.can('editor', 'docs:read');
// true — inherited permissionA small API. Remarkable flexibility.
Make authorization decisions in one place and keep your policy model readable as your application grows.
Hierarchical roles
Compose permissions through inheritance. Change roles at runtime.
Context-aware rules
Express precise checks with synchronous, async, and callback conditions.
Flexible matching
Use exact operations, wildcards, and regular-expression patterns.
Built for your stack
Integrate with Express, Fastify, NestJS, and optional database adapters.
Permissions flow through roles.
Parent roles grant capabilities to their descendants. Conditions let you narrow individual operations at request time.
Explore documentationdocuments:readdocuments:edit · when(owner)documents:*Test a permission. See the result.
This example calls the same RBAC implementation used by the package. Try different roles and operations.
Try the playgroundFrom install to authorization in minutes.
One dependency. A clear API. Full TypeScript definitions.
npm install @rbac/coreFits into your stack
Works with Express, NestJS, Fastify, MongoDB, MySQL, and PostgreSQL through published integrations.
Build the rules. Keep the control.
Start with the basics, explore conditions, or inspect every public API in the reference.