This is a role-based API that handles user authentication, authorization, and session management using Redis. The API uses Redis sessions for secure authentication and includes role-based access control to restrict access to certain endpoints based on user roles (admin, user, moderator).
Deployed on AWS EC2 - http://3.108.150.30/api-docs/ (Swagger Docs Available)
- User registration, login, and logout functionality
- Role-based access control (admin, user, guest)
- Redis session management for secure user authentication
- API documentation generated with Swagger
- Express: Web framework for Node.js
- MongoDB: Database for storing user data
- Redis: Session store
- Swagger: API documentation
- Bcrypt: For password hashing
- express-session: For secure authentication
- Node.js: JavaScript runtime
Before running the project, ensure you have the following installed:
- Clone the repository:
git clone https://github.com/Samar-28/RBAC.git
- Go to project:
cd RBAC - Install Dependencies:
npm i
- Create .env:
MONGO_URI= SESSION_SECRET= REDIS_HOST= REDIS_PORT= PORT=
- Start the server:
npm start
- Access the API documentation at http://localhost:5000/api-docs