Skip to content

Repository files navigation

LeaveFlow — Vacation Management System

A production-ready, microservices-based Vacation Management System built with .NET 10, React + TypeScript, and PostgreSQL. Designed with Clean Architecture, CQRS, and role-based access control.

This project was developed based on a Full-Stack technical assessment that required building an internal Vacation Management System with role-based permissions, vacation overlap validation, and proper business rule enforcement.

While the original exercise focused on delivering a functional full-stack solution, this implementation expands the scope into a production-oriented architecture, applying microservices, Clean Architecture, CQRS, JWT authentication, Docker, and enterprise-level best practices.


Architecture

┌──────────────┐
│ Frontend │ React + TypeScript + Vite
│ (port 3000) │
└──────┬───────┘
│
┌──────▼───────┐
│ API Gateway │ YARP Reverse Proxy
│ (port 5000) │
└──┬───┬───┬───┘
│ │ │
┌──▼┐ ┌▼──┐ ┌▼────────┐
│ID │ │EMP│ │VACATION │ Microservices
│5101│ │5102│ │5103 │ ASP.NET Core
└──┬┘ └─┬─┘ └──┬──────┘
│ │ │
┌──▼────▼──────▼───┐
│ PostgreSQL │ 3 isolated databases
│ (port 5432) │
└──────────────────┘

Each service follows Clean Architecture:

Service/
├── Domain/ # Entities, interfaces, business rules
├── Application/ # CQRS commands/queries, validators, mapping
├── Infrastructure/ # EF Core, repositories, persistence
└── API/ # Controllers, middleware, configuration

Tech Stack

ComponentTechnology
Backend.NET 10, ASP.NET Core Web API
FrontendReact 19, TypeScript, Vite
DatabasePostgreSQL 16
ORMEntity Framework Core 10
GatewayYARP Reverse Proxy
AuthJWT Bearer Tokens
CQRSMediatR 12
ValidationFluentValidation
MappingAutoMapper
LoggingSerilog
DocsSwagger / OpenAPI
ContainersDocker + Docker Compose
State MgmtZustand

Microservices

ServicePortResponsibility
API Gateway5000Routes requests to downstream services
Identity Service5101Authentication, JWT token generation
Employee Service5102Employee CRUD, role management
Vacation Service5103Vacation requests, overlap validation, approvals

Business Rules

  • Roles: Admin, Manager, Collaborator
  • Admin: Full access — manages all employees and vacation requests
  • Manager: Approves/rejects requests for their team
  • Collaborator: Can only view/create their own vacation requests
  • Overlap Rule: No two employees can have overlapping vacation dates (validated at domain + database level)
  • Statuses: Pending → Approved / Rejected / Cancelled

Quick Start with Docker

# Clone the repository
git clone https://github.com/Remisu/LeaveFlow.git
cd LeaveFlow
# Start all services
docker-compose up --build
# Access the application# Frontend: http://localhost:3000# Gateway: http://localhost:5000# Identity: http://localhost:5101/swagger# Employee: http://localhost:5102/swagger# Vacation: http://localhost:5103/swagger

Running Without Docker

Prerequisites

1. Create Databases

CREATEDATABASEleaveflow_identity;
CREATEDATABASEleaveflow_employee;
CREATEDATABASEleaveflow_vacation;

2. Start Backend Services

# Terminal 1 — Identity Servicecd src/Services/Identity/LeaveFlow.Identity.API
dotnet run --urls=http://localhost:5101
# Terminal 2 — Employee Servicecd src/Services/Employee/LeaveFlow.Employee.API
dotnet run --urls=http://localhost:5102
# Terminal 3 — Vacation Servicecd src/Services/Vacation/LeaveFlow.Vacation.API
dotnet run --urls=http://localhost:5103
# Terminal 4 — API Gatewaycd src/ApiGateway/LeaveFlow.ApiGateway
dotnet run --urls=http://localhost:5000

3. Start Frontend

cd src/Frontend/leaveflow-ui
npm install
npm run dev

Open http://localhost:3000


Default Credentials

RoleEmailPassword
Adminadmin@leaveflow.comAdmin@123
Managermanager@leaveflow.comManager@123
Collaboratorjohn@leaveflow.comCollab@123
Collaboratoralice@leaveflow.comCollab@123

API Documentation

Each service exposes Swagger UI:

Key Endpoints

POST /api/auth/login — Authenticate and get JWT token
GET /api/employees — List employees (paginated)
POST /api/employees — Create employee (Admin only)
PUT /api/employees/{id} — Update employee (Admin only)
DELETE /api/employees/{id} — Delete employee (Admin only)
GET /api/vacations — List vacation requests (paginated)
POST /api/vacations — Create vacation request
PUT /api/vacations/{id} — Update vacation request
POST /api/vacations/{id}/review — Approve/reject (Manager/Admin)
POST /api/vacations/{id}/cancel — Cancel own request
GET /api/vacations/calendar — Calendar view data

Testing the Overlap Rule

  1. Login as john@leaveflow.com
  2. Create a vacation request for July 1–5
  3. Login as alice@leaveflow.com
  4. Try to create a vacation request for July 3–7
  5. You should receive a 409 Conflict response:
{
"statusCode": 409,
"message": "The requested vacation dates overlap with an existing approved or pending vacation request."
}

The overlap check validates:

  • At the domain layer via VacationRequest.OverlapsWith()
  • At the database layer via HasOverlappingVacationAsync()
  • At the service layer in command handlers before persisting

Views and UI

PageDescription
LoginClean authentication form with credential hints
DashboardStatistics cards showing request counts
EmployeesAdmin-only CRUD table with pagination
VacationsRequest list with create/cancel actions
ApprovalsPending requests with approve/reject workflow
CalendarMonthly view with color-coded vacation blocks

Project Structure

LeaveFlow/
├── docker-compose.yml
├── Directory.Build.props
├── LeaveFlow.sln
├── README.md
├── scripts/
│ └── init-databases.sql
├── src/
│ ├── ApiGateway/
│ │ └── LeaveFlow.ApiGateway/
│ ├── BuildingBlocks/
│ │ └── LeaveFlow.Shared/ # DTOs, Enums, Exceptions
│ ├── Services/
│ │ ├── Identity/
│ │ │ ├── LeaveFlow.Identity.Domain/
│ │ │ ├── LeaveFlow.Identity.Application/
│ │ │ ├── LeaveFlow.Identity.Infrastructure/
│ │ │ └── LeaveFlow.Identity.API/
│ │ ├── Employee/
│ │ │ ├── LeaveFlow.Employee.Domain/
│ │ │ ├── LeaveFlow.Employee.Application/
│ │ │ ├── LeaveFlow.Employee.Infrastructure/
│ │ │ └── LeaveFlow.Employee.API/
│ │ └── Vacation/
│ │ ├── LeaveFlow.Vacation.Domain/
│ │ ├── LeaveFlow.Vacation.Application/
│ │ ├── LeaveFlow.Vacation.Infrastructure/
│ │ └── LeaveFlow.Vacation.API/
│ └── Frontend/
│ └── leaveflow-ui/ # React + TypeScript + Vite

Future Improvements

  • Email notifications for request status changes
  • Vacation balance / annual allowance tracking
  • Team calendar with manager-level filtering
  • RabbitMQ / Azure Service Bus for inter-service messaging
  • Redis caching layer
  • Rate limiting on the API Gateway
  • Health checks and readiness probes
  • Unit and integration test projects
  • CI/CD pipeline (GitHub Actions)
  • Kubernetes deployment manifests
  • Audit trail / event sourcing

License

This project is open source and available under the MIT License.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages