RBAS is a robust backend authentication service built with NestJS, TypeORM, and PostgreSQL. It provides secure user registration, login, and role-based access control (RBAC) features, including integration with Google OAuth for seamless authentication.
- User Authentication: Register and login with email and password.
- JWT Integration: Secure token-based authentication with access and refresh tokens.
- Role-Based Access Control: Define roles such as Admin, Maintainer, and User to manage permissions.
- Google OAuth: Optional Google authentication for user convenience.
- Protected Routes: Secure API endpoints with Guards and Decorators.
- Data Validation: Automatic validation of request payloads using class-validator.
- Database Integration: Managed with TypeORM and PostgreSQL for reliable data storage.
- Environment Configuration: Manage configurations securely with environment variables.
- Clone the repository
git clone https://github.com/mustafaazad03/Backend-RBAC.git- Navigate to the project directory
cd Backend-RBAC- Install dependencies
pnpm install- Configure environment variables
- Rename
.env.exampleto.envand fill in the required values.
- Run the application
pnpm start:dev- Register a new user
- POST
/auth/registerwithemailandpassword.
- POST
- Login
- POST
/auth/loginwithemailandpassword.
- POST
- Access Protected Routes
- Include the JWT token in the
Authorizationheader.
- Include the JWT token in the
- Google OAuth
- GET
/auth/google/redirectUrlto initiate OAuth flow. - GET
/auth/google/callbackto handle the OAuth callback.
- GET