prisma-rbac

Implement RBAC with JWT authentication and permission guards in NestJS backends using Prisma.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/cromesdk/ai-skills --skill prisma-rbac
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: prisma-rbac
Source: https://github.com/cromesdk/ai-skills/tree/main/skills/nestjs/nestjs-prisma-rbac-setup
Command: npx skills add https://github.com/cromesdk/ai-skills --skill prisma-rbac

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill streamlines the implementation and repair of Role-Based Access Control (RBAC) in NestJS applications using Prisma, ensuring robust security for user authentication and authorization.

Core Features & Use Cases

  • RBAC Model Implementation: Sets up Prisma schema models for Users, Groups, Roles, and Permissions, along with their join tables.
  • JWT Authentication & Refresh Token Rotation: Integrates JWT-based authentication and implements secure refresh token rotation with session management.
  • Permission-Guarded Endpoints: Enables protection of API routes based on defined user permissions.
  • Use Case: When a developer needs to add granular access control to a NestJS backend, ensuring only authorized users can access specific API endpoints based on their assigned roles and permissions.

Quick Start

Apply the prisma-rbac skill to your existing NestJS + Prisma backend to implement role-based access control and secure API endpoints.

Frequently Asked Questions about prisma-rbac

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement role-based access control in a NestJS backend using Prisma?▼

To implement role-based access control in NestJS with Prisma, you need Prisma schema models for Users, Groups, Roles, Permissions, and join tables, plus permission guards to protect API routes based on assigned roles.

How does JWT refresh token rotation work with NestJS and Prisma?▼

JWT refresh token rotation in NestJS and Prisma works by securely storing hashed refresh tokens in a session model and replacing the token on each authentication request to prevent unauthorized access.

Can I add permission guards to existing NestJS API endpoints without rebuilding the Prisma schema?▼

Yes, you can add permission guards to existing NestJS endpoints. The integration modifies the Prisma schema to enforce token and session models while wiring guards into your current module structure.

What's the best way to set up CRUD APIs for user roles and permissions in a NestJS application?▼

The best way to set up CRUD APIs for user roles and permissions in NestJS is to generate service logic and DTOs that manage User, Group, Role, and Permission entities directly through the Prisma ORM.

Do I need to manually hash passwords and refresh tokens when setting up authentication in Prisma?▼

No, you do not need to manually hash passwords and refresh tokens. The implementation handles secure password and refresh token storage automatically by integrating hashing directly into the service logic.

Why does my NestJS Prisma authorization guard fail to restrict access to specific routes?▼

NestJS Prisma authorization guards fail to restrict access when permission models are not properly wired to the module structure or when the Prisma schema lacks the required join tables for role assignments.