How rishabhdev06/smart-ride- works
Smart Ride is a subscription-based ride-booking application. Users authenticate, choose a plan, request a ride, and follow its status; captains authenticate, receive and accept requests, verify an OTP, and complete rides. The backend coordinates subscription quota, ride state, mapping, persistence, and socket notifications. The README documents additional profile, cancellation, and live-location capabilities; some of their implementation wiring was not sampled, so uncertain connections are omitted.
Main entry points: app.js HTTP API · ride.controller.js Ride coordinator · App.jsx Web app routes · maps.service.js Maps and matching
Components 25
Web application
- Web app routes
frontend/src/App.jsx - Rider pages
frontend/src/pages/Home.jsx - Captain pages
frontend/src/pages/CaptainHome.jsx - Plan pages
frontend/src/pages/Plans.jsx - Client contexts
frontend/src/context/SubscriptionContext.jsx
Accounts and plans
- User routes
Backend/routes/user.routes.js - Captain routes
Backend/routes/captain.routes.js - JWT auth
Backend/middlewares/auth.middleware.js - User account
Backend/controllers/user.controller.js - Captain account
Backend/controllers/captain.controller.js - Plan routes
Backend/routes/plan.routes.js - Subscription routes
Backend/routes/subscription.routes.js - Plan service
Backend/services/plan.service.js - Subscription service
Backend/services/subscription.service.js
Ride operations
- Ride routes
Backend/routes/ride.routes.js - Ride coordinator
Backend/controllers/ride.controller.js - Ride lifecycle
Backend/services/ride.service.js
Services and state
- HTTP API
Backend/app.js - MongoDB
Maps and realtime
- Map routes
Backend/routes/maps.routes.js - Maps and matching
Backend/services/maps.service.js - Geoapify
- Socket server
Backend/socket.js
Other components
- Rider
- Captain
Connections 39
- Rider → Web app routes: uses
- Captain → Web app routes: uses
- Web app routes → Rider pages: routes to
- Web app routes → Captain pages: routes to
- Web app routes → Plan pages: routes to
- Rider pages → HTTP API: requests
- Captain pages → HTTP API: requests
- Plan pages → HTTP API: requests
- Client contexts → HTTP API: fetches state
- HTTP API → User routes: dispatches
- HTTP API → Captain routes: dispatches
- HTTP API → Plan routes: dispatches
- HTTP API → Subscription routes: dispatches
- HTTP API → Ride routes: dispatches
- HTTP API → Map routes: dispatches
- User routes → User account: dispatches
- User routes → JWT auth: authenticates
- Captain routes → Captain account: dispatches
- Captain routes → JWT auth: authenticates
- User account → MongoDB: reads/writes
- Captain account → MongoDB: reads/writes
- Plan routes → Plan service: dispatches
- Subscription routes → Subscription service: dispatches
- Plan service → MongoDB: reads/writes
- Subscription service → MongoDB: reads/writes
- Ride routes → JWT auth: authenticates
- Ride routes → Ride coordinator: dispatches
- Ride coordinator → Ride lifecycle: calls
- Ride coordinator → Subscription service: checks subscription
- Ride coordinator → Maps and matching: geocodes pickup
- Ride coordinator → Socket server: notifies captains
- Ride lifecycle → Subscription service: consumes/refunds quota
- Ride lifecycle → Maps and matching: gets route estimate
- Ride lifecycle → MongoDB: reads/writes
- Map routes → Maps and matching: dispatches
- Maps and matching → Geoapify: requests mapping data
- Maps and matching → MongoDB: reads captain locations
- Socket server → Captain: delivers ride events
- Socket server → Rider: delivers ride updates