How ojekab4u/ecoride-backend works
EcoRide is a REST API for matching passengers with drivers and managing the ride lifecycle. Drivers publish rides; passengers search and book; drivers handle booking decisions and ride status/location updates. Authentication and role checks protect role-specific workflows, with wallet/payment, ratings, notifications, corporate management, and platform administration as supporting capabilities. The graph follows the sampled application wiring and ride, booking, and admin examples; several other branches are included from the README and tree, but their internal calls were not sampled.
Main entry points: app.js Express API · database.js PostgreSQL data · auth.routes.js Auth routes · auth.controller.js Auth controller
Components 24
API entry
- Express API
app.js - Auth routes
src/routes/auth.routes.js - PostgreSQL data
src/config/database.js
Identity and profiles
- Auth controller
src/controllers/auth.controller.js - Auth service
src/services/auth.service.js - Profile routes
src/routes/passenger.routes.js
Ride lifecycle
- Ride routes
src/routes/ride.routes.js - Ride controller
src/controllers/ride.controller.js - Ride service
src/services/ride.service.js - Booking routes
src/routes/booking.routes.js - Booking controller
src/controllers/booking.controller.js - Booking service
src/services/booking.service.js
Payments and engagement
- Payment routes
src/routes/payment.routes.js - Wallet routes
src/routes/wallet.routes.js - Ratings routes
src/routes/rating.routes.js - Notification routes
src/routes/notification.routes.js
Platform operations
- Corporate routes
src/routes/corporate.routes.js - Admin routes
src/routes/admin.routes.js - Admin controller
src/controllers/admin.controller.js - Admin service
src/services/admin.service.js
Other components
- Passengers
- Drivers
- Corporate admins
- Platform admins
Connections 27
- Passengers → Express API: send requests
- Drivers → Express API: send requests
- Corporate admins → Express API: send requests
- Platform admins → Express API: send requests
- Express API → Auth routes: mounts routes
- Express API → Ride routes: mounts routes
- Express API → Booking routes: mounts routes
- Express API → Payment routes: mounts routes
- Express API → Wallet routes: mounts routes
- Express API → Ratings routes: mounts routes
- Express API → Notification routes: mounts routes
- Express API → Profile routes: mounts routes
- Express API → Corporate routes: mounts routes
- Express API → Admin routes: mounts routes
- Express API → PostgreSQL data: connects
- Auth routes → Auth controller: dispatches
- Auth controller → Auth service: calls
- Ride routes → Ride controller: dispatches
- Ride controller → Ride service: calls
- Booking routes → Booking controller: dispatches
- Booking controller → Booking service: calls
- Admin routes → Admin controller: dispatches
- Admin controller → Admin service: calls
- Auth service → PostgreSQL data: reads and writes
- Ride service → PostgreSQL data: reads and writes
- Booking service → PostgreSQL data: reads and writes
- Admin service → PostgreSQL data: reads and writes