This project documents my journey building a microservices-based ride-sharing platform (Uber-style), applying what I’ve learnt in Operating System and Distributed System. Each part covers a concept I explored and the decisions I made along the way — from choosing between monolithic and microservices architectures, to designing event-driven communication with RabbitMQ, to handling errors idiomatically in Go.
Day 4: Tracing the GetRoute Call Flow
Today I traced the full call flow of GetRoute — the function that sits at the core of trip previewing. Walking through each layer made the architecture concrete in a way that reading the files in isolation didn’t. Request Flow When a client wants to preview a trip, the request passes through three distinct layers before hitting the external routing API: Client POST /trip/preview {userID, pickup, destination} │ ▼ api-gateway/http.go : handleTripPreview - validates userID is present - re-serializes body as JSON - POST http://trip-service:8083/preview ──────────────────────┐ - wraps response in contracts.APIResponse{Data: ...} │ - returns 201 │ ▼ trip-service/infrastructure/http/http.go : HandleTripPreview - decodes previewTripRequest {userID, pickup, destination} - calls s.Service.GetRoute(ctx, pickup, destination) │ ▼ trip-service/service/service.go : GetRoute - builds OSRM URL with lon/lat coords - GET http://router.project-osrm.org/route/v1/driving/... - unmarshals JSON into OsrmApiResponse - returns routes {distance, duration, geometry{coordinates}} │ ▼ back to HandleTripPreview - writeJSON 200 with OsrmApiResponse Layer Responsibilities Each layer has a clear, single responsibility: ...