A high-performance, concurrent backend system for grouping airport passengers into shared cabs. This system optimizes for minimal travel deviation, strict luggage constraints, and real-time concurrency safety.
- Language: Python 3.11
- Framework: FastAPI (High-performance Async I/O)
- Database: MongoDB (Motor Async Driver)
- Infrastructure: Docker & Docker Compose
- Validation: Pydantic V2
This method automatically sets up the API and the Database in an isolated network.
- Build and Start:
docker-compose up --build
- Verify Status:
The API will launch at
http://localhost:8000.
- Ensure MongoDB is running locally on port
27017. - Install dependencies:
pip install -r requirements.txt
- Run the server:
uvicorn app.main:app --reload
The project includes interactive Swagger/OpenAPI documentation.
- Open your browser to: http://localhost:8000/docs
- You will see three endpoints:
GET /health: System health check.POST /api/v1/book: Request a ride.POST /api/v1/cancel/{ride_id}: Cancel a booking.
1. Booking a Ride (Copy-Paste into Swagger):
{
"user_id": "user_alpha",
"pickup_location": {
"lat": 12.9716,
"lng": 77.5946
},
"dropoff_location": {
"lat": 12.9352,
"lng": 77.6245
},
"seats_needed": 1,
"luggage_count": 2
}