Skip to content

leandre000/hmrs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

HRMS Backend

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.

πŸš€ Features

  • 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

πŸ› οΈ Tech Stack

  • 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

πŸ“‹ Prerequisites

  • Node.js (v14 or higher)
  • MongoDB
  • npm or yarn

πŸš€ Installation

  1. Clone the repository

    git clone https://github.com/AGUUKA/HRMS-backend.git
    cd HRMS-backend
  2. Install dependencies

    npm install
  3. 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
  4. Start the server

    npm start
  5. Access API Documentation

    • Swagger UI: http://localhost:3000/api-docs
    • API Base URL: http://localhost:3000/api

πŸ‘₯ Test Credentials

Admin Account

Email: admin@hrms.com
Password: admin123
Role: admin

Manager Account

Email: manager@hrms.com
Password: manager123
Role: manager

HR Account

Email: hr@hrms.com
Password: hr123
Role: hr

Employee Account

Email: employee@hrms.com
Password: employee123
Role: employee

Trainer Account

Email: trainer@hrms.com
Password: trainer123
Role: trainer

Recruiter Account

Email: recruiter@hrms.com
Password: recruiter123
Role: recruiter

Auditor Account

Email: auditor@hrms.com
Password: auditor123
Role: auditor

πŸ” Role-Based Access Control

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

πŸ“š API Endpoints Documentation

Authentication (/auth)

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

Users (/users)

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)

Employees (/employees)

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

Payroll (/payroll)

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

Leave Management (/leave)

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

Training (/training)

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

Performance Reviews (/performance-review)

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

Succession Planning (/succession-plan)

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

Surveys (/surveys)

Endpoint Method Roles Summary
/surveys/submit POST employee Submit survey response
/surveys GET hr View survey results

Announcements (/announcements)

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

FAQs (/faq)

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

Messages (/messages)

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

Threads (/threads)

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

Activity Logs (/activity-logs)

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

Reports (/reports)

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

AI Integration (/ai)

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

πŸ”§ Development

Running in Development Mode

npm run dev

Running Tests

npm test

Code Linting

npm run lint

πŸ“ Project Structure

src/
β”œβ”€β”€ controllers/     # Route controllers
β”œβ”€β”€ middlewares/     # Custom middlewares
β”œβ”€β”€ models/         # Database models
β”œβ”€β”€ routes/         # API routes
β”œβ”€β”€ utils/          # Utility functions
β”œβ”€β”€ config/         # Configuration files
└── locales/        # Translation files

🌐 Internationalization

The system supports multiple languages:

  • English (en)
  • French (fr)
  • Kinyarwanda (rw)

Translation files are located in src/locales/.

πŸ”’ Security Features

  • JWT-based authentication
  • Role-based access control
  • Password hashing with bcrypt
  • Input validation with Joi
  • CORS protection
  • Rate limiting
  • GDPR compliance endpoints

πŸ“Š Database Models

  • 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

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

πŸ“„ License

This project is licensed under the MIT License.

πŸ†˜ Support

For support and questions, please contact the development team or create an issue in the repository.

Releases

No releases published

Packages

No packages published