How kshitijk4poor/logistics-platform works
Main Components
A. External Interfaces Layer:
• Nginx Load Balancer
• API Gateway (FastAPI)
• WebSocket Gateway
B. Core Services Layer:
• Booking Service
• Driver Service
• Tracking Service
• Pricing Service
• Analytics Service
• Admin Service
• Communication Service
• Assignment Service
C. Message Broker Layer:
• Apache Kafka (with multiple topics for different events)
D. Caching Layer:
• Redis Cache
E. Storage Layer:
• PostgreSQL Database
• PgBouncer Connection Pooler
F. Background Processing:
• Celery Workers
• Various Consumers (analytics, booking, demand, location)
[Client Layer]
• ↓
[Gateway Layer]
• ↓
[Services Layer]
• ↓
[Message Broker Layer]
• ↓
[Data Layer]
Key Relationships to Highlight
a. Data Flow Patterns:
• Real-time location updates: Driver → Tracking Service → Kafka → Location Consumer
• Booking Flow: API Gateway → Booking Service → Assignment Service → Driver Service
• Analytics Flow: Various Services → Kafka → Analytics Consumer → Analytics Service
b. Service Dependencies:
• How services communicate through Kafka
• Direct service-to-service communications
• Database access patterns
Implementation Details
[Client Applications] → [Nginx Load Balancer]
• ↓
[FastAPI Gateway + WebSocket Gateway]
• ↓
[Service Mesh]
• Booking Service ←→ Immediate/Scheduled Booking
• Driver Service ←→ Driver Availability
• Tracking Service ←→ Location Updates
• Pricing Service ←→ Dynamic Pricing
• Analytics Service ←→ Data Processing
• Admin Service ←→ Management Functions
• ↓
[Apache Kafka Event Bus]
• ↓
[Consumers Layer]
• ↓
[Data Storage Layer]
• PostgreSQL
• Redis Cache
• PgBouncer
Additional Elements
• Kubernetes deployment boundaries
• Security components (JWT, Rate Limiter)
• Monitoring points (Prometheus/Grafana)
• Circuit breakers and fallback paths