
Week 6: How GusLift Matches Rides in Real Time
Every school morning, a few drivers leave their dorms for campus, and a bunch of riders need seats. The core problem: match them fast, in the right direction, before the window closes. Here's how the matching engine actually works. The Matching Room Abstraction We don't run one global pool. We partition by location, day, and departure time. A room key looks like: Westie:mon:08:00 That string becomes the identity of a Cloudflare Durable Object(DO), a live, in-memory process that owns all real-time state for that slot. Everyone heading from Westie at 8am Monday shares one room. Leaving at 10:30? Different room entirely. This keeps each instance small and focused. The matching room doesn't know or care about any other departure window. Getting Into the Right Room When a user opens the app, a Cloudflare Worker handles the request. It authenticates, resolves the user's schedule, generates the slot key, and forwards the WebSocket connection to the right DO. The Worker is stateless, purely a
Continue reading on Dev.to
Opens in a new tab

