Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LeaveFlow - Leave Management System

Overview

LeaveFlow is a full-stack leave management system built for organizations to streamline employee leave requests and employer approvals. Employees can submit leave applications, track their status, and view history. Employers can review, approve, or reject leave requests from a centralized dashboard.

The application uses role-based access control to separate employee and employer functionalities.

Tech Stack

Layer Technology
Frontend Vue.js 3, Vue Router, Pinia, Vite
Styling Tailwind CSS
Backend Node.js, Express.js
Database MongoDB (Atlas M0 - Free Tier)
Auth JWT (JSON Web Tokens), bcrypt
Hosting AWS EC2 (t3.micro), Nginx, PM2

Live URL

http://13.201.35.53

Sample Credentials (For Testing)

Employee Login

Email    : coppisetty.venkat2024@vitstudent.ac.in
Password : Ujwal@2311

Employer Login

Email    : srinu23.coppisetty@gmail.com
Password : srinu@123

Local Setup

Prerequisites

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

1. Clone the repository

git clone https://github.com/ujwal2311/Leave-Management-System-.git
cd Leave-Management-System-

2. Backend setup

cd backend
cp .env.example .env
# Edit .env with your MongoDB URI and JWT secret
npm install
npm start

The backend runs on http://localhost:5000.

3. Frontend setup

cd frontend
cp .env.example .env
# Edit .env with your backend API URL
npm install
npm run dev

The frontend runs on http://localhost:5173.

Environment Variables

backend/.env

PORT=5000
MONGO_URI=your_mongodb_atlas_uri
JWT_SECRET=your_jwt_secret
NODE_ENV=development
FRONTEND_URL=http://localhost:5173

frontend/.env

VITE_API_BASE_URL=http://localhost:5000/api

API Endpoints

Authentication

Method Endpoint Auth Required Description
POST /api/auth/register No Register a new user
POST /api/auth/login No Login and receive JWT

Leave Management

Method Endpoint Auth Required Description
GET /api/leaves/mine Employee Get all leaves for logged-in user
POST /api/leaves/apply Employee Submit a new leave application
GET /api/leaves/all Employer Get all leave applications
PATCH /api/leaves/:id Employer Approve or reject a leave request

Health Check

Method Endpoint Auth Required Description
GET /api/health No API status check

Deployment - AWS EC2

Architecture

Browser --> Nginx (:80) --> Vue.js /dist (static files)
                        --> proxy_pass /api/* --> Node.js (:5000) --> MongoDB Atlas

Infrastructure

  • Instance: AWS EC2 t3.micro (Free Tier), Ubuntu 22.04 LTS
  • Region: ap-south-1 (Mumbai)
  • Web Server: Nginx - serves frontend static files and reverse proxies API requests
  • Process Manager: PM2 - keeps the Node.js backend running with auto-restart
  • Database: MongoDB Atlas M0 (Free Tier) - managed cloud database
  • Security: Port 5000 is not exposed publicly; API is only accessible through Nginx

Deployment Steps (Summary)

# System setup
sudo apt update && sudo apt upgrade -y
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt install -y nodejs nginx git
sudo npm install -g pm2

# Clone and install
git clone https://github.com/ujwal2311/Leave-Management-System-.git
cd Leave-Management-System-/backend && npm install
cd ../frontend && npm install && npm run build

# Start backend with PM2
cd ../backend
pm2 start server.js --name leaveflow-backend
pm2 save && pm2 startup

# Configure Nginx
# - Serve frontend/dist on port 80
# - Reverse proxy /api/* to localhost:5000
# - Enable try_files for Vue Router history mode
sudo systemctl restart nginx && sudo systemctl enable nginx

Screenshots

Login

Login Page

Register

Register Page

Employee Dashboard

Employee Dashboard

Apply Leave

Apply Leave Form

Employer Dashboard

Employer Dashboard

Project Structure

Leave-Management-System-/
├── backend/
│   ├── config/
│   │   └── db.js
│   ├── controllers/
│   │   ├── auth.controller.js
│   │   └── leave.controller.js
│   ├── middleware/
│   │   └── auth.js
│   ├── models/
│   │   ├── Leave.js
│   │   └── User.js
│   ├── routes/
│   │   ├── auth.routes.js
│   │   └── leave.routes.js
│   ├── server.js
│   ├── package.json
│   └── .env.example
├── frontend/
│   ├── src/
│   │   ├── api/
│   │   ├── components/
│   │   ├── router/
│   │   ├── store/
│   │   ├── views/
│   │   ├── App.vue
│   │   └── main.js
│   ├── package.json
│   ├── vite.config.js
│   └── .env.example
└── README.md

License

MIT License - Ujwal Coppisetty

About

LeaveFlow - Full-stack Leave Management System built with Vue.js 3, Node.js, Express, MongoDB and deployed on AWS EC2

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages