Open this on a laptop
The canvas needs room: requirements on one side, live feedback on the other. Any screen 1024px or wider works.
Design Uber
hardDrivers report where they are every few seconds; riders get the nearest free one; every trip is kept.
The problem
Build ride hailing like Uber. Drivers' apps report their position every few seconds; a rider asks for a car and gets the nearest free driver.
Most of the traffic is drivers' positions: one every 5 seconds from every driver online, each only true for a moment. Trips are far fewer, and must never be lost.
Two riders must never get the same driver.
What it must do
- Track drivers. Each driver's app sends its position every few seconds. The positions live in memory, filed by map tile (Uber used S2 cells, later H3 hexagons).
- Match. Find free drivers in the rider's tile and its neighbours, offer the ride to the best one down an open line to their phone, and claim them in one locked step so nobody else can.
- Record trips. Every trip's progress (requested, accepted, started, ended, paid) is saved for good, split across databases by trip ID.
What you'll learn
- Start with the simplest design that works
- Keep running when a server dies
- Keep fast-changing data in memory
- Tell drivers the moment a ride is theirs
- Split the map so it can grow
- Split the records when saves outgrow one database