|
1 | | -# Scalable Event-Driven Ride-Sharing Platform |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | | - |
| 1 | +# 🚖 Scalable Event-Driven Ride-Sharing Platform |
| 2 | +### Real-Time Surge Pricing • Dispatch Matching • Driver Telemetry |
| 3 | +**Author: Corey Leath** |
8 | 4 |
|
9 | 5 | --- |
10 | 6 |
|
11 | | -## Overview |
| 7 | +# 🏆 Badges |
| 8 | + |
| 9 | +### 🟦 **Big Tech System Design Patterns** |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | +### 🟩 **Engineering Quality Badges** |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | +--- |
12 | 28 |
|
13 | | -This project implements a **Scalable, Event-Driven Architecture** for a next-gen ride-sharing platform. |
| 29 | +# 📘 Overview |
14 | 30 |
|
15 | | -Core components: |
16 | | -✅ Microservices architecture |
17 | | -✅ Event-driven messaging (Kafka) |
18 | | -✅ Real-time driver & rider matching |
19 | | -✅ Scalable system design |
| 31 | +This project is a **real-time, event-driven ride-sharing platform** modeled after the core architecture used by companies such as **Uber, Lyft, and DoorDash**. |
20 | 32 |
|
21 | | ---- |
| 33 | +It includes: |
22 | 34 |
|
23 | | -## Business Impact |
| 35 | +- Real-Time **Surge Pricing Engine** |
| 36 | +- **Dispatch Matching System** (driver–rider assignment) |
| 37 | +- **Driver Location Streaming** |
| 38 | +- **Trip Management Pipeline** |
| 39 | +- Fully asynchronous event-driven architecture |
| 40 | +- Modular microservices designed for horizontal scaling |
24 | 41 |
|
25 | | -Modern ride-sharing platforms demand: |
26 | | -- **Real-time event processing** |
27 | | -- **High availability & fault tolerance** |
28 | | -- **Scalable architecture for peak loads** |
| 42 | +This project demonstrates **L5–L6 Big Tech engineering quality**, focusing on: |
29 | 43 |
|
30 | | -This project demonstrates the architecture of an **industry-grade mobility platform**. |
| 44 | +- Distributed systems |
| 45 | +- Concurrency |
| 46 | +- Streaming pipelines |
| 47 | +- Microservice decomposition |
| 48 | +- System design principles |
31 | 49 |
|
32 | 50 | --- |
33 | 51 |
|
34 | | -## Architecture |
| 52 | +# 🚀 Technologies Used (Actual Repo Stack) |
35 | 53 |
|
36 | | - |
| 54 | +| Component | Technology | |
| 55 | +|----------|------------| |
| 56 | +| Language | Python | |
| 57 | +| Web Framework | FastAPI | |
| 58 | +| Concurrency | AsyncIO | |
| 59 | +| Validation | Pydantic | |
| 60 | +| Event Streaming | Custom Async EventBus | |
| 61 | +| Architecture | Microservices + PUB/SUB | |
| 62 | +| Logging | Python Logging | |
| 63 | +| Utils | UUID generation, timestamps, zone mapping | |
37 | 64 |
|
38 | 65 | --- |
39 | 66 |
|
40 | | -## Key Features |
| 67 | +# 🧠 System Architecture |
41 | 68 |
|
42 | | -- Asynchronous driver-rider matching |
43 | | -- Geo-distributed architecture |
44 | | -- Event sourcing with Kafka |
45 | | -- RESTful API endpoints |
| 69 | + ┌──────────────────────┐ |
| 70 | + │ Driver Location │ |
| 71 | + │ Service │ |
| 72 | + └─────────┬────────────┘ |
| 73 | + │ emits location events |
| 74 | + ▼ |
| 75 | + ┌────────────────────────────────────────────────────┐ |
| 76 | + │ EVENT BUS │ |
| 77 | + │ (Async PUB/SUB system powering real-time flow) │ |
| 78 | + └─────────────────────────┬──────────────────────────┘ |
| 79 | + │ |
| 80 | + ┌────────────────┼─────────────────┐ |
| 81 | + ▼ ▼ ▼ |
| 82 | + ┌────────────────┐ ┌───────────────┐ ┌────────────────┐ |
| 83 | + │ Pricing Service │ │ Dispatch │ │ Trip Mgmt │ |
| 84 | + │ (Surge Engine) │ │ Service │ │ Service │ |
| 85 | + └────────────────┘ └───────────────┘ └────────────────┘ |
| 86 | + │ │ │ |
| 87 | + ▼ ▼ ▼ |
| 88 | + Real-Time API Match Results Trip Status |
| 89 | +# 🔄 Real-Time Data Flow |
46 | 90 |
|
47 | | ---- |
| 91 | +Producer simulates supply/demand events |
| 92 | + |
| 93 | +PricingConsumer computes surge multipliers |
| 94 | + |
| 95 | +Surge updates pushed to internal cache |
48 | 96 |
|
49 | | -## Tech Stack |
| 97 | +Dispatch Service consumes rider requests |
50 | 98 |
|
51 | | -- Python |
52 | | -- Kafka |
53 | | -- FastAPI |
54 | | -- Docker |
| 99 | +Driver Location Service streams live positions |
| 100 | + |
| 101 | +Matching engine assigns driver → rider |
| 102 | + |
| 103 | +Trip Management Service handles lifecycle |
| 104 | + |
| 105 | +yaml |
| 106 | +Copy code |
55 | 107 |
|
56 | 108 | --- |
57 | 109 |
|
58 | | -## Future Work |
| 110 | +# 📦 Microservices Included |
| 111 | + |
| 112 | +### ✔ Pricing Service |
| 113 | +- Computes surge pricing |
| 114 | +- Exposes `/pricing/surge/*` API |
| 115 | +- Stream-based producer + consumer |
59 | 116 |
|
60 | | -- Integration with payment services |
61 | | -- Predictive demand modeling |
62 | | -- Cloud-native deployment (AWS/GCP) |
| 117 | +### ✔ Dispatch Service *(coming in next commits)* |
| 118 | +- Assigns drivers to riders |
| 119 | +- Computes ETAs |
| 120 | +- Emits MatchResultEvents |
| 121 | + |
| 122 | +### ✔ Driver Location Service *(coming in next commits)* |
| 123 | +- Streams live driver locations |
| 124 | +- Maintains zone-based availability |
| 125 | + |
| 126 | +### ✔ Trip Management Service *(coming in next commits)* |
| 127 | +- Creates trips |
| 128 | +- Completes trips |
| 129 | +- Sends PaymentEvents |
63 | 130 |
|
64 | 131 | --- |
65 | 132 |
|
66 | | -## License |
| 133 | +# ⚙️ Running the Pricing Service |
| 134 | + |
| 135 | +```bash |
| 136 | +uvicorn src.pricing-service.main:app --reload --port 8001 |
67 | 137 |
|
68 | | -MIT License |
|
0 commit comments