Ride-Hailing Rider App — Mobile API
Fare Estimates, Ride Booking, Driver Matching & Live Trip Tracking

Rider-side API for a ride-hailing service. Riders set pickup and drop-off, compare fare estimates for each vehicle type, request a ride, watch the assigned driver approach in real time, and pay at the end of the trip. Trip history and receipts are available in the app.
Architecture & System Design
A Node.js and Express API with JWT authentication. Ride requests are matched to nearby online drivers using driver locations cached in Redis. Once a driver accepts, trip events and driver positions are pushed to the rider through a Socket.IO room for that trip, with push notifications as a fallback when the app is in the background.
- Fare estimates calculated server-side from distance, time and vehicle type
- Driver positions held in Redis geo sets for fast nearest-driver lookups
- One Socket.IO room per trip, joined only after JWT verification, so riders only see their own trip
- Explicit trip state machine: requested → accepted → arrived → in progress → completed
Engineering Challenges
Finding Nearby Drivers Quickly
Querying the main database for every online driver's latest position on each request would not scale with frequent location updates.
Kept live driver locations in Redis geo sets updated by the driver app, and queried them by radius to build a shortlist before touching MySQL.
Matching reads from memory, and the database only stores trips, not every location ping.
Consistent Trip State
Riders and drivers can tap buttons at the same time (e.g. cancel vs. accept), leading to conflicting trip states.
Implemented a trip state machine with allowed transitions enforced in one service, using conditional SQL updates so only one transition can win.
Every trip follows a valid path and both apps always show the same status.
Core Features
Fare Estimates
Upfront prices per vehicle type before the rider confirms.
Clean Code
1// Nearest available drivers of a vehicle type, closest first2"color:#c792ea">export "color:#c792ea">async "color:#c792ea">function nearestDrivers(redis, db, { lat, lng, type, limit = 5 }) {3 "color:#c792ea">const ids = "color:#c792ea">await redis.geosearch(4 `drivers:online:${type}`,5 "FROMLONLAT", lng, lat,6 "BYRADIUS", 5, "km",7 "ASC", "COUNT", limit8 );9 "color:#c792ea">if (ids.length === 0) "color:#c792ea">return [];1011 "color:#c792ea">const [rows] = "color:#c792ea">await db.query(12 "SELECT * FROM drivers WHERE id IN (?) AND status = 'available'",13 [ids]14 );1516 "color:#c792ea">return rows.sort((a, b) => ids.indexOf(String(a.id)) - ids.indexOf(String(b.id)));17}Want something like this for your business?
I design and build full stack products end to end. Tell me about your idea and I'll get back to you with a plan.