A comprehensive Employee Management System that combines Leave Management and Payroll Management into a single, powerful HR solution.
- Multi-role system: Employee, Manager, Admin
- JWT-based authentication
- Role-based access control
- Secure password handling
- Leave request submission with validation
- Leave approval workflow (Manager/Admin)
- Leave balance tracking with automatic deduction
- Multiple leave types: Annual, Sick, Personal, Maternity, Paternity
- Leave history and status tracking
- Single-day leave support
- Email notifications for leave status changes
- Automated payroll generation with leave integration
- Salary structure management (Basic, HRA, DA, TA, PF, Tax)
- Leave deduction calculation from salary
- Payroll history and detailed breakdown
- Currency formatting (INR)
- Print-ready payslips
- Payroll statistics and analytics
- Employee profiles with complete information
- Department management
- Manager assignment and team structure
- Salary configuration per employee
- Bank details and payroll information
- Real-time statistics for leaves and payroll
- Leave balance visualization
- Payroll overview for managers/admins
- Quick action buttons
- Notification system
- In-app notifications with real-time updates
- Email notifications for leave requests and approvals
- Toast notifications for user feedback
- Notification bell with unread count
- Node.js with Express.js
- JWT for authentication
- Nodemailer for email notifications
- In-memory data store (demo mode)
- CORS enabled for frontend integration
- React 18 with functional components
- React Router for navigation
- React Query for data fetching and caching
- React Hook Form for form management
- Tailwind CSS for styling
- Heroicons for icons
- React Hot Toast for notifications
- Date-fns for date manipulation
- Node.js (v14 or higher)
- npm or yarn
- Clone the repository
git clone <repository-url>
cd Leave-Management- Install dependencies
npm install
cd client && npm install
cd ..- Set up environment variables
Create a
.envfile in the root directory:
EMAIL_USER=your-email@gmail.com
EMAIL_PASS=your-app-password
PORT=5000
JWT_SECRET=your-secret-key- Start the application
# Start backend server
npm run backend
# In another terminal, start frontend
npm start- Access the application
- Frontend: http://localhost:3001
- Backend API: http://localhost:5000
| Role | Password | Access | |
|---|---|---|---|
| Admin | admin@company.com | password123 | Full access |
| Manager | manager@company.com | password123 | Team management + Payroll |
| Employee | employee@company.com | password123 | Leave requests only |
- Full system access
- User management (create, edit, delete)
- Department management
- Leave type configuration
- Payroll generation for all employees
- System statistics
- Team management (view team members)
- Leave approval for team members
- Payroll generation for team members
- Team statistics
- Leave request submission
- View own leave history
- View own payroll (if generated)
- Profile management
- Basic Salary: Base compensation
- HRA: House Rent Allowance (40% of basic)
- DA: Dearness Allowance (30% of basic)
- TA: Transport Allowance (10% of basic)
- PF: Provident Fund (12% deduction)
- Tax: Income Tax (10% deduction)
- Gross Salary = Basic + HRA + DA + TA
- Net Salary = Gross - PF - Tax
- Leave Deduction = (Leave Days Γ Per Day Salary)
- Final Salary = Net Salary - Leave Deduction
- Monthly payroll generation
- Leave integration (automatic deduction)
- Working days calculation
- Detailed breakdown with earnings and deductions
- Leave Request: Manager notification when employee submits
- Leave Approved: Employee notification when approved
- Leave Rejected: Employee notification with reason
- Enable 2FA on your Gmail account
- Generate App Password for mail access
- Update .env with email credentials
- Test email functionality
POST /api/auth/login- User loginGET /api/auth/me- Get current user
GET /api/leaves- Get leave requestsPOST /api/leaves- Submit leave requestPUT /api/leaves/:id/approve- Approve/reject leaveGET /api/leaves/stats- Leave statistics
GET /api/payroll- Get payroll historyPOST /api/payroll/generate- Generate payrollGET /api/payroll/:id- Get payroll detailsGET /api/payroll/stats- Payroll statistics
GET /api/users- Get usersPOST /api/users- Create userPUT /api/users/:id- Update userPUT /api/users/:id/salary- Update salary
GET /api/notifications- Get notificationsPUT /api/notifications/:id/read- Mark as read
- β Submit leave requests
- β View leave balance
- β Track request status
- β View payroll (if generated)
- β Receive notifications
- β Approve/reject team leave requests
- β View team statistics
- β Generate payroll for team
- β Manage team members
- β Receive leave notifications
- β Full user management
- β Department management
- β Leave type configuration
- β Generate payroll for all employees
- β System-wide statistics
- β Email configuration
- Responsive layout (mobile-friendly)
- Clean, professional interface
- Intuitive navigation
- Consistent styling with Tailwind CSS
- Real-time updates with React Query
- Loading states and error handling
- Toast notifications for feedback
- Form validation and error messages
- Confirmation dialogs for important actions
- Keyboard navigation support
- Screen reader friendly
- High contrast color scheme
- Responsive design for all devices
- JWT tokens for session management
- Password hashing with bcrypt
- Role-based access control
- Secure API endpoints
- Input validation on all forms
- SQL injection prevention
- XSS protection
- CORS configuration
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β Frontend β β Backend β β Data Store β
β (React) βββββΊβ (Node.js) βββββΊβ (In-Memory) β
β β β β β β
β β’ User Interfaceβ β β’ API Routes β β β’ Users β
β β’ State Mgmt β β β’ Auth Middlewareβ β β’ Leaves β
β β’ Routing β β β’ Business Logicβ β β’ Payrolls β
β β’ Components β β β’ Email Service β β β’ Notifications β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
- Environment variables configuration
- Database setup (MongoDB/PostgreSQL)
- Email service configuration
- SSL certificate setup
- Domain configuration
# Backend Dockerfile
FROM node:16-alpine
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 5000
CMD ["npm", "start"]- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License.
For support and questions:
- Email: support@company.com
- Documentation: [Wiki Link]
- Issues: [GitHub Issues]
Built with β€οΈ using React, Node.js, and Tailwind CSS