Inspiration

Quick-commerce needs fast, local handoffs. We wanted an API that turns a city into zones and relay paths so any platform can plug in multi-partner delivery without building the geo/routing stack.

What it does

RelayRoute sets up a city (restaurants → zones → drop-off points), computes relay chains (restaurant → handoffs → customer) with live travel times, and lets partners poll for the next task. A small map UI shows zones, drop-offs, and order paths in real time.

How we built it

FastAPI backend, PostgreSQL + SQLAlchemy, DBSCAN + Voronoi (Shapely-clipped) for zones, NetworkX + Google Distance Matrix for routing. Optional OpenAI for zone reasoning. Vanilla JS + Leaflet for the map.

Challenges we ran into

Voronoi cells going unbounded (fixed by clipping to the city bbox with Shapely), NumPy scalars breaking DB inserts (normalized to Python float before persisting), and making sure the map got zone boundaries (added a topology response that includes boundaries).

Accomplishments that we're proud of

A single “setup city” call that discovers restaurants, clusters zones, places drop-offs, and returns a key; Dijkstra over a live-weighted graph for relay chains; and a minimal UI that works without a build step.

What we learned

Shapely + SciPy Voronoi play well for geo partitioning; keeping types consistent (no NumPy in the DB) avoids subtle bugs; and a small, focused API can cover the full flow from setup to partner tasks.

What's next for RelayRoute

Richer partner app flows (e.g. ETA and status push), rerouting when a drop-off goes full/disabled, and optional multi-city or region support for larger deployments.

Built With

Share this project:

Updates