A modern, developer-friendly RBAC/ABAC permission system
A comprehensive RBAC/ABAC (Role-Based & Attribute-Based Access Control) system with a visual studio for building and testing permission rules.
- High-Performance Core Engine - Fast permission evaluation with caching
- Visual Studio - Interactive Next.js app for building rules
- CLI Tool - Command-line interface for project management
- YAML/JSON Rules - Human-readable rule definitions
- TypeScript Support - Full type safety and IntelliSense
- Role Inheritance - Hierarchical role structures
- ABAC Conditions - Attribute-based access control with expressions
- Real-time Testing - Interactive playground for testing permissions
This monorepo contains:
- zenix-rbac-core - Core permission evaluation engine
- zenix-rbac-cli - Command-line interface and visual studio
npm install -g zenix-rbac-cli# Initialize a new RBAC project
npx zenix-rbac-cli init# Launch the visual builder
npx zenix-rbac-cli studioThe studio will open at http://localhost:4141 with:
- π Roles Management - Create roles with inheritance
- π¦ Resources Builder - Define resources with typed attributes
- β‘ Rules Canvas - Build permission rules visually
- π§ͺ Playground - Test permissions interactively
# Validate your rules
npx zenix-rbac-cli validate
# Export compiled rules
npx zenix-rbac-cli exportimport { createChecker } from 'zenix-rbac-core';
// Load rules
const { check } = await createChecker({
path: './rules.yaml',
});
// Check permissions
const result = await check({
user: { id: 1, role: 'editor' },
action: 'post.update',
resource: { id: 10, authorId: 1 },
});
console.log(result.allowed); // true/false
console.log(result.explanation); // Why it was allowed/deniedThe visual studio provides an intuitive interface for:
- Create, edit, and delete roles
- Set up role inheritance hierarchies
- Visual inheritance tree
- Define protected resources
- Add typed attributes (string, number, boolean, date, etc.)
- Mark attributes as required/optional
- Create permission rules visually
- Set effects (allow/deny)
- Add ABAC conditions with expressions
- Assign priorities
- Test permissions in real-time
- JSON editors for user and resource
- Color-coded results
- View matched rules
# Install dependencies
npm install
# Build all packages
npm run build
# Run tests
npm test -w zenix-rbac-core
# Start development
npm run devMIT