How vimal-sabari/cloud-native-ride-dispatch-platform works
This is an AWS event-driven ride-dispatch platform. Riders request rides and drivers send location/status updates; the platform persists these changes, forwards DynamoDB stream events through queues, matches rides to nearby available drivers, confirms assignments, and notifies rider and driver clients over WebSockets. The graph also preserves authentication, stale-match recovery, and simulator capabilities. Several internal implementations are unsampled, so links to them rely on the README or are marked unverified.
Main entry points: request-ride.ts Trip handlers · event-forwarder/main.go Stream forwarder · matching-service/main.go Matching daemon · batch.go Batch matching
Components 25
API and auth
- REST API
- JWT authorizer
services/auth-stub/src/authorizer.ts - Token issuer
services/auth-stub/src/issue-token.ts
Location and matching
- Location handlers
services/location-service/internal/handler/location.go - Driver status
services/location-service/internal/handler/status.go - Stream forwarder
services/event-forwarder/cmd/event-forwarder/main.go - Event classifier
services/event-forwarder/internal/classify/classify.go - Matching daemon
services/matching-service/cmd/matching-service/main.go - Batch matching
services/matching-service/internal/matcher/batch.go - Spatial index
services/matching-service/internal/geoindex/geoindex.go - Hungarian solver
shared/matching-algorithms/hungarian.go - Assignment protocol
services/matching-service/internal/assignment/assignment.go
Ride lifecycle
- Trip handlers
services/trip-service/src/handlers/request-ride.ts - Stale-match recovery
services/trip-service/src/handlers/reassign-stale-matches.ts - Ride state machine
services/trip-service/src/state-machine.ts
Events and notifications
- SNS fanout
services/notification-service/src/handlers/sns-fanout.ts - WebSocket connections
services/notification-service/src/connection-manager.ts
Clients and shared logic
- Driver simulator
simulators/driver-simulator/src/driver-loop.ts - Rider simulator
simulators/rider-simulator/src/rider-loop.ts
Other components
- Rider client
- Driver client
- DynamoDB
- SQS event queues
- Match events
- WebSocket API
Connections 32
- Rider client → REST API: requests rides
- Driver client → REST API: sends telemetry
- REST API → JWT authorizer: validates JWT
- REST API → Location handlers: routes updates
- REST API → Trip handlers: routes ride requests
- Location handlers → DynamoDB: writes heartbeat
- Driver status → DynamoDB: updates status
- Trip handlers → DynamoDB: creates ride
- Trip handlers → Ride state machine: changes state
services/trip-service/src/state-machine.ts - DynamoDB → Stream forwarder: streams changes
- Stream forwarder → Event classifier: classifies records
services/event-forwarder/cmd/event-forwarder/main.go - Stream forwarder → SQS event queues: forwards events
- SQS event queues → Matching daemon: delivers events
- Matching daemon → Batch matching: processes requests
services/matching-service/cmd/matching-service/main.go - Batch matching → Spatial index: finds nearby drivers
services/matching-service/internal/matcher/batch.go - Batch matching → Hungarian solver: solves assignments
- Matching daemon → Assignment protocol: claims drivers
- Assignment protocol → DynamoDB: claims atomically
- Assignment protocol → REST API: confirms assignment
- Stale-match recovery → DynamoDB: queries and updates
services/trip-service/src/handlers/reassign-stale-matches.ts - Stale-match recovery → SQS event queues: re-enqueues ride
services/trip-service/src/handlers/reassign-stale-matches.ts - Trip handlers → Match events: publishes ride event
- Match events → SNS fanout: fans out events
- SNS fanout → DynamoDB: looks up connections
services/notification-service/src/handlers/sns-fanout.ts - SNS fanout → WebSocket connections: pushes notifications
services/notification-service/src/handlers/sns-fanout.ts - WebSocket connections → WebSocket API: posts frames
services/notification-service/src/connection-manager.ts - WebSocket API → Rider client: delivers updates
- WebSocket API → Driver client: delivers updates
- Driver simulator → REST API: sends driver traffic
- Rider simulator → REST API: sends rider traffic
- Rider simulator → Token issuer: requests token
- Driver simulator → Token issuer: requests token