A robust full-stack web application for managing employees, attendance, payroll, leaves, departments, and more. Built with React (frontend) and Node.js/Express/MongoDB (backend).
- Project Overview
- Features
- Tech Stack
- Architecture
- Project Structure
- Setup & Installation
- Environment Variables
- Data Models
- API Endpoints
- Frontend Workflows
- Backend Workflows
- Security
- Testing
- Contributing
- License
- FAQ
The Employee Management System (EMS) streamlines HR operations for organizations. It provides secure authentication, role-based access, and modules for attendance, payroll, leave management, notifications, and reporting. The system is designed for scalability, security, and ease of use.
-
User Authentication & Authorization
- Registration, login, JWT-based sessions, email verification.
- Role-based access: Employee, Admin, Super Admin.
-
Employee Management
- Add, update, view, and soft-delete employees.
- Assign departments, designations, and shifts.
-
Attendance Tracking
- Daily clock-in/out, overtime calculation, late/early detection.
- Location and IP tracking for compliance.
-
Leave Management
- Apply for casual, sick, or earned leave.
- Admin approval/rejection, leave balance tracking.
-
Payroll Management
- Monthly salary calculation, overtime, bonuses.
- Payslip PDF generation and download.
-
Department & Shift Management
- Create/manage departments and work shifts.
-
Notifications
- In-app, email, and SMS notifications for approvals, payroll, and system alerts.
-
Audit Logs
- Track admin actions for security and compliance.
-
Admin Dashboard
- Advanced controls for HR/admins, analytics, and reporting.
-
Reports & Analytics
- Export data, view attendance/overtime/payroll trends.
-
Responsive UI
- Modern, user-friendly interface for desktop and mobile.
- Frontend: React, React Router, Axios, CSS
- Backend: Node.js, Express, MongoDB, Mongoose
- Authentication: JWT, bcryptjs
- Notifications: Nodemailer (email), Twilio (SMS)
- PDF Generation: PDFKit
- Other: CORS, dotenv
- Client-Server Model: React SPA communicates with Express REST API.
- Database: MongoDB stores all persistent data.
- Authentication: JWT tokens for secure API access.
- Notifications: Email/SMS via third-party services.
client/
src/
components/ # UI components (EmployeeList, NotificationDropdown, etc.)
context/ # React Context (AuthContext)
pages/ # Main pages (Dashboard, Login, Register, etc.)
styles/ # CSS files
utils/ # API utilities (axios)
public/ # Static assets
package.json # Frontend dependencies
server/
config/ # DB config
controllers/ # Route logic (attendance, payroll, etc.)
middleware/ # Auth, rate limiting
models/ # Mongoose schemas (User, Attendance, Payroll, etc.)
routes/ # API endpoints
utils/ # Helper functions (token, email, SMS)
package.json # Backend dependencies
- Node.js (v18+ recommended)
- MongoDB (local or Atlas)
- npm
git clone https://github.com/yukesshwaran21/Employee_Management_System.git
cd Employee_Management_Systemcd server
npm installcd ../client
npm installCreate a .env file in server/:
PORT=5000
MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret
EMAIL_USER=your_email_address
EMAIL_PASS=your_email_password
TWILIO_SID=your_twilio_sid
TWILIO_AUTH_TOKEN=your_twilio_auth_token
TWILIO_PHONE=your_twilio_phone_number
cd server
npm startcd client
npm start- Frontend: http://localhost:3000
- Backend: http://localhost:5000
name,email,phone,password,role,department,designation,status,employeeId,isEmailVerified,profilePhoto,leaveBalance,baseSalary,shift,isActive,createdAt,updatedAt
user,date,clockIn,clockOut,totalHours,overtimeHours,ip,location,isLate,isEarly
user,month,baseSalary,overtimeHours,overtimeRate,bonus,totalSalary,status,payslip,releasedAt
user,type,from,to,days,reason,status,adminComment,appliedAt,decidedAt
name,description
name,startTime,endTime,isNightShift
user,type,message,isRead,createdAt
action,performedBy,details,createdAt
/api/auth: Register, login, verify email, password reset/api/employees: CRUD for employees/api/attendance: Clock-in/out, attendance history, reports/api/payroll: Payroll management, payslip download/api/leave: Apply, approve/reject, leave history/api/department: Manage departments/api/shift: Manage shifts/api/audit: Audit logs/api/notification: Notifications
- Authentication: AuthContext manages user state and JWT token. Login and registration forms interact with
/api/auth. - Dashboard: Displays quick stats, navigation, and user info. Role-based rendering for employee/admin.
- Attendance: Employees can clock in/out, view attendance history, and see overtime.
- Leave: Apply for leave, view balances, and track approval status.
- Payroll: View salary details, download payslips.
- Admin Panel: Manage employees, approve leaves, view analytics, and export reports.
- Notifications: Dropdown for unread notifications, real-time updates.
- Authentication: JWT middleware protects routes. Passwords hashed with bcryptjs.
- Attendance: Validates clock-in/out, calculates hours and overtime.
- Payroll: Generates monthly payroll, calculates overtime, creates payslip PDFs.
- Leave: Validates leave applications, updates balances, notifies admins.
- Notifications: Sends email/SMS via Nodemailer/Twilio, stores in DB.
- Audit Logging: Records admin actions for compliance.
- Passwords hashed and salted.
- JWT-based authentication for API access.
- Role-based access control for sensitive endpoints.
- Rate limiting to prevent abuse.
- CORS configured for frontend-backend communication.
- Frontend: React Testing Library, Jest (see
client/src/App.test.js) - Backend: Add tests for controllers and routes as needed.
- Fork the repo
- Create your feature branch (
git checkout -b feature/YourFeature) - Commit your changes
- Push to the branch
- Open a Pull Request
This project is licensed under the ISC License.
Q: How do I add a new department or shift?
A: Use the admin dashboard or API endpoints /api/department and /api/shift.
Q: How are notifications sent?
A: Notifications are sent via email (Nodemailer), SMS (Twilio), and stored in the database for in-app display.
Q: How do I generate payslips?
A: Payroll module generates PDF payslips using PDFKit, downloadable from the payroll page.
Q: How do I reset my password?
A: Use the password reset feature via /api/auth.
For any questions or issues, please open an issue on GitHub.