# prameshwarkumarpatel/smartcab-booking architecture

> Architecture diagram of the GitHub repository prameshwarkumarpatel/smartcab-booking, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/prameshwarkumarpatel/smartcab-booking
- Repository: https://github.com/prameshwarkumarpatel/smartcab-booking

## Overview

Cab Booking System is a full-stack marketplace for passenger rides, driver operations, and administration. Passengers register or sign in, estimate and book rides, follow assignment and live status, then pay and review; drivers register for approval, receive requests, and update ride progress. The graph includes documented authentication, wallet, coupons, reporting, and admin capabilities. Some route/controller variants coexist in the tree, and several subsystems are unsampled, so uncertain wiring is left out.

Main entry points: [`backend/src/models`](https://github.com/prameshwarkumarpatel/smartcab-booking/tree/main/backend/src/models) (Ride and account data), [`backend/src/controllers/rideController.js`](https://github.com/prameshwarkumarpatel/smartcab-booking/blob/main/backend/src/controllers/rideController.js) (Ride workflow), [`frontend/src/services/api.ts`](https://github.com/prameshwarkumarpatel/smartcab-booking/blob/main/frontend/src/services/api.ts) (API client), [`frontend/src/app/admin`](https://github.com/prameshwarkumarpatel/smartcab-booking/tree/main/frontend/src/app/admin) (Admin console)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web applications"]
  node_web["Next.js pages"]
  node_driver_ui["Driver console"]
  node_admin_ui["Admin console"]
  node_api_client["API client<br/>[api.ts]"]
  node_live_client["Live tracking client<br/>[socket.ts]"]
end

subgraph group_ride["Ride operations"]
  node_api_server["Express API<br/>[server.js]"]
  node_ride_routes["Ride endpoints<br/>[ride.routes.js]"]
  node_ride_logic["Ride workflow<br/>[rideController.js]"]
  node_assignment["Driver assignment"]
  node_fare["Fare calculation<br/>[fareCalculator.js]"]
  node_payment["Payments<br/>[paymentService.js]"]
end

subgraph group_identity["Identity and admin"]
  node_identity_flow["Authentication<br/>[authService.js]"]
  node_auth_routes["Auth endpoints<br/>[auth.js]"]
  node_admin_features["Admin features"]
end

subgraph group_platform["Platform services"]
  node_domain_data[("Ride and account data")]
  node_notifications["Notifications"]
  node_realtime["Realtime updates<br/>[socket.js]"]
  node_scheduled_jobs["Scheduled rides<br/>[scheduler.js]"]
end

node_passenger(("Passenger"))
node_driver_actor(("Driver"))
node_admin_actor(("Administrator"))
node_mongo[("MongoDB")]

node_passenger -->|"uses"| node_web
node_driver_actor -->|"uses"| node_driver_ui
node_admin_actor -->|"uses"| node_admin_ui
node_web -->|"requests"| node_api_client
node_driver_ui -->|"requests"| node_api_client
node_admin_ui -->|"requests"| node_api_client
node_api_client -->|"HTTP calls"| node_api_server
node_api_server -->|"dispatches"| node_ride_routes
node_ride_routes -->|"invokes"| node_ride_logic
node_ride_logic -->|"calculates fare"| node_fare
node_ride_logic -->|"starts assignment"| node_assignment
node_ride_logic -->|"creates payment"| node_payment
node_ride_logic -->|"sends updates"| node_notifications
node_assignment -->|"notifies users"| node_notifications
node_ride_logic -->|"reads and writes"| node_domain_data
node_assignment -->|"reads and writes"| node_domain_data
node_payment -->|"records payments"| node_domain_data
node_api_server -->|"dispatches"| node_auth_routes
node_auth_routes -->|"invokes"| node_identity_flow
node_identity_flow -->|"records sessions"| node_domain_data
node_admin_ui -->|"manages"| node_admin_features
node_admin_features -->|"administers accounts"| node_domain_data
node_live_client -->|"connects"| node_realtime
node_realtime -->|"streams ride updates"| node_driver_ui
node_scheduled_jobs -->|"processes scheduled rides"| node_domain_data
node_domain_data -->|"persists"| node_mongo

click node_web "https://github.com/prameshwarkumarpatel/smartcab-booking/tree/main/frontend/src/app"
click node_driver_ui "https://github.com/prameshwarkumarpatel/smartcab-booking/tree/main/frontend/src/app/driver"
click node_admin_ui "https://github.com/prameshwarkumarpatel/smartcab-booking/tree/main/frontend/src/app/admin"
click node_api_client "https://github.com/prameshwarkumarpatel/smartcab-booking/blob/main/frontend/src/services/api.ts"
click node_live_client "https://github.com/prameshwarkumarpatel/smartcab-booking/blob/main/frontend/src/lib/socket.ts"
click node_api_server "https://github.com/prameshwarkumarpatel/smartcab-booking/blob/main/backend/src/server.js"
click node_ride_routes "https://github.com/prameshwarkumarpatel/smartcab-booking/blob/main/backend/src/routes/ride.routes.js"
click node_ride_logic "https://github.com/prameshwarkumarpatel/smartcab-booking/blob/main/backend/src/controllers/rideController.js"
click node_assignment "https://github.com/prameshwarkumarpatel/smartcab-booking/blob/main/backend/src/services/driverAssignmentService.js"
click node_fare "https://github.com/prameshwarkumarpatel/smartcab-booking/blob/main/backend/src/utils/fareCalculator.js"
click node_payment "https://github.com/prameshwarkumarpatel/smartcab-booking/blob/main/backend/src/services/paymentService.js"
click node_identity_flow "https://github.com/prameshwarkumarpatel/smartcab-booking/blob/main/backend/src/services/authService.js"
click node_auth_routes "https://github.com/prameshwarkumarpatel/smartcab-booking/blob/main/backend/src/routes/auth.js"
click node_admin_features "https://github.com/prameshwarkumarpatel/smartcab-booking/tree/main/backend/src/controllers"
click node_domain_data "https://github.com/prameshwarkumarpatel/smartcab-booking/tree/main/backend/src/models"
click node_notifications "https://github.com/prameshwarkumarpatel/smartcab-booking/blob/main/backend/src/services/notificationService.js"
click node_realtime "https://github.com/prameshwarkumarpatel/smartcab-booking/blob/main/backend/src/socket.js"
click node_scheduled_jobs "https://github.com/prameshwarkumarpatel/smartcab-booking/blob/main/backend/src/jobs/scheduler.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_web,node_driver_ui,node_admin_ui,node_api_client,node_live_client toneBlue
class node_api_server,node_ride_routes,node_ride_logic,node_assignment,node_fare,node_payment,node_mongo toneAmber
class node_identity_flow,node_auth_routes,node_admin_features toneMint
class node_domain_data,node_notifications,node_realtime,node_scheduled_jobs toneRose
class node_passenger,node_driver_actor,node_admin_actor toneIndigo
```

## Components

### Web applications

- [Next.js pages](https://github.com/prameshwarkumarpatel/smartcab-booking/tree/main/frontend/src/app): `frontend/src/app`
- [Driver console](https://github.com/prameshwarkumarpatel/smartcab-booking/tree/main/frontend/src/app/driver): `frontend/src/app/driver`
- [Admin console](https://github.com/prameshwarkumarpatel/smartcab-booking/tree/main/frontend/src/app/admin): `frontend/src/app/admin`
- [API client](https://github.com/prameshwarkumarpatel/smartcab-booking/blob/main/frontend/src/services/api.ts): `frontend/src/services/api.ts`
- [Live tracking client](https://github.com/prameshwarkumarpatel/smartcab-booking/blob/main/frontend/src/lib/socket.ts): `frontend/src/lib/socket.ts`

### Ride operations

- [Express API](https://github.com/prameshwarkumarpatel/smartcab-booking/blob/main/backend/src/server.js): `backend/src/server.js`
- [Ride endpoints](https://github.com/prameshwarkumarpatel/smartcab-booking/blob/main/backend/src/routes/ride.routes.js): `backend/src/routes/ride.routes.js`
- [Ride workflow](https://github.com/prameshwarkumarpatel/smartcab-booking/blob/main/backend/src/controllers/rideController.js): `backend/src/controllers/rideController.js`
- [Driver assignment](https://github.com/prameshwarkumarpatel/smartcab-booking/blob/main/backend/src/services/driverAssignmentService.js): `backend/src/services/driverAssignmentService.js`
- [Fare calculation](https://github.com/prameshwarkumarpatel/smartcab-booking/blob/main/backend/src/utils/fareCalculator.js): `backend/src/utils/fareCalculator.js`
- [Payments](https://github.com/prameshwarkumarpatel/smartcab-booking/blob/main/backend/src/services/paymentService.js): `backend/src/services/paymentService.js`

### Identity and admin

- [Authentication](https://github.com/prameshwarkumarpatel/smartcab-booking/blob/main/backend/src/services/authService.js): `backend/src/services/authService.js`
- [Auth endpoints](https://github.com/prameshwarkumarpatel/smartcab-booking/blob/main/backend/src/routes/auth.js): `backend/src/routes/auth.js`
- [Admin features](https://github.com/prameshwarkumarpatel/smartcab-booking/tree/main/backend/src/controllers): `backend/src/controllers`

### Platform services

- [Ride and account data](https://github.com/prameshwarkumarpatel/smartcab-booking/tree/main/backend/src/models): `backend/src/models`
- [Notifications](https://github.com/prameshwarkumarpatel/smartcab-booking/blob/main/backend/src/services/notificationService.js): `backend/src/services/notificationService.js`
- [Realtime updates](https://github.com/prameshwarkumarpatel/smartcab-booking/blob/main/backend/src/socket.js): `backend/src/socket.js`
- [Scheduled rides](https://github.com/prameshwarkumarpatel/smartcab-booking/blob/main/backend/src/jobs/scheduler.js): `backend/src/jobs/scheduler.js`

### Other components

- **Passenger**
- **Driver**
- **Administrator**
- **MongoDB**

## Connections

- Passenger → Next.js pages: uses
- Driver → Driver console: uses
- Administrator → Admin console: uses
- Next.js pages → API client: requests
- Driver console → API client: requests
- Admin console → API client: requests
- API client → Express API: HTTP calls
- Express API → Ride endpoints: dispatches
- Ride endpoints → Ride workflow: invokes
- Ride workflow → Fare calculation: calculates fare
- Ride workflow → Driver assignment: starts assignment
- Ride workflow → Payments: creates payment
- Ride workflow → Notifications: sends updates
- Driver assignment → Notifications: notifies users
- Ride workflow → Ride and account data: reads and writes
- Driver assignment → Ride and account data: reads and writes
- Payments → Ride and account data: records payments
- Express API → Auth endpoints: dispatches
- Auth endpoints → Authentication: invokes
- Authentication → Ride and account data: records sessions
- Admin console → Admin features: manages
- Admin features → Ride and account data: administers accounts
- Live tracking client → Realtime updates: connects
- Realtime updates → Driver console: streams ride updates
- Scheduled rides → Ride and account data: processes scheduled rides
- Ride and account data → MongoDB: persists
