Open-source permission system
vue-nuxt-permission
One permission model for Vue 3 and Nuxt 3/4 apps: a directive for templates, guards for routes and a composable for logic — all reading the same source of truth.
Problem
Dashboards built on role-based access tend to scatter permission checks across templates, router guards and store logic, each with slightly different rules. When the backend changes a permission name, some of those checks silently stop working.
Architecture
A single engine resolves permissions with seven match modes — exact, and, or, not, startWith, endWith and regex. The v-permission directive, the route guards and the usePermission() composable are thin adapters over it. A Nuxt module registers everything and auto-imports the composable.
- Usage
- Templatesv-permission
- Routesguards
- LogicusePermission()
- Engine
- Matcherand · or · not · regex
- Cache
- Source
- Async loaderAPI
- Persistenceencrypted payload
Decisions
Permissions can load asynchronously from an API and are cached; persisted payloads support decryption hooks, so apps that receive encrypted permission sets don't need custom glue code.
Outcome
Published on npm with a documentation site and a spec suite. It follows an earlier, directive-only package of mine, vue-permission-directive.
