This project is an API for simulating an Uber-like ride-hailing service. It provides endpoints for managing various aspects of the system, including locations, drivers, passengers, and rides.
- Locations API: Manage pickup and drop-off locations
- Drivers API: Handle driver information and availability
- Passengers API: Manage passenger profiles and ride history
- Rides API: Create, track, and manage ride requests
- FastAPI
- Python 3.9+
- Docker
- PostgreSQL (for production)
- Docker and Docker Compose
- Python 3.9 or higher (for local development)
-
Clone the repository:
git clone https://github.com/yourusername/uber-simulation-api.git cd uber-simulation-api
-
Build and run the Docker containers:
Build the development Docker image
docker build -t uber-api-dev -f Dockerfile.dev .
Run the development Docker container
docker run -d \
--name uber-api-dev \
-p 8000:8000 \
-v $(pwd)/app:/code/app \
uber-api-dev
Build the production Docker image
docker build -t uber-api-prod -f Dockerfile.prod .
Run the production Docker container
docker run -d \
--name uber-api-prod \
-p 8000:8000 \
uber-api-prod
- The API will be available at
http://localhost:8000
To run the tests using Docker:
docker-compose -f docker-compose.test.yml up --build
Once the server is running, you can access the interactive API documentation at:
- Swagger UI:
http://localhost:8000/docs
- ReDoc:
http://localhost:8000/redoc
GET /api/v1/locations
: List all locationsPOST /api/v1/locations
: Create a new locationGET /api/v1/locations/{location_id}
: Get details of a specific locationPUT /api/v1/locations/{location_id}
: Update a locationDELETE /api/v1/locations/{location_id}
: Delete a locationGET /api/v1/locations/nearest
: Find the nearest location
GET /api/v1/drivers
: List all driversPOST /api/v1/drivers
: Register a new driverGET /api/v1/drivers/{driver_id}
: Get driver detailsPUT /api/v1/drivers/{driver_id}
: Update driver informationDELETE /api/v1/drivers/{driver_id}
: Remove a driver from the system
GET /api/v1/passengers
: List all passengersPOST /api/v1/passengers
: Register a new passengerGET /api/v1/passengers/{passenger_id}
: Get passenger detailsPUT /api/v1/passengers/{passenger_id}
: Update passenger informationDELETE /api/v1/passengers/{passenger_id}
: Remove a passenger from the system
POST /api/v1/rides
: Request a new rideGET /api/v1/rides/{ride_id}
: Get ride detailsPUT /api/v1/rides/{ride_id}
: Update ride statusGET /api/v1/rides
: List rides (with filtering options)
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Dhruv Parthasarathy - parthasarathy.d@northeastern.edu