A comprehensive Human Resource Management System (HRMS) backend built with Node.js, Express, and MongoDB. Features include authentication, role-based access control, employee management, payroll, leave management, AI integrations, and multilingual support.
- Authentication & Authorization: JWT-based authentication with role-based access control
- Employee Management: Complete employee lifecycle management
- Payroll System: Salary processing with IremboPay integration
- Leave Management: Request, approval, and tracking system
- Training Management: Course creation, enrollment, and progress tracking
- Performance Reviews: Employee evaluation and feedback system
- AI Integration: Resume matching, attrition prediction, and sentiment analysis
- Multilingual Support: i18next integration (English, French, Kinyarwanda)
- GDPR Compliance: Data export, anonymization, and deletion endpoints
- Activity Logging: Comprehensive audit trail
- API Documentation: Complete Swagger/OpenAPI documentation
- Runtime: Node.js
- Framework: Express.js
- Database: MongoDB with Mongoose ODM
- Authentication: JWT (JSON Web Tokens)
- File Upload: Multer
- Validation: Joi
- API Documentation: Swagger JSDoc
- Internationalization: i18next
- Payment Integration: IremboPay
- Node.js (v14 or higher)
- MongoDB
- npm or yarn
-
Clone the repository
git clone https://github.com/AGUUKA/HRMS-backend.git cd HRMS-backend
-
Install dependencies
npm install
-
Environment Setup
cp .env.example .env
Configure your
.env
file with:PORT=3000 MONGODB_URI=mongodb://localhost:27017/hrms JWT_SECRET=your_jwt_secret_here IREMBO_API_KEY=your_irembo_api_key IREMBO_SECRET=your_irembo_secret
-
Start the server
npm start
-
Access API Documentation
- Swagger UI:
http://localhost:3000/api-docs
- API Base URL:
http://localhost:3000/api
- Swagger UI:
Email: admin@hrms.com
Password: admin123
Role: admin
Email: manager@hrms.com
Password: manager123
Role: manager
Email: hr@hrms.com
Password: hr123
Role: hr
Email: employee@hrms.com
Password: employee123
Role: employee
Email: trainer@hrms.com
Password: trainer123
Role: trainer
Email: recruiter@hrms.com
Password: recruiter123
Role: recruiter
Email: auditor@hrms.com
Password: auditor123
Role: auditor
Role | Description | Permissions |
---|---|---|
admin | System Administrator | Full access to all features |
manager | Department Manager | Employee management, payroll, leave approval |
hr | Human Resources | Employee records, surveys, performance reviews |
employee | Regular Employee | View own data, submit leave requests |
trainer | Training Specialist | Course management, enrollment tracking |
recruiter | Recruitment Specialist | Job applications, candidate management |
auditor | System Auditor | Activity logs, compliance monitoring |
Endpoint | Method | Roles | Summary |
---|---|---|---|
/auth/register |
POST | admin | Admin creates a new user |
/auth/login |
POST | public | Login and receive JWT |
/auth/profile |
GET | all | Get current user profile |
/auth/change-password |
PUT | all | Update password |
Endpoint | Method | Roles | Summary |
---|---|---|---|
/users |
GET | admin | List all users |
/users/:id |
GET | all | Get user by ID |
/users/:id |
PUT | admin | Update user |
/users/:id |
DELETE | admin | Delete user |
/users/me/export |
GET | all | Export user data (GDPR) |
/users/me/anonymize |
PUT | all | Anonymize user data (GDPR) |
/users/me |
DELETE | all | Delete user account (GDPR) |
Endpoint | Method | Roles | Summary |
---|---|---|---|
/employees |
GET | hr, manager | List all employees |
/employees/:id |
GET | hr | Get employee profile |
/employees |
POST | hr, manager | Create new employee |
/employees/:id |
PUT | hr, manager | Update employee info |
/employees/:id |
DELETE | hr | Remove employee |
/employees/:id/documents |
POST | hr, manager | Upload employee documents |
/employees/:id/documents |
GET | hr, manager | List employee documents |
Endpoint | Method | Roles | Summary |
---|---|---|---|
/payroll |
GET | admin, manager | List all payroll records |
/payroll/:id |
GET | admin, manager | Get single payroll record |
/payroll |
POST | admin, manager | Generate payroll record |
/payroll/:id |
PUT | admin, manager | Update payroll record |
/payroll/:id |
DELETE | admin, manager | Delete payroll record |
/payroll/:id/disburse |
POST | admin, manager | Trigger payroll disbursement |
/payroll/employee/:userId |
GET | all | Get payslip for employee |
/payroll/simulate |
GET | admin, manager | Simulate future pay |
/payroll/irembo-webhook |
POST | public | IremboPay webhook |
Endpoint | Method | Roles | Summary |
---|---|---|---|
/leave/request |
POST | employee | Submit leave request |
/leave |
GET | admin, manager | List all leave requests |
/leave/my-requests |
GET | employee | Get user's leave history |
/leave/:id/approve |
PUT | manager | Approve leave request |
/leave/:id/reject |
PUT | manager | Reject leave request |
Endpoint | Method | Roles | Summary |
---|---|---|---|
/training/courses |
GET | all | List all training courses |
/training/courses |
POST | admin, trainer | Create new training course |
/training/courses/:id |
GET | all | Get training course by ID |
/training/courses/:id |
PUT | admin, trainer | Update training course |
/training/courses/:id |
DELETE | admin, trainer | Delete training course |
/training/enroll |
POST | all | Enroll in a training course |
/training/enrollments |
GET | all | List training enrollments |
/training/progress/:id |
PUT | all | Update training progress |
Endpoint | Method | Roles | Summary |
---|---|---|---|
/performance-review |
GET | all | List performance reviews |
/performance-review/:id |
GET | all | Get performance review |
/performance-review |
POST | admin, manager | Create performance review |
/performance-review/:id |
PUT | admin, manager | Update performance review |
/performance-review/:id |
DELETE | admin, manager | Delete performance review |
Endpoint | Method | Roles | Summary |
---|---|---|---|
/succession-plan |
GET | all | List succession plans |
/succession-plan/:id |
GET | all | Get succession plan |
/succession-plan |
POST | admin, manager | Create succession plan |
/succession-plan/:id |
PUT | admin, manager | Update succession plan |
/succession-plan/:id |
DELETE | admin, manager | Delete succession plan |
/succession-plan/:id/add-candidate |
POST | admin, manager | Add candidate to plan |
/succession-plan/:id/remove-candidate |
POST | admin, manager | Remove candidate from plan |
Endpoint | Method | Roles | Summary |
---|---|---|---|
/surveys/submit |
POST | employee | Submit survey response |
/surveys |
GET | hr | View survey results |
Endpoint | Method | Roles | Summary |
---|---|---|---|
/announcements |
POST | admin, manager | Create announcement |
/announcements |
GET | all | List all announcements |
/announcements/:id |
GET | all | Get announcement |
/announcements/:id |
DELETE | admin, manager | Delete announcement |
Endpoint | Method | Roles | Summary |
---|---|---|---|
/faq |
GET | all | List all FAQs |
/faq/:id |
GET | all | Get FAQ by ID |
/faq |
POST | admin | Create new FAQ |
/faq/:id |
PUT | admin | Update FAQ |
/faq/:id |
DELETE | admin | Delete FAQ |
Endpoint | Method | Roles | Summary |
---|---|---|---|
/messages |
GET | all | List messages |
/messages/:id |
GET | all | Get message |
/messages |
POST | all | Create message |
/messages/:id |
DELETE | all | Delete message |
Endpoint | Method | Roles | Summary |
---|---|---|---|
/threads |
GET | all | List threads |
/threads/:id |
GET | all | Get thread |
/threads |
POST | all | Create thread |
/threads/:id |
PUT | all | Update thread |
/threads/:id |
DELETE | all | Delete thread |
Endpoint | Method | Roles | Summary |
---|---|---|---|
/activity-logs |
GET | admin, auditor | List activity logs |
/activity-logs/:id |
GET | admin, auditor | Get activity log |
/activity-logs |
POST | all | Create activity log |
Endpoint | Method | Roles | Summary |
---|---|---|---|
/reports/hiring |
GET | all | Hiring metrics report |
/reports/turnover |
GET | all | Turnover rate report |
/reports/payroll-summary |
GET | all | Compensation statistics |
/reports/diversity |
GET | all | Diversity & inclusion metrics |
/reports/custom |
GET | all | Custom report with filters |
/reports/export/pdf |
POST | all | Export report as PDF |
/reports/export/excel |
POST | all | Export report as Excel |
Endpoint | Method | Roles | Summary |
---|---|---|---|
/ai/resume-match |
POST | all | Resume-job matching score |
/ai/attrition-check |
POST | all | Predict resignation risk |
/ai/training-recommend |
POST | all | Suggest training courses |
/ai/sentiment-analysis |
POST | all | Analyze survey sentiment |
/ai/chat-assistant |
POST | all | Chat with AI assistant |
npm run dev
npm test
npm run lint
src/
βββ controllers/ # Route controllers
βββ middlewares/ # Custom middlewares
βββ models/ # Database models
βββ routes/ # API routes
βββ utils/ # Utility functions
βββ config/ # Configuration files
βββ locales/ # Translation files
The system supports multiple languages:
- English (en)
- French (fr)
- Kinyarwanda (rw)
Translation files are located in src/locales/
.
- JWT-based authentication
- Role-based access control
- Password hashing with bcrypt
- Input validation with Joi
- CORS protection
- Rate limiting
- GDPR compliance endpoints
- User: Authentication and user management
- Employee: Employee profiles and information
- Payroll: Salary and compensation records
- Leave: Leave requests and approvals
- Training: Courses and enrollments
- PerformanceReview: Employee evaluations
- SuccessionPlan: Career development planning
- Survey: Employee well-being surveys
- Announcement: Company communications
- FAQ: Frequently asked questions
- Message: Internal messaging
- Thread: Discussion threads
- ActivityLog: System audit trail
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License.
For support and questions, please contact the development team or create an issue in the repository.