Design the core of a ride-sharing app. A rider requests a ride from a pickup to a destination, the system matches a nearby driver, the ride moves through accepted, in progress and completed, a fare is worked out, and both sides get live updates.
It must
- A rider requests a ride with pickup and drop-off locations.
- The system matches the request to an available driver by a rule (nearest first).
- A ride goes through requested, accepted, in progress, completed (and can be cancelled).
- The fare is worked out from distance and can change with demand (surge).
- The rider and driver are told about every status change.
Keep in mind
- A driver can have only one active ride at a time, even if two riders request at once.
- Matching and pricing rules must be replaceable without touching the ride lifecycle.
- Real maps, payments and driver onboarding are out of scope; locations are simple coordinates.