Skip to content

nuthanc55/emsS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

🏢 Employee Management System (EMS)

A full-stack Employee Management System built with React, Node.js, Express, and MongoDB.


🚀 Quick Start

Prerequisites

  • Node.js v18+
  • MongoDB (local or Atlas)

1. Clone / Setup

# Navigate to the project root
cd ems

2. Backend Setup

cd backend
npm install

Edit .env if needed:

PORT=5000
MONGO_URI=mongodb://localhost:27017/ems
JWT_SECRET=ems_super_secret_jwt_key_2024
JWT_EXPIRE=7d

Start MongoDB locally, then:

# Seed the database with dummy data
npm run seed

# Start the API server (development)
npm run dev

3. Frontend Setup

cd frontend
npm install
npm run dev

Open http://localhost:5173


🔑 Demo Login Credentials

Role Email Password
Admin admin@ems.com admin123
HR priya@ems.com EMP0002
Employee rajesh@ems.com EMP0001

All newly created employees have their Employee ID as their default password (e.g., EMP0001)


📁 Project Structure

ems/
├── backend/
│   ├── src/
│   │   ├── config/        # MongoDB connection
│   │   ├── controllers/   # Business logic
│   │   ├── middleware/    # Auth, error handling
│   │   ├── models/        # Mongoose schemas
│   │   ├── routes/        # Express routes
│   │   └── utils/         # JWT helper, seed script
│   └── .env
│
└── frontend/
    └── src/
        ├── api/           # Axios instance
        ├── components/    # Layout, UI components
        ├── context/       # Auth + Theme context
        ├── pages/         # Route-level pages
        └── routes/        # Protected route guard

🧩 Features

✅ Authentication

  • JWT-based login/logout
  • Role-based access: Admin, HR, Employee
  • Password hashing with bcrypt
  • Auto token refresh / expiry handling

✅ Dashboard

  • Total employees, departments, attendance stats
  • Bar chart (monthly attendance)
  • Pie chart (department distribution)
  • Recent employees table

✅ Employee Management

  • Add, edit, delete employees
  • Search by name/ID/email/designation
  • Filter by department and status
  • Export to CSV
  • Pagination

✅ Department Management

  • Create / edit / delete departments
  • Set department head
  • Employee count per department

✅ Attendance

  • Mark attendance (present/absent/late/half-day/on-leave)
  • View history with filters
  • Monthly report with CSV export

✅ Leave Management

  • Apply for leave (all types)
  • Approve / reject with reason
  • Status tracking (pending/approved/rejected)

✅ Payroll

  • Generate payroll for all employees in one click
  • Auto-calculate HRA, PF, tax, allowances
  • Annual payroll overview chart
  • PDF payslip download (jsPDF)

✅ UI/UX

  • Dark mode (with toggle)
  • Collapsible sidebar
  • Skeleton loading states
  • Toast notifications
  • Responsive design

🛠 API Endpoints

Method Endpoint Description
POST /api/auth/login Login
GET /api/auth/me Current user
GET /api/employees List employees
POST /api/employees Create employee
PUT /api/employees/:id Update employee
DELETE /api/employees/:id Delete employee
GET /api/departments List departments
POST /api/departments Create department
GET /api/attendance List attendance
POST /api/attendance Mark attendance
GET /api/attendance/report Monthly report
GET /api/leave List leaves
POST /api/leave Apply leave
PUT /api/leave/:id/status Approve/reject leave
GET /api/payroll List payroll
POST /api/payroll Generate payroll
GET /api/payroll/overview Annual overview
GET /api/dashboard/stats Dashboard metrics

🎨 Tech Stack

Layer Technology
Frontend React 18 + Vite
Styling Tailwind CSS v4
Charts Recharts
HTTP Axios
PDF jsPDF + autotable
Toast react-hot-toast
Backend Node.js + Express
Database MongoDB + Mongoose
Auth JWT + bcryptjs

📝 Notes

  • Profile image upload placeholder is ready (Multer configured); connect to Cloudinary by updating the upload config.
  • Default employee password is their Employee ID. Employees should change it on first login.

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors