Brief #04 · Backend
Nearest Rider Finder (Geo Search)
Medium⏱ 10-14 hSoon
Match a customer to the closest free rider out of 50,000 moving bikes, in milliseconds.
Outlines are free · building with tracking needs Pro
NThe briefFrom the team
We're a delivery startup. Riders send their location every 5 seconds, and when an order comes in we scan every rider to find the closest. It worked with 300 riders. With 50,000 it takes seconds and the dispatch screen freezes. Make 'who's nearest?' fast.
What you'll build
- 1A simulator that moves 50,000 riders around a city and posts their locations.
- 2Store locations with Redis GEO or PostGIS, and keep them fresh.
- 3
GET /riders/nearby?lat&lng&radiusreturning the closest free riders, sorted by real distance. - 4Mark riders busy atomically so two orders can't grab the same one.
- 5Drop riders who haven't reported in 30 seconds.
Step-by-step walkthrough
Walkthrough coming soon
This project's step-by-step walkthrough, with real outputs at every step, is still being written. You can read the brief and try it on your own meanwhile; tracking opens when the walkthrough is ready.
Done when
- Nearby queries answer in under 10 ms with 50,000 riders.
- Results agree with a brute-force Haversine check.
- No rider is ever assigned to two orders in a concurrency test.
- A diagram shows how the spatial index splits the map.
Stretch goals
- Estimate pickup time using road distance instead of straight lines.
- Shard by city so one busy city doesn't slow the rest.