A Node.js authentication API with Role-Based Access Control (RBAC), built using Express and Sequelize.
- User Authentication (Register, Login, Logout)
- Role-Based Access Control (RBAC)
- Password Reset Functionality
- Email Notifications
- Profile Management with Avatar Upload
- Input Validation
- Error Handling
- MySQL Database Integration with Sequelize
- JWT-based Authentication
- Secure Password Hashing
- File Upload Support
- Node.js (v14 or higher)
- MySQL
- npm
-
Clone the repository: ```bash git clone cd ```
-
Install dependencies: ```bash npm install ```
-
Create a MySQL database
-
Configure environment variables:
- Copy
.env.exampleto.env - Update the values in
.envwith your configuration
- Copy
-
Start the server: ```bash
npm run dev
npm start ```
- POST /api/auth/register - Register a new user
- POST /api/auth/login - Login user
- POST /api/auth/forgot-password - Request password reset
- POST /api/auth/reset-password/:token - Reset password
- POST /api/auth/change-password - Change password (protected)
- GET /api/profile - Get user profile
- PUT /api/profile - Update user profile
- POST /api/profile/avatar - Upload profile avatar