Role-Based Access Control (RBAC) is a crucial aspect of security and permission management in modern web applications. This repository serves as a comprehensive resource for understanding and implementing RBAC in NestJS.
- Role Management
- Permission Management (not implement yet)
- User Role Assignment
- API Endpoint Authorization
- Fine-Grained Access Control
Before you begin, ensure you have met the following requirements:
- Node.js and npm installed
- NestJS CLI installed
- Mysql installed
-
Clone the repository :
git clone https://github.com/HtetAungKhant23/RBAC
-
Navigate to the project directory :
cd RBAC
-
Install dependencies :
pnpm install
-
Create .env :
cp .env.example .env
-
Configure your database connection in .env:
DATABASE_URL=your_database_url PORT=your_database_port JWT_ACCESS_TOKEN=your_jwt_access_token_key JWT_REFRESH_TOKEN=your_jwt_refresh_token_key
-
Migrate your database :
npx prisma migrate deploy npx prisma generate
-
Start the NestJS application :
pnpm start:dev
The application will be available at http://localhost:8800/docs.
Special thanks to Muhammet Özen for the insightful article that inspired this repository.