Appearance
Step-by-Step Build Order
Rebuilding the Ride-Hailing Platform from Scratch
Phase 1: Server Setup, HTTP & Socket.io Ingress
- Initialize Node.js project and install Express 4.21, Socket.io 4.8, Mongoose 8.8, and dependencies.
- Build
backend/server.jsandbackend/socket.jswrapping the Express app in an HTTP server with WebSocket connection handlers. - Configure
backend/db/db.jsfor MongoDB Atlas persistence.
Phase 2: Dual User & Captain Domain Modeling
- Create
backend/models/user.model.jswith rider profile schemas. - Create
backend/models/captain.model.jswith vehicle specs (color, plate, capacity, vehicleType) and GPS location coordinates. - Create
backend/models/blacklistToken.model.jswith TTL expiration index. - Implement auth controllers, services, and middleware (
backend/middlewares/auth.middleware.js).
Phase 3: Geospatial & Google Maps Integration
- Configure Google Maps client in
backend/services/maps.service.js. - Implement geocoding, reverse geocoding, distance matrix queries, and autocomplete proxies in
map.controller.js.
Phase 4: Ride Domain, Fare Engine & OTP State Machine
- Create
backend/models/ride.model.jswithpending,accepted,ongoing,completed, andcancelledstatus states. - Implement fare calculation matrix and 4-digit OTP generation in
backend/services/ride.service.js. - Implement ride creation, acceptance, OTP verification, and completion endpoints in
ride.controller.js.
Phase 5: Real-Time WebSocket Event Orchestration
- Implement driver room joining (
join) and continuous coordinate streaming (update-location-captain). - Implement ride broadcast dispatches (
new-ride,ride-confirmed,ride-started,ride-ended).
Phase 6: React 18 Frontend & GSAP Motion
- Scaffold React 18 Vite app with Tailwind CSS and Remixicon.
- Build
SocketContext.jsxfor persistent WebSocket connection lifecycle. - Implement
LiveTracking.jsxwith@react-google-maps/api. - Choreograph interactive sliding drawers using GSAP in
Home.jsxandCaptainHome.jsx.