How sameerean/flight-booking works
Project type and purpose
• This is a Spring Boot–based REST API application providing flight-booking and lookup services. It is not a full multi-tier web app; rather, it’s a single deployable monolith that exposes REST endpoints for clients (web/mobile) and serves a minimal static UI and Swagger documentation.
File structure
• Top-level artifacts: Maven wrapper (mvnw, .mvn, pom.xml), application entrypoint (Application.java), and configuration classes (JpaConfig, SwaggerConfig).
• Layered package layout under src/main/java/com/dxbair/services/flightbooking:
• airport, flight, passenger, booking packages each with Controller, Service interface + impl, exceptions, and DTO model/converter subpackages.
• domain/entity for JPA entities and domain/repo for Spring Data JPA repositories.
• boot/DataLoader for initial CSV data import.
• system for global exception handling.
• Resources: application properties, CSV data files, static index.html, and H2 console config.
Extract insights from the README
• Primary endpoints: /bookings?uid={passenger}, /bookings/{id} plus support endpoints under /airports, /flights, /passengers.
• Technologies: Spring MVC (REST), Spring Data JPA, H2 in-memory DB, Swagger UI, JUnit tests.
• Clients (Web UI, Mobile App, CLI/Postman)
• Swagger UI (for API docs & exploratory testing)
• Spring Boot Application
• REST API Layer (Controllers)
• Business Layer (Service interfaces + implementations)
• Data Access Layer (Spring Data JPA Repositories)
• Domain Entities (JPA-annotated)
• Bootstrapping (DataLoader reading CSV → Entities → DB)
• Exception Handling (RestResponseEntityExceptionHandler)
• H2 In-Memory Database (with optional H2 Console as admin UI)
• Static resources (index.html)
b. Relationships & data flow:
1. Client → HTTP request → Controller
2. Controller → calls Service → Service applies business rules → invokes Repository
3. Repository → JPA → H2 Database → returns Entity
4. Service → Model converter → API DTO → Controller → HTTP response → Client
5. On startup: DataLoader reads CSVs → populates repositories → DB.
6. Swagger UI served by Spring Boot → interacts with Controllers.
7. H2 Console served separately → direct DB access.
c. Architectural patterns & principles:
• Layered (Presentation/Controller, Service, Repository)
• DTO conversion (separating domain entities from API models)
• Exception handling via a global handler
• Configuration classes externalize settings (JPA, Swagger)
• In-memory DB for ease of testing/development
d. Key technologies & frameworks:
• Spring Boot (auto-configuration, embedded Tomcat)
• Spring MVC (REST controllers)
• Spring Data JPA + Hibernate
• H2 Database + H2 Console
• Swagger (API documentation)
• Maven build lifecycle