# junior-dev-test-true-african
# π Ride-Sharing Service Backend
## π Overview
A Django-based ride-sharing backend service that demonstrates:
- **Code Versioning** β Git with GitHub Actions CI/CD pipeline
- **Algorithm Design** β Haversine-based driver matching with Uganda-specific optimizations
- **API Integration** β OpenStreetMap integration for real-time geolocation
- **Code Deployment** β Docker containerization for easy deployment
- **Caching System** β Redis integration for optimized performance
## π Features
β
**Smart Ride-Matching**
- Assigns nearest driver using Haversine formula
- Optimized for Uganda's geographical bounds
- Considers driver availability and location
β
**Real-Time Geolocation**
- OpenStreetMap integration via Nominatim
- Geocoding and reverse geocoding
- Distance calculation between locations
- Redis caching for location lookups (24-hour cache)
β
**Performance Optimizations**
- Redis caching system for:
- Geolocation results (24-hour cache)
- Nearby drivers (5-minute cache)
- Ride details (1-hour cache)
- User profiles (1-hour cache)
β
**REST API Endpoints**
- Request rides with location matching
- Real-time ride status tracking
- Driver availability management
β
**Production Ready**
- Containerized with Docker
- CI/CD with GitHub Actions
- PostgreSQL database
- Redis caching
## π Project Structure
```
π¦ ride-sharing-backend
βββ π rides/ β Core ride management
β βββ matching.py β Driver matching algorithm
β βββ models.py β Ride data models
β βββ views.py β API endpoints
β βββ urls.py β URL routing
βββ π drivers/ β Driver management
βββ π riders/ β Rider management
βββ π utils/ β Shared utilities
β βββ geolocation.py β Location services
βββ π tests/ β Test suite
βββ π Dockerfile β Container configuration
βββ π docker-compose.yml β Local development
```
## π οΈ Installation & Setup
### Prerequisites
- Python 3.11+
- Docker and Docker Compose
- PostgreSQL (o β¦