How gm-gautam12/airline_booking_service works
Project type & purpose
• This is a standalone Node.js/Express microservice—part of a larger Airline Management ecosystem—responsible for airline seat booking and payment processing.
• Key indicators:
• README: “Another Service of Airline Management system…handling booking of airlines and payment.”
• File tree: Typical Express folder layout (controllers, services, repositories, models, routes), Sequelize migrations, config and utils.
Core architectural layers & patterns
• Layered (n-tier) architecture:
• API Layer: Express routes → controllers
• Business Logic Layer: services
• Data Access Layer: repositories → ORM models → database
• Cross-cutting concerns: config, logging, error handling, middlewares, cron-jobs
• Repository pattern for DB access (crud-repository.js, booking-repository.js).
• MVC-style separation: route definitions delegate to controllers, which invoke services.
Main components
a. External Clients & Entry Points
• Mobile/web UI or other backend services → HTTP requests
• (Optionally) API Gateway or Service Mesh in front
b. Booking & Payment Service
• Routes (src/routes)
• Controllers (src/controllers)
• Middlewares (src/middlewares)
• Services (src/services)
• Repositories + Sequelize Models (src/repositories, src/models)
• Migrations (src/migrations)
• Utils & common libs (src/utils/common, errors, helpers)
c. Persistence Layer
• Relational Database (e.g., PostgreSQL/MySQL)
d. External Systems
• Payment Gateway (Stripe, PayPal, etc.)
• (Optional) Message broker / event bus for async notifications
e. Scheduling
• Cron Jobs (src/utils/common/cron-jobs.js) for cleanup, reminders
Relationships & data flows
1. Client → (API Gateway) → Express Route
2. Route → Controller → Service
3. Service → Repository → Database
4. Service → Payment Gateway (HTTP/webhook)
5. Cron Job → Service → Database or External Systems
• Error flows: Controller ↔ Middleware for validation/auth/logging
• Config & Logger modules injected at startup