A REST API for managing flights, tickets, orders, and more.
Built with Django, Django REST Framework, JWT authentication, and Docker.
- ✅ JWT authentication (registration & login)
✈️ Management of:- Airplanes & airplane types
- Airports & flight routes
- Flights
- Crew members
- Tickets (read-only)
- Orders (with multiple tickets)
- 🔍 Filtering with
django-filter - 🔁 Many-to-many relations (e.g. crew ↔ flights)
- 💡 Query optimization with
select_related&prefetch_related - 🔢 Pagination at each endpoint
- 📄 Auto-generated Swagger and Redoc API documentation
- User registration and JWT authentication
- Flight and ticket booking system
- Multiple tickets in a single order
- Dynamic seat availability validation
- Crew assignment to flights
- Flight filtering by date, airplane type, route, crew, etc.
- Optimized DB queries to prevent N+1 problem
- Atomic transactions for safe order creation
- Separate serializers for different views (List, Detail, Simple)
- Custom filters using
django_filters - Full API documentation via Swagger UI and Redoc
- Factory boy library for tests
- Python 3.11
git clone https://github.com/Codoeh/airport-reservation-system.git
cd airport-reservation-system
python -m venv venv
# On Linux / macOS
source venv/bin/activate
# On Windows (CMD)
venv\Scripts\activate.bat
# On Windows (PowerShell)
venv\Scripts\Activate.ps1
# Installation for production
pip install -r requirements.txt
# Installation for development
pip install -r requirements.txt -r requirements-dev.txtcp .env.sample .env💡 Generate a Django secret key:
python -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())"
python manage.py migrate
python manage.py createsuperuser
python manage.py runserver# 🔧 For production (only required packages):
docker compose build --build-arg INSTALL_DEV=false
# 🧪 For development (adds testing & linting tools):
docker compose build --build-arg INSTALL_DEV=true
docker compose run web python manage.py migrate
docker compose upOnce started, the app will be available at:
- 🏠 Main: http://localhost:8000
- 📘 Swagger: http://localhost:8000/api/docs/
- 📙 Redoc: http://localhost:8000/api/redoc/
- Register:
POST /api/auth/registration/ - Login (JWT):
POST /api/token/
Auto-generated docs available after running the server:
- Swagger UI: http://localhost:8000/api/docs/
- Redoc: http://localhost:8000/api/redoc/
pip install pytest pytest-djangoThe following tests are recommended:
- ✅ Model tests: e.g. airplane seat calculation
- ✅ Serializer validation tests
- ✅ Endpoint tests: List, Create, Detail
- ✅ Integration tests: Full order with ticket reservation
Test framework:
pytest
To run:pytest