A FastAPI web application that shows incoming flights by country for any airport using the FlightAPI.io API.
- Search flights by 3-letter airport code (e.g., SIN, LAX)
- View number of incoming flights grouped by country
- Clean and responsive UI
- Real-time flight data from FlightAPI.io
- Clone the repository:
git clone https://github.com/Amanpradhan/flights-by-country
cd flights-by-country
- Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
- Create a
.env
file in the root directory and add your FlightAPI.io API key:
FLIGHT_API_KEY=your_api_key_here
- Run the application:
uvicorn app.main:app --reload
- Open your browser and navigate to
http://localhost:8000
- Enter a 3-letter airport code (e.g., SIN for Singapore, LAX for Los Angeles)
- Click "Search Flights" to view incoming flights grouped by country
- Results will be displayed in a table showing countries and their flight counts
The API documentation is automatically generated by FastAPI and can be accessed at:
- Swagger UI:
http://localhost:8000/docs
- ReDoc:
http://localhost:8000/redoc
This application can be deployed to various platforms:
- Create a new Web Service
- Connect your GitHub repository
- Set the build command:
pip install -r requirements.txt
- Set the start command:
uvicorn app.main:app --host 0.0.0.0 --port $PORT
- Add your
FLIGHT_API_KEY
to the environment variables
MIT License