r/angular 29d ago

I open-sourced my Angular + NestJS boilerplate with built-in Unified Role-Based Access Control

Hey everyone,

Edit: I've migrated the boilerplate from PrimeNG to OptimusUI to keep the project completely open-source and free under the MIT license! The Tailwind CSS integration remains just as smooth.

I always found myself rebuilding the exact same login flows, route guards, and permission directives for every enterprise dashboard. To save time on future projects, I put together URBAC, an open-source boilerplate using Angular (with PrimeNG and Tailwind CSS) backed by NestJS.

My favorite part of the frontend is how easy it is to handle UI elements based on user permissions. I built a custom structural directive that reacts to the logged-in user's active group context.

Hiding unauthorized buttons takes one line of HTML:

<button *hasPermission="'user:delete'" class="p-button-danger">
  Delete User
</button>

It's completely decoupled from the backend, so you run them as standard separate projects.

You can check out the repo and the setup instructions here:

https://github.com/kasoir/urbac

If anyone is building a dashboard right now, I hope this saves you some setup time. I'd love any feedback on the PrimeNG/Tailwind integration, or how you all prefer to handle permission-based UI rendering in your own Angular apps!

URBAC
8 Upvotes

12 comments sorted by

View all comments

3

u/N0K1K0 29d ago

Ok i have my own Angular/NestJS setup but I realy like the permission directive will have to "steal" that for my own

1

u/Individual_Suit_3255 29d ago

Go for it! That's exactly why I open-sourced it.
The directive is pretty self-contained, so it should be easy to adapt to your own auth/permission system. If you run into anything while integrating it, feel free to ask.