README.md

August 10, 2026 ยท View on GitHub

URBAC Banner

๐Ÿ›ก๏ธ URBAC (Unified Role-Based Access Control)

The enterprise-grade full-stack boilerplate for NestJS, Angular, and TypeORM.

License: MIT NestJS Angular TypeORM PostgreSQL


URBAC is a complete, production-ready boilerplate designed to help you scaffold secure, multi-level access control systems in minutes. It provides a flawless developer experience with a seeded PostgreSQL database, a powerful NestJS backend, and a dynamic Angular UI built with Optimus UI and Tailwind CSS.

โœจ Core Features

  • ๐Ÿ” Hierarchical Group-Based RBAC: A clean User -> Group -> Role -> Privilege architecture.
  • ๐Ÿข Role Escalation: Strict level-based security. A Level 10 User cannot assign a Level 50 Admin role.
  • ๐Ÿงฉ Dynamic Frontend: Custom Angular *hasPermission="'action'" directives to automatically render or hide UI elements based on the user's active group context.
  • ๐Ÿšช Configurable Sign-Ups: Toggle public registrations via the ALLOW_PUBLIC_SIGNUP environment variable.
  • โšก Clean Structure: Fully decoupled NestJS backend and Angular frontend for easy deployment.

๐Ÿš€ Quick Start

Prerequisites: You need Node.js (v18+) and a running instance of PostgreSQL.

1. Clone the Repository

git clone [https://github.com/kasoir/urbac.git](https://github.com/kasoir/urbac.git)
cd urbac

2. Start the Backend (NestJS)

Navigate to the backend folder, install dependencies, and configure your database connection.

cd backend
npm install
cp .env.example .env

(Make sure to update the .env file with your local PostgreSQL credentials!) Seed your PostgreSQL database with the default roles and Super Admin account, then start the server:

npm run seed
npm run start:dev

The API is now running at http://localhost:3000/api.

3. Start the Frontend (Angular)

Open a new terminal tab, navigate to the frontend folder, and start the application.

cd frontend
npm install
npm start

The Angular UI is now running at http://localhost:4200.

๐Ÿ”‘ Default Credentials

The npm run seed command provisions a Super Admin account out of the box so you can immediately test the dashboard and role-management features.

Email Password Group Role Level
admin@urbac.com Admin123! Super Admins 100 (Max)

๐Ÿ›๏ธ Architecture & Database Schema

URBAC intentionally avoids complex three-way junction tables in favor of a clean, top-down administrative grouping model. This makes querying incredibly fast and the mental model easy to grasp:

1- Groups are administrative buckets (e.g., "Users", "Admins", "Super Admins").

2- Users are assigned to a Group.

3- Roles are assigned to a Group.

4- Privileges are attached to Roles.

// Example of protecting a NestJS Endpoint
@Post('create')
@RequirePermissions('user:create')
async createNewUser() { ... }
<!-- Example of dynamic UI rendering in Angular -->
<button *hasPermission="'user:delete'" class="p-button-danger">
  Delete User
</button>

๐Ÿ’ฌ Community & Support

We are building this together! If you need help, want to share what you've built, or have ideas for new features, join us in the Discussions Tab.

๐Ÿ› Found a bug? Please open an Issue.

๐Ÿ› ๏ธ Want to contribute? Check out our CONTRIBUTING.md guide.

๐Ÿ“„ License

URBAC is open-source software licensed under the MIT License.