# jagarlapudiradhakrishna0/test-onecoolie architecture

> Architecture diagram of the GitHub repository jagarlapudiradhakrishna0/test-onecoolie, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jagarlapudiradhakrishna0/test-onecoolie
- Repository: https://github.com/jagarlapudiradhakrishna0/test-onecoolie

## Overview

ONECOOLIE is a railway-station assistance platform connecting passengers with Sahayak porters, wheelchair escorts, and station transfers. The main journey is passenger sign-in and train search, followed by booking and payment, assistant fulfillment, and financial settlement; support and admin operations are parallel capabilities. The graph combines documented product capabilities with sampled route, controller, and service relationships. Many feature implementations were not sampled, so some documented connections are cited to the README rather than inferred from module names.

Main entry points: [`server/src/config/db.js`](https://github.com/jagarlapudiradhakrishna0/test-onecoolie/blob/main/server/src/config/db.js) (Database client), [`server/src/index.js`](https://github.com/jagarlapudiradhakrishna0/test-onecoolie/blob/main/server/src/index.js) (API routes), [`server/src/controllers/bookingController.js`](https://github.com/jagarlapudiradhakrishna0/test-onecoolie/blob/main/server/src/controllers/bookingController.js) (Booking lifecycle), [`client/src/context/AuthContext.jsx`](https://github.com/jagarlapudiradhakrishna0/test-onecoolie/blob/main/client/src/context/AuthContext.jsx) (Authentication)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_passenger["Passenger experience"]
  node_app["Web application<br/>[App.jsx]"]
  node_auth["Authentication<br/>[AuthContext.jsx]"]
  node_trainsearch["Train search<br/>[TrainSearch.jsx]"]
  node_journey["Journey booking"]
  node_payment["Payment"]
end

subgraph group_operations["Assistance operations"]
  node_booking["Booking lifecycle"]
  node_dispatch["Service dispatch"]
  node_assistant["Assistant workflow"]
  node_earnings["Assistant earnings<br/>[earningsService.js]"]
  node_payout["Payout settlement"]
end

subgraph group_platform["Platform services"]
  node_api["API routes<br/>[index.js]"]
  node_support["Passenger support"]
  node_dbclient["Database client<br/>[db.js]"]
  node_database[("Supabase database")]
end

subgraph group_admin["Administration and security"]
  node_admin["Admin operations<br/>[adminController.js]"]
  node_security["Security monitoring"]
  node_sessions["Session management<br/>[sessionService.js]"]
end

node_passenger(("Passenger"))
node_razorpay["Razorpay"]

node_passenger -->|"uses"| node_app
node_app -->|"provides routes"| node_auth
node_app -->|"supports search"| node_trainsearch
node_passenger -->|"signs in"| node_auth
node_auth -->|"requests OTP"| node_api
node_trainsearch -->|"selects journey"| node_journey
node_journey -->|"creates booking"| node_booking
node_booking -->|"initiates payment"| node_payment
node_payment -->|"processes payment"| node_razorpay
node_api -->|"routes requests"| node_booking
node_api -->|"routes requests"| node_payment
node_booking -->|"coordinates service"| node_dispatch
node_dispatch -.->|"dispatches work"| node_assistant
node_assistant -.->|"records completion"| node_earnings
node_earnings -.->|"funds settlement"| node_payout
node_api -->|"routes requests"| node_support
node_api -->|"routes requests"| node_admin
node_api -.->|"mounts security routes"| node_security
node_auth -->|"maintains sessions"| node_sessions
node_admin -.->|"reviews incidents"| node_security
node_booking -->|"reads and writes"| node_dbclient
node_payment -.->|"reads and writes"| node_dbclient
node_payout -->|"reads and writes"| node_dbclient
node_support -->|"reads and writes"| node_dbclient
node_admin -->|"reads and writes"| node_dbclient
node_sessions -->|"stores sessions"| node_dbclient
node_dbclient -->|"connects"| node_database

click node_app "https://github.com/jagarlapudiradhakrishna0/test-onecoolie/blob/main/client/src/App.jsx"
click node_auth "https://github.com/jagarlapudiradhakrishna0/test-onecoolie/blob/main/client/src/context/AuthContext.jsx"
click node_trainsearch "https://github.com/jagarlapudiradhakrishna0/test-onecoolie/blob/main/client/src/components/TrainSearch.jsx"
click node_journey "https://github.com/jagarlapudiradhakrishna0/test-onecoolie/blob/main/client/src/pages/TripSummaryPage.jsx"
click node_payment "https://github.com/jagarlapudiradhakrishna0/test-onecoolie/blob/main/server/src/controllers/paymentController.js"
click node_api "https://github.com/jagarlapudiradhakrishna0/test-onecoolie/blob/main/server/src/index.js"
click node_booking "https://github.com/jagarlapudiradhakrishna0/test-onecoolie/blob/main/server/src/controllers/bookingController.js"
click node_dispatch "https://github.com/jagarlapudiradhakrishna0/test-onecoolie/blob/main/server/src/controllers/serviceController.js"
click node_assistant "https://github.com/jagarlapudiradhakrishna0/test-onecoolie/blob/main/server/src/controllers/assistantController.js"
click node_earnings "https://github.com/jagarlapudiradhakrishna0/test-onecoolie/blob/main/server/src/utils/earningsService.js"
click node_payout "https://github.com/jagarlapudiradhakrishna0/test-onecoolie/blob/main/server/src/controllers/payoutController.js"
click node_support "https://github.com/jagarlapudiradhakrishna0/test-onecoolie/blob/main/server/src/controllers/supportController.js"
click node_admin "https://github.com/jagarlapudiradhakrishna0/test-onecoolie/blob/main/server/src/controllers/adminController.js"
click node_security "https://github.com/jagarlapudiradhakrishna0/test-onecoolie/blob/main/server/src/services/securityMonitoringService.js"
click node_sessions "https://github.com/jagarlapudiradhakrishna0/test-onecoolie/blob/main/server/src/services/sessionService.js"
click node_dbclient "https://github.com/jagarlapudiradhakrishna0/test-onecoolie/blob/main/server/src/config/db.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_app,node_auth,node_trainsearch,node_journey,node_payment toneBlue
class node_booking,node_dispatch,node_assistant,node_earnings,node_payout toneAmber
class node_api,node_support,node_dbclient,node_database toneMint
class node_admin,node_security,node_sessions toneRose
class node_passenger,node_razorpay toneIndigo
```

## Components

### Passenger experience

- [Web application](https://github.com/jagarlapudiradhakrishna0/test-onecoolie/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Authentication](https://github.com/jagarlapudiradhakrishna0/test-onecoolie/blob/main/client/src/context/AuthContext.jsx): `client/src/context/AuthContext.jsx`
- [Train search](https://github.com/jagarlapudiradhakrishna0/test-onecoolie/blob/main/client/src/components/TrainSearch.jsx): `client/src/components/TrainSearch.jsx`
- [Journey booking](https://github.com/jagarlapudiradhakrishna0/test-onecoolie/blob/main/client/src/pages/TripSummaryPage.jsx): `client/src/pages/TripSummaryPage.jsx`
- [Payment](https://github.com/jagarlapudiradhakrishna0/test-onecoolie/blob/main/server/src/controllers/paymentController.js): `server/src/controllers/paymentController.js`

### Assistance operations

- [Booking lifecycle](https://github.com/jagarlapudiradhakrishna0/test-onecoolie/blob/main/server/src/controllers/bookingController.js): `server/src/controllers/bookingController.js`
- [Service dispatch](https://github.com/jagarlapudiradhakrishna0/test-onecoolie/blob/main/server/src/controllers/serviceController.js): `server/src/controllers/serviceController.js`
- [Assistant workflow](https://github.com/jagarlapudiradhakrishna0/test-onecoolie/blob/main/server/src/controllers/assistantController.js): `server/src/controllers/assistantController.js`
- [Assistant earnings](https://github.com/jagarlapudiradhakrishna0/test-onecoolie/blob/main/server/src/utils/earningsService.js): `server/src/utils/earningsService.js`
- [Payout settlement](https://github.com/jagarlapudiradhakrishna0/test-onecoolie/blob/main/server/src/controllers/payoutController.js): `server/src/controllers/payoutController.js`

### Platform services

- [API routes](https://github.com/jagarlapudiradhakrishna0/test-onecoolie/blob/main/server/src/index.js): `server/src/index.js`
- [Passenger support](https://github.com/jagarlapudiradhakrishna0/test-onecoolie/blob/main/server/src/controllers/supportController.js): `server/src/controllers/supportController.js`
- [Database client](https://github.com/jagarlapudiradhakrishna0/test-onecoolie/blob/main/server/src/config/db.js): `server/src/config/db.js`
- **Supabase database**

### Administration and security

- [Admin operations](https://github.com/jagarlapudiradhakrishna0/test-onecoolie/blob/main/server/src/controllers/adminController.js): `server/src/controllers/adminController.js`
- [Security monitoring](https://github.com/jagarlapudiradhakrishna0/test-onecoolie/blob/main/server/src/services/securityMonitoringService.js): `server/src/services/securityMonitoringService.js`
- [Session management](https://github.com/jagarlapudiradhakrishna0/test-onecoolie/blob/main/server/src/services/sessionService.js): `server/src/services/sessionService.js`

### Other components

- **Passenger**
- **Razorpay**

## Connections

- Passenger → Web application: uses (evidence: `README.md`)
- Web application → Authentication: provides routes (evidence: `client/src/App.jsx`)
- Web application → Train search: supports search (evidence: `README.md`)
- Passenger → Authentication: signs in (evidence: `README.md`)
- Authentication → API routes: requests OTP (evidence: `client/src/context/AuthContext.jsx`)
- Train search → Journey booking: selects journey (evidence: `client/src/components/TrainSearch.jsx`)
- Journey booking → Booking lifecycle: creates booking (evidence: `README.md`)
- Booking lifecycle → Payment: initiates payment (evidence: `README.md`)
- Payment → Razorpay: processes payment (evidence: `README.md`)
- API routes → Booking lifecycle: routes requests (evidence: `server/src/index.js`)
- API routes → Payment: routes requests (evidence: `server/src/index.js`)
- Booking lifecycle → Service dispatch: coordinates service (evidence: `server/src/controllers/bookingController.js`)
- Service dispatch → Assistant workflow: dispatches work
- Assistant workflow → Assistant earnings: records completion
- Assistant earnings → Payout settlement: funds settlement
- API routes → Passenger support: routes requests (evidence: `server/src/index.js`)
- API routes → Admin operations: routes requests
- API routes → Security monitoring: mounts security routes
- Authentication → Session management: maintains sessions
- Admin operations → Security monitoring: reviews incidents
- Booking lifecycle → Database client: reads and writes (evidence: `server/src/controllers/bookingController.js`)
- Payment → Database client: reads and writes
- Payout settlement → Database client: reads and writes (evidence: `server/src/controllers/payoutController.js`)
- Passenger support → Database client: reads and writes (evidence: `server/src/controllers/supportController.js`)
- Admin operations → Database client: reads and writes (evidence: `server/src/controllers/adminController.js`)
- Session management → Database client: stores sessions (evidence: `server/src/services/sessionService.js`)
- Database client → Supabase database: connects (evidence: `server/src/config/db.js`)
