How gm-gautam12/airline_management works
Project Type and Purpose
• This repository is one microservice in an Airline Management System. It exposes RESTful endpoints for managing airplanes, airports, cities and flights. Internally it follows a clean-architecture (controller → service → repository) and uses Sequelize/ MySQL for persistence. Although README calls out a broader “microservice architecture,” this codebase is a single Node/Express service in that ecosystem.
Main Architectural Components
A. External Clients & API Gateway
– React-based UI or other consumer services invoke HTTP requests.
– (Optional) A lightweight API Gateway or reverse proxy (e.g., NGINX) routes /v1/* to this service.
B. This Node/Express Microservice
1. HTTP Layer
• Express server (src/index.js) listens on configured port.
• Route definitions (src/routes/v1/*.js) group endpoints under /v1.
2. Controller Layer
• Controllers (src/controllers/*) receive requests, validate via middlewares, then call services.
3. Middleware Layer
• Global and per-route middlewares (src/middlewares/*) enforce validation, authentication, logging, error handling.
4. Service Layer
• Business logic (src/services/*) orchestrates operations, applies rules, composes repository calls.
5. Repository Layer
• Data access (src/repositories/*) implements CRUD via Sequelize models, custom queries (src/repositories/queries.js).
6. Persistence
• MySQL database.
• Migrations (src/migrations/*) define schema.
• Seeders (src/seeders/*) populate initial data.
7. Config & Utilities
• Configuration modules (src/config/*) for environment, server, logger.
• Common helpers and response/error utilities (src/utils/*).
Relationships & Data Flow
• Error path: any layer throws → global error handler in middlewares → formatted ErrorResponse.
Architectural Patterns & Design Principles
• Layered/Clean Architecture: clear separation of concerns across controllers, services, repositories.
• Repository Pattern: encapsulates all data-access logic.
• Modularity: each domain (flight, airport, city, airplane) has its own controllers/services/repositories.
• Configurability: centralized config for environment, logging, server settings.