A full-stack leave management web application where employees can apply for leave and employers can approve or reject those requests.
leave-app/
├── backend/ # Node.js + Express REST API
│ ├── controllers/
│ │ ├── authController.js
│ │ └── leaveController.js
│ ├── middleware/
│ │ └── auth.js # JWT authentication middleware
│ ├── models/
│ │ ├── User.js # Mongoose User schema
│ │ └── Leave.js # Mongoose Leave schema
│ ├── routes/
│ │ ├── auth.js
│ │ └── leaves.js
│ ├── .env.example
│ ├── package.json
│ └── server.js
│
└── frontend/ # Vue 3 + Tailwind CSS SPA
├── src/
│ ├── assets/
│ │ └── main.css
│ ├── components/ # Shared UI components
│ ├── router/
│ │ └── index.js # Vue Router with guards
│ ├── services/
│ │ └── api.js # Axios instance
│ ├── store/
│ │ ├── auth.js # Pinia auth store
│ │ └── leave.js # Pinia leave store
│ ├── views/
│ │ ├── layouts/
│ │ │ ├── EmployeeLayout.vue
│ │ │ └── EmployerLayout.vue
│ │ ├── employee/
│ │ │ ├── DashboardView.vue
│ │ │ ├── ApplyLeaveView.vue
│ │ │ └── MyLeavesView.vue
│ │ ├── employer/
│ │ │ ├── DashboardView.vue
│ │ │ └── LeaveRequestsView.vue
│ │ ├── LoginView.vue
│ │ └── RegisterView.vue
│ ├── App.vue
│ └── main.js
├── index.html
├── package.json
├── tailwind.config.js
├── postcss.config.js
└── vite.config.js
- Node.js >= 18
- MongoDB Atlas account (free tier works)
cd backend
npm installCreate a .env file from the example:
cp .env.example .envEdit .env and fill in your values:
PORT=5000
MONGODB_URI=mongodb+srv://<username>:<password>@<cluster>.mongodb.net/leave_management?retryWrites=true&w=majority
JWT_SECRET=your_super_secret_key_here
JWT_EXPIRE=7d
FRONTEND_URL=http://localhost:5173MongoDB Atlas setup:
- Go to mongodb.com/atlas
- Create a free cluster
- Add a database user
- Whitelist your IP (or
0.0.0.0/0for development)- Copy the connection string into
MONGODB_URI
Start the backend:
npm run dev # Development (nodemon)
npm start # ProductionBackend runs on: http://localhost:5000
cd frontend
npm install
npm run devFrontend runs on: http://localhost:5173
| Method | Endpoint | Access | Description |
|---|---|---|---|
| POST | /api/auth/register |
Public | Register employee or employer |
| POST | /api/auth/login |
Public | Login and receive JWT |
| GET | /api/auth/me |
Private | Get current user |
| Method | Endpoint | Access | Description |
|---|---|---|---|
| POST | /api/leaves |
Employee | Apply for leave |
| GET | /api/leaves/my |
Employee | Get own leave applications |
| GET | /api/leaves |
Employer | Get all leave requests |
| GET | /api/leaves/stats |
Employer | Get leave statistics |
| PATCH | /api/leaves/:id/review |
Employer | Approve or reject a request |
- Sign up and log in as Employee
- Apply for leave with type, dates, and reason
- View all personal leave applications
- Filter by status (Pending / Approved / Rejected)
- See reviewer notes on reviewed applications
- Sign up and log in as Employer
- View dashboard with leave statistics
- View all employee leave requests
- Filter by status and leave type
- Approve or reject with optional note
| Layer | Technology |
|---|---|
| Frontend | Vue 3, Vue Router, Pinia |
| Styling | Tailwind CSS |
| Backend | Node.js, Express |
| Database | MongoDB Atlas + Mongoose |
| Auth | JWT (JSON Web Tokens) |
| HTTP Client | Axios |