Skip to content

Theo-Valembrun/leave-request-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ‡­πŸ‡Ή Haitian Leave Management System

Système de Gestion des Congés | Leave Management Application

Enterprise-grade leave management fully compliant with the Haitian Labor Code

React TypeScript Node.js PostgreSQL Tailwind CSS License

Features β€’ Quick Start β€’ Demo Accounts β€’ Architecture β€’ Legal Compliance


✨ Features

🏒 Enterprise-Grade Leave Management

  • Three-Step Approval Workflow: Employee β†’ Manager β†’ HR Admin
  • Role-Based Access Control (RBAC): 4 roles with granular permissions
  • Organizational Hierarchy: Flexible reporting structure with line managers
  • Real-time Notifications: Instant alerts for approvals and status changes

🌍 Bilingual Interface

  • Full French/English Support: Toggle language globally
  • Localized Date Formats: Respects regional preferences
  • Bilingual Notifications: All messages in both languages

🎨 Modern User Experience

  • Light/Dark Theme: System-aware theme switching
  • Responsive Design: Mobile-first, works on all devices
  • Dashboard Analytics: Visual insights for HR and managers

πŸ” Production-Ready Security

  • JWT Authentication: Secure token-based auth
  • Flexible Login: Use Email OR Employee ID (Matricule)
  • Forced Password Reset: First-login security compliance
  • Audit Logging: Complete trail of all actions
  • Account Lockout: Protection against brute-force attacks

πŸš€ Quick Start

Prerequisites

  • Node.js 18.x or higher
  • PostgreSQL 14.x or higher
  • npm or yarn

One-Command Setup

# Clone and setup
git clone https://github.com/your-org/haitian-leave-management.git
cd haitian-leave-management

# Install all dependencies
npm run setup

# Initialize database (schema + seed data)
npm run db:init

# Start development servers
npm run dev

The application will be available at:

Manual Setup

# 1. Install dependencies
npm install
cd client && npm install
cd ../server && npm install
cd ..

# 2. Configure environment
cp server/.env.example server/.env
# Edit server/.env with your database credentials

# 3. Database setup
psql -U postgres -c "CREATE DATABASE leave_management;"
psql -U postgres -d leave_management -f database/schema.sql
psql -U postgres -d leave_management -f database/migrations/001_production_ready.sql
psql -U postgres -d leave_management -f database/seed.sql

# 4. Start servers
npm run dev

πŸ‘€ Demo Accounts

⚠️ SECURITY NOTICE: These credentials are for development/demo purposes only.
In production: Delete seed data and create accounts via HR Admin panel.

All demo accounts use the password: password123

Role Name User ID (Matricule) Email Notes
Super Admin Admin Root ADM-000 admin@techietheo.ht Full system access
HR Admin Sarah Cadet HR-001 sarah.hr@techietheo.ht User management, policy configuration
Manager Paul Saint-Fleur MGR-001 paul.manager@techietheo.ht IT Head, has 2 pending approvals
Employee Jean Baptiste EMP-004 jean.user@techietheo.ht IT Support, 2 years tenure

πŸ’‘ Tip: You can login using either the Email or Matricule with the password.


πŸ—οΈ Architecture

haitian-leave-management/
β”œβ”€β”€ πŸ“ client/                 # React Frontend (Vite)
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/        # Reusable UI components
β”‚   β”‚   β”œβ”€β”€ pages/             # Route pages
β”‚   β”‚   β”œβ”€β”€ stores/            # Zustand state management
β”‚   β”‚   β”œβ”€β”€ i18n/              # Translations (FR/EN)
β”‚   β”‚   └── lib/               # Utilities
β”‚   └── ...
β”‚
β”œβ”€β”€ πŸ“ server/                 # Node.js Backend (Express)
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ controllers/       # Route handlers
β”‚   β”‚   β”œβ”€β”€ services/          # Business logic
β”‚   β”‚   └── ...
β”‚   └── ...
β”‚
β”œβ”€β”€ πŸ“ database/               # PostgreSQL
β”‚   β”œβ”€β”€ schema.sql             # Core database schema
β”‚   β”œβ”€β”€ migrations/            # Schema migrations
β”‚   β”‚   └── 001_production_ready.sql
β”‚   └── seed.sql               # Demo data (Techie Theo)
β”‚
└── πŸ“ shared/                 # Shared TypeScript types
    └── types/

Tech Stack

Layer Technology Purpose
Frontend React 18, TypeScript, Vite Modern SPA with type safety
Styling Tailwind CSS, Framer Motion Utility-first CSS with animations
State Zustand Lightweight state management
Forms React Hook Form, Zod Form handling with schema validation
Backend Node.js, Express REST API server
Database PostgreSQL Relational data storage
Auth JWT, bcrypt Secure authentication

βš–οΈ Legal Compliance

This application implements leave policies as defined by the Code du Travail HaΓ―tien (Haitian Labor Code).

Leave Entitlements

Leave Type Days Notes
Annual Leave 15 days/year After 12 months of service
Sick Leave 15 days/year Certificate required > 3 days
Maternity Leave 12 weeks (84 days) Start 4 weeks before due date
Bereavement 5 days Immediate family
Marriage 3 days Employee's own marriage

Key Rules Implemented

  • βœ… Minimum Service: 12 months required for annual leave eligibility
  • βœ… Non-Cumulative: Annual leave resets each year (exceptions for Force Majeure)
  • βœ… Medical Certificate: Required for sick leave > 3 days
  • βœ… Maternity Timing: Must start at least 4 weeks before due date
  • βœ… Public Holidays: Haitian holidays automatically excluded from leave calculations

πŸ“Š Database Schema

Core Tables

  • users: Employee records with hierarchy (reports_to_id)
  • departments: Organizational units
  • leave_policies: Configurable rules per leave type/sector
  • leave_balances: Annual entitlements and usage tracking
  • leave_requests: All requests with full workflow state
  • approval_history: Audit trail of all approval actions
  • notifications: User notification system
  • public_holidays: Haitian public holidays
  • audit_logs: Security audit trail

Key Columns (Users)

matricule           -- Unique employee ID (e.g., "EMP-2026-001")
must_change_password -- Force password reset on first login
reports_to_id       -- Direct supervisor (org hierarchy)

πŸ”§ Environment Variables

Create server/.env:

# Database
DATABASE_URL=postgresql://user:password@localhost:5432/leave_management

# Authentication
JWT_SECRET=your-super-secure-secret-change-this
JWT_EXPIRES_IN=8h

# Server
PORT=3000
NODE_ENV=development

# Frontend URL (for CORS)
CLIENT_URL=http://localhost:5173

πŸ“œ API Endpoints

Authentication

Method Endpoint Description
POST /api/auth/login Login with email OR matricule
POST /api/auth/logout Logout current session
POST /api/auth/change-password Change password (required on first login)
POST /api/auth/admin/reset-password Admin: Reset user password
GET /api/auth/me Get current user info

Leave Requests

Method Endpoint Description
GET /api/leaves List leave requests
POST /api/leaves Create new request
GET /api/leaves/:id Get request details
POST /api/leaves/:id/submit Submit draft for approval
POST /api/leaves/:id/approve Approve request
POST /api/leaves/:id/reject Reject request
POST /api/leaves/:id/cancel Cancel own request

Users (HR Admin+)

Method Endpoint Description
GET /api/users List all users
POST /api/users Create new user
PATCH /api/users/:id Update user
POST /api/users/:id/reset-password Reset user password

πŸ“‹ Legal References

  • Code du Travail HaΓ―tien - Articles 148-165 (Annual Leave)
  • DΓ©cret du 17 mai 2005 - Public Service regulations
  • Convention OIT nΒ°132 - International leave standards

πŸ”’ Security Features

  • JWT-based authentication
  • Role-based access control (RBAC)
  • Input validation and sanitization
  • SQL injection prevention
  • XSS protection
  • CORS configuration
  • Rate limiting
  • Password history (prevent reuse)
  • Account lockout after failed attempts

⚠️ Legal Disclaimer

Important: This application implements leave management rules based on the Code du Travail HaΓ―tien (Haitian Labor Code) as of 2024. While every effort has been made to ensure accuracy, this software is provided for informational purposes and should not be considered legal advice.

Organizations should consult with qualified legal professionals to ensure compliance with current labor laws and regulations in Haiti.

The developers are not responsible for any legal consequences arising from the use of this software.


πŸ“„ License

MIT License - See LICENSE file for details.


🀝 Contributing

Contributions are welcome! Please read our contributing guidelines before submitting PRs.

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ€– AI Disclosure

This project was developed with the assistance of GitHub Copilot (powered by Claude), an AI pair programming tool. The AI assisted with:

  • Code generation and architecture decisions
  • Writing boilerplate and repetitive code patterns
  • Debugging and troubleshooting
  • Documentation and README creation
  • Best practices and code optimization suggestions

All AI-generated code was reviewed, tested, and validated by the human developer. The project concept, business logic, and final implementation decisions remain the responsibility of the author.


Built with ❀️ for Haiti πŸ‡­πŸ‡Ή

Konstriksyon ak lanmou pou Ayiti

About

πŸ‡­πŸ‡Ή Leave Management System for Haitian companies - Full-stack app with React, Node.js, PostgreSQL. Features: multi-role approval workflow, bilingual (FR/EN), dark mode, analytics dashboard.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors