Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

36 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

ShiftMaster – Employee Shift Scheduling System

A full-stack web application built with the MERN stack (MongoDB, Express.js, React.js, Node.js) that automates employee scheduling, simplifies shift management, and streamlines communication between managers and employees.

πŸš€ Features

πŸ” User Authentication & Roles

  • Secure JWT-based authentication
  • Two user roles: Admin/Manager & Employee
  • Role-based access control for all operations

πŸ‘₯ Employee Management

  • Add, edit, and delete employee profiles
  • Store employee details (name, department, designation, contact info)
  • Employee availability settings for smarter shift assignments

πŸ“… Shift Management

  • Create different shift types (Morning, Afternoon, Night, Custom)
  • Intelligent conflict detection prevents:
    • Overlapping shifts
    • Double-shifts
    • Assignments during unavailable hours
    • Assignments during approved leave
  • Interactive calendar with drag-and-drop functionality
  • Color-coded shift visualization

πŸ—“οΈ Weekly & Monthly Planner

  • Interactive calendar UI with Day/Week/Month views
  • Visual shift planning with color-coded blocks
  • Clear overview of staffing levels

πŸ–οΈ Leave Management

  • Employee leave request submission
  • Manager approval/rejection workflow
  • Automatic conflict detection with shift assignments
  • Leave calendar integration

πŸ”„ Shift Swap System

  • Employee-initiated shift swap requests
  • Two-step approval process (Employee β†’ Manager)
  • Automatic availability and role compatibility validation
  • Real-time shift updates upon approval

πŸ”” Notifications System

  • In-app notifications for:
    • New shift assignments
    • Shift updates or cancellations
    • Leave approval/rejection
    • Swap request status updates
  • Real-time notification updates

πŸ“Š Analytics & Reporting

  • Manager dashboard with comprehensive analytics
  • Employee performance tracking
  • Shift distribution charts
  • Weekly/monthly trend analysis

πŸ› οΈ Technology Stack

Frontend

  • React.js - UI framework
  • React Router - Navigation
  • Context API - State management
  • Axios - HTTP client
  • React Big Calendar - Calendar component
  • Recharts - Data visualization
  • Lucide React - Icons
  • Tailwind CSS - Styling
  • Moment.js - Date handling

Backend

  • Node.js - Runtime environment
  • Express.js - Web framework
  • MongoDB - Database
  • Mongoose - ODM
  • JWT - Authentication
  • bcryptjs - Password hashing
  • CORS - Cross-origin requests

πŸ“ Project Structure

shift/
β”œβ”€β”€ client/                 # React frontend
β”‚   β”œβ”€β”€ public/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/     # Reusable components
β”‚   β”‚   β”œβ”€β”€ context/        # Context providers
β”‚   β”‚   β”œβ”€β”€ pages/          # Page components
β”‚   β”‚   β”œβ”€β”€ App.jsx         # Main app component
β”‚   β”‚   └── main.jsx        # Entry point
β”‚   β”œβ”€β”€ package.json
β”‚   └── vite.config.js
β”œβ”€β”€ server/                 # Node.js backend
β”‚   β”œβ”€β”€ config/             # Database configuration
β”‚   β”œβ”€β”€ controllers/        # Route controllers
β”‚   β”œβ”€β”€ middleware/         # Custom middleware
β”‚   β”œβ”€β”€ models/             # Mongoose models
β”‚   β”œβ”€β”€ routes/             # API routes
β”‚   β”œβ”€β”€ server.js           # Server entry point
β”‚   └── package.json
└── start.bat              # Startup script

πŸš€ Getting Started

Prerequisites

  • Node.js (v14 or higher)
  • MongoDB (local installation or MongoDB Atlas)
  • npm or yarn

Installation

  1. Clone the repository

    git clone <repository-url>
    cd shift
  2. Install server dependencies

    cd server
    npm install
  3. Install client dependencies

    cd ../client
    npm install
  4. Environment Setup

    Server (.env)

    PORT=5000
    MONGO_URI=mongodb://127.0.0.1:27017/shiftmaster
    JWT_SECRET=your_jwt_secret_key

    Client (.env)

    VITE_API_URL=http://localhost:5000
  5. Start MongoDB

    • Local: mongod
    • Or use MongoDB Atlas connection string
  6. Run the application

    Option 1: Use the startup script (Windows)

    start.bat

    Option 2: Manual startup

    # Terminal 1 - Backend
    cd server
    npm run dev
    
    # Terminal 2 - Frontend
    cd client
    npm run dev
  7. Access the application

πŸ“± Usage Guide

For Managers/Admins

  1. Register as an Admin
  2. Create employees in the Employee List page
  3. Assign shifts using the Schedule page
  4. Manage leave requests in the Leaves section
  5. Approve shift swaps in the Swaps section
  6. Monitor analytics on the Dashboard

For Employees

  1. Register as an Employee
  2. View your schedule on the My Schedule page
  3. Request leave in the My Leaves section
  4. Request shift swaps with colleagues
  5. Check notifications for updates
  6. View your dashboard for personal analytics

πŸ”§ API Endpoints

Authentication

  • POST /api/auth/register - Register user
  • POST /api/auth/login - Login user
  • POST /api/auth/create-employee - Create employee (Admin)

Users

  • GET /api/users - Get employees
  • PUT /api/users/:id - Update employee
  • DELETE /api/users/:id - Delete employee

Shifts

  • GET /api/shifts - Get shifts
  • GET /api/shifts/all - Get all shifts (for swaps)
  • POST /api/shifts - Create shift

Leaves

  • GET /api/leaves - Get leave requests
  • POST /api/leaves - Create leave request
  • PUT /api/leaves/:id - Update leave status

Swaps

  • GET /api/swaps - Get swap requests
  • POST /api/swaps - Create swap request
  • PUT /api/swaps/:id/accept - Accept swap (Employee)
  • PUT /api/swaps/:id/reject - Reject swap (Employee)
  • PUT /api/swaps/:id/approve - Approve swap (Manager)
  • PUT /api/swaps/:id/manager-reject - Reject swap (Manager)

Notifications

  • GET /api/notifications - Get notifications
  • PUT /api/notifications/:id/read - Mark as read
  • POST /api/notifications - Create notification

🎨 Key Features Explained

Intelligent Conflict Detection

The system automatically prevents scheduling conflicts by checking:

  • Existing shift overlaps
  • Employee availability windows
  • Approved leave periods
  • Department compatibility for swaps

Two-Step Swap Approval

  1. Employee Response: Target employee accepts/rejects
  2. Manager Approval: Admin approves/rejects accepted swaps
  3. Automatic Execution: Shifts are swapped in the database

Real-Time Notifications

  • Automatic notifications for all major actions
  • Role-based notification filtering
  • In-app notification center

Responsive Design

  • Mobile-friendly interface
  • Adaptive layouts for all screen sizes
  • Touch-friendly calendar interactions

πŸ”’ Security Features

  • JWT token-based authentication
  • Password hashing with bcrypt
  • Role-based access control
  • Input validation and sanitization
  • CORS protection
  • Environment variable protection

πŸš€ Deployment

Backend Deployment (Render/Heroku)

  1. Set environment variables
  2. Update MONGO_URI for production database
  3. Deploy server code

Frontend Deployment (Vercel/Netlify)

  1. Update VITE_API_URL to production backend URL
  2. Build and deploy client code

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

πŸ“„ License

This project is licensed under the MIT License.

πŸ†˜ Support

For support and questions:

  • Create an issue in the repository
  • Check the documentation
  • Review the API endpoints

🎯 Future Enhancements

  • Email/SMS notifications
  • Data export (Excel/PDF)
  • Advanced analytics
  • Mobile app
  • Integration with HR systems
  • Automated shift generation
  • Time tracking integration

ShiftMaster - Simplifying workforce management, one shift at a time! πŸš€

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages