A comprehensive HR management system that covers employee records, absence management, and time tracking.
- Employee Management: Store and manage employee records with personal details, contact information, and employment history.
- Absence Management: Track and manage employee absences, including vacation, sick leave, and other types of leave.
- Time Tracking: Record employee work hours with clock-in and clock-out functionality.
- User Authentication: Secure login system with role-based access control.
- Responsive UI: Modern, mobile-friendly interface built with Material UI.
- Node.js with Express
- TypeScript
- MongoDB with Mongoose
- JWT Authentication
- React
- TypeScript
- Material UI
- React Router
hr-system/
├── backend/ # Backend API
│ ├── src/
│ │ ├── controllers/ # Request handlers
│ │ ├── middleware/ # Express middleware
│ │ ├── models/ # Mongoose models
│ │ ├── routes/ # API routes
│ │ └── server.ts # Entry point
│ ├── .env # Environment variables
│ └── package.json # Backend dependencies
│
└── frontend/ # React frontend
├── public/ # Static files
├── src/
│ ├── components/ # Reusable components
│ ├── pages/ # Page components
│ ├── App.tsx # Main app component
│ └── index.tsx # Entry point
└── package.json # Frontend dependencies
- Node.js (v14 or higher)
- MongoDB (local or Atlas)
-
Clone the repository:
git clone https://github.com/yourusername/hr-system.git cd hr-system -
Install backend dependencies:
cd backend npm install -
Set up environment variables: Create a
.envfile in the backend directory with the following variables:PORT=5000 MONGO_URI=mongodb://localhost:27017/hr-system JWT_SECRET=your_jwt_secret_key_here NODE_ENV=development -
Install frontend dependencies:
cd ../frontend npm install
-
Start the backend server:
cd backend npm run dev -
Start the frontend development server:
cd ../frontend npm start -
Open your browser and navigate to
http://localhost:3000
POST /api/auth/register- Register a new userPOST /api/auth/login- Login and get token
GET /api/employees- Get all employeesGET /api/employees/:id- Get employee by IDPOST /api/employees- Create a new employeePUT /api/employees/:id- Update an employeeDELETE /api/employees/:id- Delete an employee
GET /api/absences- Get all absencesGET /api/absences/:id- Get absence by IDGET /api/absences/employee/:employeeId- Get absences for a specific employeePOST /api/absences- Create a new absence requestPUT /api/absences/:id- Update an absence requestPUT /api/absences/:id/status- Approve or reject an absence requestDELETE /api/absences/:id- Delete an absence request
GET /api/time-tracking- Get all time recordsGET /api/time-tracking/:id- Get time record by IDGET /api/time-tracking/employee/:employeeId- Get time records for a specific employeeGET /api/time-tracking/range- Get time records for a specific date rangePOST /api/time-tracking/clock-in- Clock inPUT /api/time-tracking/clock-out/:id- Clock outPUT /api/time-tracking/:id- Update a time recordDELETE /api/time-tracking/:id- Delete a time record
- Admin: Full access to all features
- Manager: Can approve/reject absence requests and view employee data
- Employee: Can view own profile, submit absence requests, and track time
This project is licensed under the MIT License - see the LICENSE file for details.