A comprehensive MERN (MySQL, Express, React, Node.js) stack application for managing employees, attendance, leaves, projects, and more. The system features distinct dashboards for Supervisors and Employees, each tailored with role-specific functionalities.
The application provides a robust set of features for two main user roles:
| Supervisor Dashboard | Employee Dashboard |
|---|---|
| 👑 Employee Management: Add, view, edit, & deactivate | 👤 Profile Management: View & update details, photo |
| 📊 Attendance Overview: Track team presence daily | 📅 Attendance History: View personal records |
| ✍️ Leave Application: Apply & track leave status | |
| 📂 Project Management: Assign employees to projects | 🚀 Project Tracking: View assigned projects |
| 📈 Reporting & Analytics: View department stats | 📄 Document Management: Upload personal documents |
| ⚙️ Admin Functions: Manage roles, departments, etc. | 💼 Career & Performance: View skills, promotions |
This project is built with a modern and scalable technology stack.
| Category | Technologies |
|---|---|
| Frontend | React.js, React Router, Tailwind CSS, Axios, Chart.js, date-fns, React Icons |
| Backend | Node.js, Express.js, MySQL2, JWT (for authentication), Bcrypt (for hashing), Multer (for uploads) |
| Database | MySQL (with triggers, stored procedures, and a fully normalized BCNF schema) |
The repository is organized into three main directories for clear separation of concerns.
employee-management-system/
├── backend/ # Node.js + Express backend server
│ ├── controllers/
│ ├── middleware/
│ ├── models/
│ ├── routes/
│ └── server.js
├── database/ # MySQL database scripts
│ └── schema.sql
└── frontend/ # React frontend application
├── public/
└── src/
├── assets/
├── components/
├── contexts/
├── pages/
├── services/
└── App.js
Follow these instructions to get a copy of the project up and running on your local machine for development and testing purposes.
- Node.js (v16 or later)
- MySQL Server
npmoryarnpackage manager
- Create a new MySQL database.
CREATE DATABASE employee_management_system;
- Import the schema by running the script located at
database/schema.sql.
- Navigate to the backend directory:
cd backend - Install the required dependencies:
npm install
- Create a
.envfile in thebackenddirectory and add the following environment variables:PORT=5000 DB_HOST=localhost DB_USER=your_mysql_username DB_PASSWORD=your_mysql_password DB_NAME=employee_management_system JWT_SECRET=your_super_secret_jwt_key - Start the backend server:
The server should now be running on
npm start
http://localhost:5000.
- Open a new terminal and navigate to the frontend directory:
cd frontend - Install the required dependencies:
npm install
- Create a
.envfile in thefrontenddirectory and add the following:REACT_APP_API_URL=http://localhost:5000/api - Start the React application:
The application will be available at
npm start
http://localhost:3000.
To explore the system, you can use the pre-defined test users. First, ensure these users exist in your database by running the SQL script below.
-- Add a supervisor
INSERT INTO employees (
employee_id, first_name, last_name, email, password,
department_id, designation_id, role_id, employee_type_id,
is_supervisor, hire_date
) VALUES (
'EMP-SUP-001', 'John', 'Supervisor', 'supervisor@example.com',
'$2b$10$odtUavsvsVKBgytZU5QmxuHF8OyFgHEL.GctGTdLIWxo85QKu7FQK', -- password: 'password123'
1, 1, 2, 1, 1, CURDATE()
);
-- Add a regular employee
INSERT INTO employees (
employee_id, first_name, last_name, email, password,
department_id, designation_id, role_id, employee_type_id,
is_supervisor, hire_date, reports_to
) VALUES (
'EMP-REG-002', 'Jane', 'Employee', 'employee@example.com',
'$2b$10$odtUavsvsVKBgytZU5QmxuHF8OyFgHEL.GctGTdLIWxo85QKu7FQK', -- password: 'password123'
1, 1, 4, 1, 0, CURDATE(), 1
);Navigate to http://localhost:3000/login and use the following credentials:
🧑💼 Supervisor Login:
- Email:
supervisor@example.com - Password:
password123
👨💻 Employee Login:
- Email:
employee@example.com - Password:
password123
The database is designed following BCNF normalization principles to ensure data integrity and reduce redundancy.
Click to view the full database schema
-- database/schema.sql
CREATE DATABASE IF NOT EXISTS employee_management_system;
USE employee_management_system;
-- Departments table
CREATE TABLE departments (
id INT PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(100) NOT NULL UNIQUE,
description TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);
-- Designations table
CREATE TABLE designations (
id INT PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(100) NOT NULL UNIQUE,
description TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);
-- Roles table
CREATE TABLE roles (
id INT PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(50) NOT NULL UNIQUE,
description TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);
-- And so on for all other tables...
-- (The full schema provided in the context would be placed here)Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request