A full-stack enterprise web platform for managing medical leave records, document handling, and HR analytics.
Features β’ Architecture β’ Tech Stack β’ Getting Started β’ API Documentation
SIGI (Sistema de GestiΓ³n de Incapacidades) is a comprehensive web platform designed to streamline the registration, administration, and tracking of medical leave records within an organization.
The system centralizes information, reduces redundant processes, improves traceability, and provides powerful analytical tools for Human Resources departments.
- Medical Leave Registration β Complete CRUD operations for medical leave records with status workflow management
- Document Management β Upload, validate, and store supporting documents with Supabase Storage integration
- Status Workflow β Track leave requests through states: Registered β Accepted β Rejected β Paid
- Employee Portal β Self-service interface for employees to view and manage their leave records
- Interactive Dashboard β Real-time statistics with Chart.js visualizations
- PDF/CSV Reports β Generate downloadable reports for HR and accounting
- Email Reports β Automated report distribution to stakeholders
- Metrics Tracking β Monthly leave counts, average processing times, accumulated values
- JWT Authentication β Secure token-based authentication system
- Role-Based Authorization β Granular access control with guards (Admin, HR, Employee)
- Password Recovery β Secure password reset flow with email verification
- Audit Logging β Complete traceability of critical system activities
- Automated Email Alerts β Notifications for status changes and important updates
- HR Alerts β Alerts for pending actions and deadlines
- Configurable SMTP β Support for various email providers (Gmail, SendGrid, etc.)
- Company Management β Support for multiple organizations
- User-Company Relations β Users scoped to specific companies
- Company-level Reports β Isolated data and reporting per organization
The project follows a modular monorepo structure with clear separation of concerns:
SIGI/
βββ api/ # Backend (NestJS)
β βββ src/
β β βββ common/ # Shared decorators, guards, filters, pipes
β β βββ config/ # App, database, and mail configuration
β β βββ database/ # Entities, migrations, seeds
β β βββ infraestructure/# External adapters (email, storage, etc.)
β β βββ modules/ # Business domain modules
β β βββ auth/ # Authentication & authorization
β β βββ users/ # User management
β β βββ employees/ # Employee data management
β β βββ incapacities/# Core medical leave logic
β β βββ documents/ # Document upload & validation
β β βββ reports/ # PDF/CSV report generation
β β βββ statistics/ # Analytics & dashboard data
β β βββ notifications/# Email notification system
β β βββ audit/ # Activity logging
β β βββ empresas/ # Company management
β β βββ integrations/# External system connections
β βββ docs/ # API documentation
β
βββ app/ # Frontend (Angular 20)
βββ src/app/
βββ core/ # Guards, interceptors, services
βββ layout/ # Main layout components
βββ shared/ # Reusable components & utilities
βββ modules/ # Feature modules
βββ auth/ # Login, register, password recovery
βββ hr/ # HR dashboard & management
βββ employment/ # Employee features
βββ companies/ # Company administration
Each backend module follows a clean architecture pattern:
/modules/<module-name>/
βββ controllers/ # HTTP endpoints
βββ services/ # Business logic
βββ repositories/ # Database access layer
βββ entities/ # ORM models
βββ dtos/ # Data transfer objects
βββ mappers/ # Entity β DTO transformations
βββ <module>.module.ts # NestJS module definition
| Technology | Purpose |
|---|---|
| NestJS 11 | Node.js framework for scalable server-side applications |
| TypeScript 5.7 | Type-safe development |
| Supabase | PostgreSQL database & file storage |
JWT (@nestjs/jwt) |
Token-based authentication |
| Swagger/OpenAPI | API documentation & testing interface |
| PDFKit | PDF report generation |
| Nodemailer | Email sending capabilities |
| Handlebars | Email template engine |
| class-validator | Request validation with decorators |
| bcrypt | Password hashing |
| Technology | Purpose |
|---|---|
| Angular 20 | Modern SPA framework with standalone components |
| Angular Material | UI component library |
| Chart.js + ng2-charts | Interactive data visualizations |
| RxJS | Reactive programming for async operations |
| TypeScript 5.8 | Type-safe development |
| SCSS | Advanced CSS styling |
| Technology | Purpose |
|---|---|
| Supabase | Backend-as-a-Service (PostgreSQL + Storage + Auth) |
| Node.js 20+ | JavaScript runtime |
| npm 10+ | Package management |
- Node.js >= 20.x
- npm >= 10.x
- Git
- Supabase account (for database and storage)
git clone https://github.com/MateoMor/SIGI.git
cd SIGI# Navigate to backend directory
cd api
# Install dependencies
npm install
# Copy environment template
cp .env.example .envConfigure your .env file:
# Environment
NODE_ENV=development
PORT=3005
# Supabase (get from your project at supabase.com)
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_SERVICE_ROLE_KEY=your-service-role-key
SUPABASE_ANON_KEY=your-anon-key
# JWT
JWT_SECRET=your-secure-jwt-secret
# Email (optional, for notifications)
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_SECURE=false
MAIL_USER=[email protected]
MAIL_PASSWORD=your-app-password
MAIL_FROM_NAME=SIGI
MAIL_FROM_EMAIL=[email protected]Start the development server:
npm run start:dev# From project root, navigate to frontend
cd app
# Install dependencies
npm install
# Start development server
npm start- Create a project at supabase.com
- Run the SQL migrations in order from
api/src/database/migrations/:001_initial_schema.sql002_add_empresa_to_usuarios.sql003_add_unique_constraint_empresa_nombre.sql004_make_empresa_id_required.sql005_create_password_resets_table.sql
- Create a storage bucket named
documentos - Copy your credentials to the
.envfile
| Service | URL |
|---|---|
| Frontend | http://localhost:4200 |
| Backend API | http://localhost:3000 |
| Swagger Docs | http://localhost:3000/docs |
| OpenAPI JSON | http://localhost:3000/docs-json |
The API is fully documented with Swagger/OpenAPI. Once the backend is running, visit:
- Interactive Docs: http://localhost:3000/docs
- OpenAPI Spec: http://localhost:3000/docs-json
| Document | Description |
|---|---|
| Backend Architecture | Detailed backend structure and module descriptions |
| Authentication | Auth flow, JWT, and security implementation |
| Document Upload | File upload and storage guide |
| Email Service | Email notification configuration |
| Report Generation | PDF/CSV report documentation |
cd api
# Unit tests
npm run test
# Watch mode
npm run test:watch
# Coverage report
npm run test:cov
# E2E tests
npm run test:e2ecd app
# Unit tests
npm test| Module | Description |
|---|---|
auth |
Login, JWT tokens, role-based guards |
users |
User CRUD, role assignment, profile management |
employees |
Employee data, contracts, personal information |
incapacities |
Core medical leave logic with status workflow |
documents |
File upload, validation, storage integration |
reports |
PDF/CSV generation for HR and accounting |
statistics |
Dashboard metrics and chart data |
notifications |
Automated email alerts and notifications |
audit |
Activity logging and change history |
empresas |
Multi-company management |
integrations |
Future connections to EPS, ARL systems |
| Module | Description |
|---|---|
auth |
Login, registration, password recovery |
hr |
HR dashboard, leave management, reports |
employment |
Employee portal and self-service features |
companies |
Company administration and settings |
This project is distributed under the license included in this repository.
See the LICENSE file for details.
Built with β€οΈ using NestJS & Angular


