This project is an airline aggregation system that allows users to search for and book flights from multiple airlines.
The system is designed with a microservices architecture, separating concerns into distinct services for better scalability and maintainability.
graph TD
subgraph User Interface
A[Website]
end
subgraph Services
C(Flight Search Service)
D(Flight Booking Service)
E(Airline Management Service)
end
subgraph Core Logic
F(Cred-Air Core)
end
subgraph Database
G[(PostgreSQL)]
end
A --> C
A --> D
A --> E
C --> F
D --> F
E --> F
F --> G
The project is divided into the following modules:
website: A React-based frontend for user interaction.cred-air-core: The core module containing shared business logic, data models, and database interactions.airline-mgt-service: Manages airline data and onboarding.flight-search-service: Provides flight search functionality.flight-booking-service: Handles the flight booking process.
Here's a more detailed look at the components within each service:
graph TD
subgraph Airline Management Service
A[AirlineResource]
B[WebhookResource]
C[AirlineManager]
D[AirlineDao]
end
A --> C
B --> C
C --> D
graph TD
subgraph Flight Search Service
A[FlightSearchResource]
B[FlightSearchManager]
C[FlightDao]
D[FlightsMaterializedViewDao]
end
A --> B
B --> C
B --> D
graph TD
subgraph Flight Booking Service
A[BookingResource]
B[BookingManager]
C[BookingDao]
D[PaymentProvider]
end
A --> B
B --> C
B --> D
To run all the services, use the run.sh script:
./run.shAlternatively, you can run each service individually. To run any of the services, navigate to the service's root directory and execute the following Maven command:
mvn clean install exec:java -Dexec.args="server src/main/resources/server-config.yml"Or, run each service from the project root:
-
Airline Management Service:
mvn -pl airline-mgt-service clean install exec:java -Dexec.args="server airline-mgt-service/src/main/resources/server-config.yml" -
Flight Search Service:
mvn -pl flight-search-service clean install exec:java -Dexec.args="server flight-search-service/src/main/resources/server-config.yml" -
Flight Booking Service:
mvn -pl flight-booking-service clean install exec:java -Dexec.args="server flight-booking-service/src/main/resources/server-config.yml"
- Language: Kotlin
- Framework: Dropwizard
- Frontend: React
- Build Tool: Maven
- Database: PostgreSQL
- Modularity: The system is divided into independent modules, each with a specific responsibility. This promotes separation of concerns and makes the system easier to maintain and scale.
- Interfaces: We will make extensive use of interfaces to promote loose coupling and plug-and-play architecture. This will allow us to easily swap out implementations without affecting other parts of the system.
- JDK 21 or higher
- Maven 3.6+
- PostgreSQL 12+
- Node.js 16+ (for website)
- Yarn (for website dependency management)
- Install PostgreSQL
- Create a database named
credair - Run migration scripts from
cred-air-core/src/main/resources/db/migration/
Each service requires configuration files in src/main/resources/server-config.yml. Update database connection details and other environment-specific settings.
GET /search- Search for flightsGET /health- Health check
POST /booking- Create a new bookingGET /booking/{id}- Get booking detailsPOST /webhook- Handle payment webhooksGET /health- Health check
GET /airlines- List all airlinesPOST /airlines- Create new airlinePOST /webhook- Handle airline webhooksGET /health- Health check
Run tests for all modules:
mvn clean testRun tests for a specific module:
mvn -pl <module-name> test-
Build and test all services:
mvn clean install
-
Run all services:
./run.sh
-
Access the website at
http://localhost:3000
cred-air/
├── airline-mgt-service/ # Airline management microservice
├── flight-search-service/ # Flight search microservice
├── flight-booking-service/ # Flight booking microservice
├── cred-air-core/ # Shared core library
├── website/ # React frontend application
├── run.sh # Script to run all services
├── pom.xml # Root Maven configuration
├── README.md # This file
└── architecture.md # Detailed system architecture
- Follow the existing code style and patterns
- Write tests for new functionality
- Update documentation as needed
- Ensure all tests pass before submitting changes
- Port conflicts: Ensure ports 8081, 8082, 8083 are available
- Database connection: Verify PostgreSQL is running and credentials are correct
- Build failures: Run
mvn clean installto resolve dependency issues
Service logs are available in the console output when running services individually or via run.sh.