Description: Breakable-Toy is a full-stack flight search application that leverages the Amadeus REST API to provide a user-friendly interface for finding and exploring flights. The application allows users to search for flights by specifying key parameters such as departure and arrival airports, travel dates, the number of travelers, currency, and whether they prefer non-stop flights. It dynamically integrates airport search functionality for users unfamiliar with IATA codes and enforces robust input validations for dates and parameters.
The application offers a comprehensive view of flight details, including departure and arrival times, airline and airport information, total flight duration (including layovers), and pricing breakdowns in the selected currency. Users can sort the results by price and duration and explore detailed flight segments, cabin amenities, and fare breakdowns. Support for roundtrip searches ensures that departing and returning flights are displayed with all necessary details.
Before proceeding, ensure you have the following installed:
- Docker (with Docker Compose support)
- A valid Amadeus API account to generate API credentials.
- Git to clone the repository.
-
Open your terminal.
-
Clone the project repository:
git clone https://github.com/your-username/breakable-toy.git](https://github.com/DerekAyalaDev/breakable-toy.git
-
Navigate to the project directory:
cd breakable-toy
- Go to Amadeus for Developers.
- Sign up or log in to your account.
- Create a new application and obtain the following credentials:
- API Key
- API Secret
- Base URL (e.g.,
https://test.api.amadeus.com
for testing) - Token URL (usually
https://test.api.amadeus.com/v1/security/oauth2/token
)
-
Navigate to the
Backend
directory:cd Backend
-
Create a new file named
.env
. -
Add the following content to the
.env
file, replacing the placeholder values with your Amadeus API credentials:# Amadeus API credentials AMADEUS_API_KEY=your_amadeus_api_key AMADEUS_API_SECRET=your_amadeus_api_secret # Base URL for Amadeus API (without version) AMADEUS_BASE_URL=https://test.api.amadeus.com # Token URL for authentication AMADEUS_TOKEN_URL=https://test.api.amadeus.com/v1/security/oauth2/token
-
Ensure you are in the
Backend
directory:cd Backend
-
Before building the docker image we need to create the jar file:
./gradlew build
-
Build the backend Docker image:
docker build -t backend-image .
-
Return to the root project directory:
cd ..
-
Navigate to the
frontend
directory:cd frontend
-
Build the frontend Docker image:
docker build -t frontend-image .
-
Return to the root project directory:
cd ..
-
From the root directory of the project, run the following command to start both services (backend and frontend):
docker-compose up
-
Docker Compose will:
- Start the backend service on port
9090
. - Start the frontend service on port
8080
.
- Start the backend service on port
-
You can access the frontend by navigating to http://localhost:8080 in your web browser.
- Open http://localhost:8080 in your browser.
- Enter search criteria for flights in the UI and click the "Search" button.
- Confirm that the backend is running by checking its logs in the terminal.
- The backend is accessible at http://localhost:9090 (if needed for direct API testing).
-
Dependencies: Ensure the
.env
file is correctly created in the backend directory; otherwise, the backend will not start successfully. -
Docker Cleanup: To stop the services, press
Ctrl+C
in the terminal where Docker Compose is running. To remove containers, run:docker-compose down
-
Backend Fails to Start
- Ensure the
.env
file exists and contains valid Amadeus API credentials. - Verify that the ports
9090
(backend) and8080
(frontend) are not already in use.
- Ensure the
-
Docker Compose Error
- Ensure that the
docker-compose.yml
file is correctly configured. - Verify Docker is installed and running.
- Ensure that the
-
Frontend Issues
- Ensure that the frontend is properly built using the Dockerfile.
- Clear browser cache if UI changes are not reflected.
This guide ensures that you can set up, run, and test the Breakable-Toy project successfully. If you encounter issues not covered here, consult Docker or application-specific documentation.