Menu

I built vue-rbac — a full-featured RBAC library for Vue 3 with guard component, TTL cache and more. Feedback & contributors welcome!
📰

I built vue-rbac — a full-featured RBAC library for Vue 3 with guard component, TTL cache and more. Feedback & contributors welcome!

Reddit r/vuejs·u/Confident_Act5884·6 months ago
#oYS9LFei
#rbac#posts#admin#roles#create
Reading 0:00
15s threshold

Hey There!

Authorization logic is one of those things that starts simple and ends up scattered everywhere - v-if="user.role === 'admin'" in 40 different components, no inheritance, no fallback states. I've been there too many times, so I built vue-rbac to fix it properly.

What it does

vue-rbac is a lightweight, dependency-free RBAC plugin for Vue 3 that gives you a consistent, declarative way to handle roles and permissions.

Full feature list

Role & permission system with inheritance chains (admin → editor → viewer)

5 directives: v-rbac , v-rbac:role , v-rbac:any , v-rbac:all , v-rbac:not

Wildcard permissions — users:* grants all actions on a resource

component with #fallback and #loading slots

useRBAC() composable for programmatic access & reactive state

3 config modes: static, dynamic (fetch from API), and hybrid

Built-in storage adapters: localStorage, sessionStorage, cookies

TTL-based caching with manual invalidation

Retry with exponential backoff for failed fetches

Configurable log…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.