A production-ready full-stack Employee Management System built with React (Vite) + Tailwind CSS on the frontend and Node.js + Express + MongoDB (Mongoose) on the backend. It supports secure authentication, role-based access, and complete CRUD flows for employees, departments, leaves, and salaries.
- JWT-based authentication & authorization (Admin / Employee)
- Employee management: create, update, list, delete
- Department management with cascading deletes
- Leave requests with statuses (Pending / Approved / Rejected)
- Salaries with net salary fields
- Responsive UI built with Tailwind CSS
- Clean, modular server architecture (controllers, routes, models, middleware)
- Frontend: React (Vite), Tailwind CSS, Axios
- Backend: Node.js, Express.js, Mongoose
- Database: MongoDB (local or Atlas)
Employee-Management-System/
│
├─ frontend/ # React + Vite + Tailwind
│ ├─ src/
│ │ ├─ components/
│ │ ├─ pages/
│ │ ├─ context/
│ │ └─ utils/
│ └─ public/
│
├─ server/ # Node + Express + Mongoose
│ ├─ controllers/
│ ├─ db/
│ ├─ middleware/
│ ├─ models/ # User, Department, Employee, Leave, Salary
│ ├─ routes/
│ ├─ public/
│ ├─ index.js
│ └─ userSeed.js # Optional: seed an admin user
│
└─ README.md- Node.js 18+
- MongoDB (local or MongoDB Atlas connection string)
git clone https://github.com/your-username/ems.git
cd ems# frontend
cd frontend
npm install
# backend
cd ../server
npm installPORT=3000
MONGODB_URL=mongodb://localhost:27017/ems # or your Atlas URI
JWT_KEY=your_strong_jwt_secret# in one terminal: backend
cd server
npm start
# in another terminal: frontend
cd frontend
npm run dev- Frontend dev server (Vite) defaults to http://localhost:5173
- Backend defaults to http://localhost:3000
Update credentials in server/userSeed.js if needed, then run:
cd server
node userSeed.jsThis script creates one admin user. Run it once (re-running without changes may create duplicates unless you add a check).
- User:
name,email,password (hashed),role (admin|employee),profileImage, timestamps - Department:
dep_name,description, timestamps (+ pre-hook to cascade delete related data) - Employee:
userId,employeeId,dob,gender,maritalStatus,designation,department,salary, timestamps - Leave:
employeeId,leaveType,startDate,endDate,reason,status, timestamps - Salary:
employeeId,basicSalary,allowances,deductions,netSalary,payDate, timestamps
- Never commit
.envfiles or secrets. - Passwords are hashed with bcrypt.
- Keep
JWT_KEYlong and random.
# Frontend
npm run dev # Vite dev server
npm run build # Production build (outputs to frontend/dist)
# Backend
npm start # Start server
# (Optionally add nodemon in package.json for hot reloads)- Fork the repo
- Create a branch:
git checkout -b feature/your-feature - Commit:
git commit -m "feat: add your feature" - Push:
git push origin feature/your-feature - Open a Pull Request
This project is released under the MIT License. See LICENSE for details.

