A production-grade, full-stack Role-Based Access Control (RBAC) web application featuring JWT Access & Refresh Token Authentication, granular Authorization matrix enforcement, Member Management CRUD, an interactive Admin Dashboard, Audit Logging, and a responsive glassmorphism dark/light interface.
- JWT Access Token: Short-lived (15 minutes) bearer token for route protection.
- JWT Refresh Token: Long-lived (7 days) token saved in database to enable seamless auto-refreshing without forcing user re-logins.
- Token Rotation & Security: Password hashing with
bcrypt(10 salt rounds), automatic token refresh interceptor on 401 Unauthorized responses. - Logout Session Revocation: Invalidates refresh tokens in the database upon logout.
Strictly enforced across both Backend NestJS Guards and Frontend UI components:
| Action / Feature | Admin | Manager | Member |
|---|---|---|---|
View Members List (GET /members) |
✅ Granted | ✅ Granted | ✅ Granted |
View Member Details (GET /members/:id) |
✅ Granted | ✅ Granted | ✅ Granted |
Create Member (POST /members) |
✅ Granted | ✅ Granted | ❌ Restricted |
Edit Member (PUT /members/:id) |
✅ Granted | ✅ Granted | ❌ Restricted |
Delete Member (DELETE /members/:id) |
✅ Granted | ❌ Restricted | ❌ Restricted |
View Audit Logs (GET /audit-logs) |
✅ Granted | ❌ Restricted | ❌ Restricted |
- Live count widgets for Total Users, Total Admins, Total Managers, and Total Members.
- Visual Permissions Matrix Card illustrating system privileges.
- Quick navigation links and active role status badges.
- Data Table: Displays Name, Email, Phone, Role Badge, Status Badge, and Created Date.
- Search: Real-time filtering by Name, Email, or Phone.
- Filtering: Dropdown filters for Role (
ADMIN,MANAGER,MEMBER) and Status (Active,Inactive). - Sorting: Multi-column sorting (Name, Email, Role, Created Date).
- Pagination: Server-side paginated queries with Next/Previous controls.
- Modal Dialogs: Contextual dialogs for Creating, Editing, and Confirming Member Deletion.
- 📚 Swagger OpenAPI Documentation: Interactive API UI hosted at
http://localhost:4000/api/docs. - 🧪 Unit Tests: Full Jest test suite covering Auth & Member services (
100% pass). - 🌙 Dark & Light Mode: Dynamic theme switcher with persistent local storage preferences.
- 📜 Audit Logs: Database tracking of user events (Login, Member Creation, Modifications, Deletions) with timestamps and user details.
- Framework: Next.js 16 (App Router)
- Language: TypeScript
- Styling: Tailwind CSS v4, Lucide Icons, Glassmorphism design system
- HTTP Client: Axios with custom interceptors for automatic token renewal
- Framework: NestJS 11 (TypeScript)
- Database ORM: Prisma ORM 6 with SQLite (
dev.db) & PostgreSQL support - Auth & Security: Passport.js,
@nestjs/jwt,bcrypt,class-validator,class-transformer - API Docs:
@nestjs/swagger
- Node.js
v18+orv20+orv22+ - npm
v9+orv10+
cd backend
npm install
npm run seed # Seeds default Admin, Manager, Member accounts & sample data
npm run start:dev # Runs backend on http://localhost:4000cd frontend
npm install
npm run dev # Runs frontend on http://localhost:3000For quick evaluation, use the one-click demo login cards on the /login page or use the credentials below:
| Role | Password | Access Level | |
|---|---|---|---|
| Admin | admin@rbac.com |
Admin123! |
Full Access (CRUD + Audit Logs) |
| Manager | manager@rbac.com |
Manager123! |
Create & Edit Members (No Delete/Audit) |
| Member | member@rbac.com |
Member123! |
View Only Access |
- 📖 SETUP_GUIDE.md - Detailed step-by-step setup & testing guide
- 🗄️ DATABASE_SCHEMA.md - Prisma ERD & table structural breakdown
- 📡 API_DOCS.md - OpenAPI & REST API specification