# jasphergayo/troddac architecture

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

- Interactive diagram: https://gitdiagram.com/jasphergayo/troddac
- Repository: https://github.com/jasphergayo/troddac

## Overview

TRODDAC is a role-based tricycle booking and operations portal. Its principal workflow runs from passenger booking and route/fare estimation through operator assignment, driver status/location updates, and passenger trip tracking or cancellation. Officer account administration is a separate capability. The source excerpts show shared authentication, booking/dispatch API behavior, and helper responsibilities; dashboards and several endpoints are unsampled, so their internal call links are omitted. The tree includes a mirrored troddac/ copy; this map represents the root application.

Main entry points: [`config/db.php`](https://github.com/jasphergayo/troddac/blob/main/config/db.php) (Application data), [`config/auth.php`](https://github.com/jasphergayo/troddac/blob/main/config/auth.php) (Session and roles), [`driver_dashboard.php`](https://github.com/jasphergayo/troddac/blob/main/driver_dashboard.php) (Driver dashboard), [`config/api.php`](https://github.com/jasphergayo/troddac/blob/main/config/api.php) (API helpers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_booking["Booking and trips"]
  node_booking_page["Request a ride<br/>[passenger_book.php]"]
  node_booking_api["Create booking<br/>[booking_create.php]"]
  node_route_api["Route and fare<br/>[route.php]"]
  node_trip_page["Track or cancel<br/>[passenger_trip.php]"]
  node_status_api["Booking status<br/>[booking_status.php]"]
  node_cancel_api["Cancel booking<br/>[booking_cancel.php]"]
  node_history_page["Ride history"]
end

subgraph group_operations["Dispatch operations"]
  node_dispatch_page["Manual dispatch"]
  node_queue_api["Dispatch queue<br/>[operator_queue.php]"]
  node_operator_action["Assign booking"]
  node_driver_page["Driver dashboard"]
  node_driver_action["Trip actions<br/>[driver_action.php]"]
  node_availability_api["Driver availability"]
  node_location_api["Driver location"]
  node_state_api["Driver state<br/>[driver_state.php]"]
end

subgraph group_identity["Accounts and access"]
  node_users_page["Manage accounts<br/>[officer_users.php]"]
  node_login_page["Login<br/>[login.php]"]
  node_register_page["Passenger registration<br/>[register.php]"]
end

subgraph group_platform["Shared services"]
  node_auth["Session and roles<br/>[auth.php]"]
  node_api_helpers["API helpers<br/>[api.php]"]
  node_database[("Application data<br/>[db.php]")]
end

node_passenger(("Passenger"))
node_operator(("Operator"))
node_driver(("Driver"))
node_officer(("Association officer"))
node_external_maps{{"Map and routing services"}}

node_passenger -->|"requests ride"| node_booking_page
node_booking_page -.->|"requests route"| node_route_api
node_booking_page -.->|"submits booking"| node_booking_api
node_booking_api -->|"writes booking"| node_database
node_booking_api -->|"uses helpers"| node_api_helpers
node_route_api -->|"uses helpers"| node_api_helpers
node_route_api -->|"requests routing"| node_external_maps
node_operator -->|"assigns driver"| node_dispatch_page
node_dispatch_page -.->|"polls queue"| node_queue_api
node_dispatch_page -.->|"submits assignment"| node_operator_action
node_queue_api -->|"reads dispatch data"| node_database
node_queue_api -->|"uses helpers"| node_api_helpers
node_operator_action -.->|"updates assignment"| node_database
node_driver -->|"updates trip"| node_driver_page
node_driver_page -.->|"submits actions"| node_driver_action
node_driver_page -.->|"changes availability"| node_availability_api
node_driver_page -.->|"shares location"| node_location_api
node_driver_page -.->|"updates state"| node_state_api
node_driver_action -->|"updates trip"| node_database
node_driver_action -->|"uses helpers"| node_api_helpers
node_passenger -->|"tracks trip"| node_trip_page
node_trip_page -.->|"polls status"| node_status_api
node_trip_page -.->|"requests cancel"| node_cancel_api
node_status_api -->|"reads booking"| node_database
node_status_api -->|"uses helpers"| node_api_helpers
node_officer -->|"manages users"| node_users_page
node_users_page -->|"writes accounts"| node_database
node_login_page -->|"authenticates"| node_auth
node_register_page -->|"uses account rules"| node_auth
node_auth -->|"loads user"| node_database
node_booking_api -->|"checks access"| node_auth
node_queue_api -->|"checks access"| node_auth
node_driver_action -->|"checks access"| node_auth

click node_booking_page "https://github.com/jasphergayo/troddac/blob/main/passenger_book.php"
click node_booking_api "https://github.com/jasphergayo/troddac/blob/main/api/booking_create.php"
click node_route_api "https://github.com/jasphergayo/troddac/blob/main/api/route.php"
click node_trip_page "https://github.com/jasphergayo/troddac/blob/main/passenger_trip.php"
click node_status_api "https://github.com/jasphergayo/troddac/blob/main/api/booking_status.php"
click node_cancel_api "https://github.com/jasphergayo/troddac/blob/main/api/booking_cancel.php"
click node_history_page "https://github.com/jasphergayo/troddac/blob/main/passenger_history.php"
click node_dispatch_page "https://github.com/jasphergayo/troddac/blob/main/operator_dispatch.php"
click node_queue_api "https://github.com/jasphergayo/troddac/blob/main/api/operator_queue.php"
click node_operator_action "https://github.com/jasphergayo/troddac/blob/main/api/operator_action.php"
click node_driver_page "https://github.com/jasphergayo/troddac/blob/main/driver_dashboard.php"
click node_driver_action "https://github.com/jasphergayo/troddac/blob/main/api/driver_action.php"
click node_availability_api "https://github.com/jasphergayo/troddac/blob/main/api/driver_availability.php"
click node_location_api "https://github.com/jasphergayo/troddac/blob/main/api/driver_location.php"
click node_state_api "https://github.com/jasphergayo/troddac/blob/main/api/driver_state.php"
click node_users_page "https://github.com/jasphergayo/troddac/blob/main/officer_users.php"
click node_login_page "https://github.com/jasphergayo/troddac/blob/main/login.php"
click node_register_page "https://github.com/jasphergayo/troddac/blob/main/register.php"
click node_auth "https://github.com/jasphergayo/troddac/blob/main/config/auth.php"
click node_api_helpers "https://github.com/jasphergayo/troddac/blob/main/config/api.php"
click node_database "https://github.com/jasphergayo/troddac/blob/main/config/db.php"

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_booking_page,node_booking_api,node_route_api,node_trip_page,node_status_api,node_cancel_api,node_history_page toneBlue
class node_dispatch_page,node_queue_api,node_operator_action,node_driver_page,node_driver_action,node_availability_api,node_location_api,node_state_api toneAmber
class node_users_page,node_login_page,node_register_page toneMint
class node_auth,node_api_helpers,node_database toneRose
class node_passenger,node_operator,node_driver,node_officer,node_external_maps toneIndigo
```

## Components

### Booking and trips

- [Request a ride](https://github.com/jasphergayo/troddac/blob/main/passenger_book.php): `passenger_book.php`
- [Create booking](https://github.com/jasphergayo/troddac/blob/main/api/booking_create.php): `api/booking_create.php`
- [Route and fare](https://github.com/jasphergayo/troddac/blob/main/api/route.php): `api/route.php`
- [Track or cancel](https://github.com/jasphergayo/troddac/blob/main/passenger_trip.php): `passenger_trip.php`
- [Booking status](https://github.com/jasphergayo/troddac/blob/main/api/booking_status.php): `api/booking_status.php`
- [Cancel booking](https://github.com/jasphergayo/troddac/blob/main/api/booking_cancel.php): `api/booking_cancel.php`
- [Ride history](https://github.com/jasphergayo/troddac/blob/main/passenger_history.php): `passenger_history.php`

### Dispatch operations

- [Manual dispatch](https://github.com/jasphergayo/troddac/blob/main/operator_dispatch.php): `operator_dispatch.php`
- [Dispatch queue](https://github.com/jasphergayo/troddac/blob/main/api/operator_queue.php): `api/operator_queue.php`
- [Assign booking](https://github.com/jasphergayo/troddac/blob/main/api/operator_action.php): `api/operator_action.php`
- [Driver dashboard](https://github.com/jasphergayo/troddac/blob/main/driver_dashboard.php): `driver_dashboard.php`
- [Trip actions](https://github.com/jasphergayo/troddac/blob/main/api/driver_action.php): `api/driver_action.php`
- [Driver availability](https://github.com/jasphergayo/troddac/blob/main/api/driver_availability.php): `api/driver_availability.php`
- [Driver location](https://github.com/jasphergayo/troddac/blob/main/api/driver_location.php): `api/driver_location.php`
- [Driver state](https://github.com/jasphergayo/troddac/blob/main/api/driver_state.php): `api/driver_state.php`

### Accounts and access

- [Manage accounts](https://github.com/jasphergayo/troddac/blob/main/officer_users.php): `officer_users.php`
- [Login](https://github.com/jasphergayo/troddac/blob/main/login.php): `login.php`
- [Passenger registration](https://github.com/jasphergayo/troddac/blob/main/register.php): `register.php`

### Shared services

- [Session and roles](https://github.com/jasphergayo/troddac/blob/main/config/auth.php): `config/auth.php`
- [API helpers](https://github.com/jasphergayo/troddac/blob/main/config/api.php): `config/api.php`
- [Application data](https://github.com/jasphergayo/troddac/blob/main/config/db.php): `config/db.php`

### Other components

- **Passenger**
- **Operator**
- **Driver**
- **Association officer**
- **Map and routing services**

## Connections

- Passenger → Request a ride: requests ride
- Request a ride → Route and fare: requests route
- Request a ride → Create booking: submits booking
- Create booking → Application data: writes booking (evidence: `api/booking_create.php`)
- Create booking → API helpers: uses helpers (evidence: `api/booking_create.php`)
- Route and fare → API helpers: uses helpers (evidence: `api/route.php`)
- Route and fare → Map and routing services: requests routing
- Operator → Manual dispatch: assigns driver
- Manual dispatch → Dispatch queue: polls queue
- Manual dispatch → Assign booking: submits assignment
- Dispatch queue → Application data: reads dispatch data (evidence: `api/operator_queue.php`)
- Dispatch queue → API helpers: uses helpers (evidence: `api/operator_queue.php`)
- Assign booking → Application data: updates assignment
- Driver → Driver dashboard: updates trip
- Driver dashboard → Trip actions: submits actions
- Driver dashboard → Driver availability: changes availability
- Driver dashboard → Driver location: shares location
- Driver dashboard → Driver state: updates state
- Trip actions → Application data: updates trip (evidence: `api/driver_action.php`)
- Trip actions → API helpers: uses helpers (evidence: `api/driver_action.php`)
- Passenger → Track or cancel: tracks trip
- Track or cancel → Booking status: polls status
- Track or cancel → Cancel booking: requests cancel
- Booking status → Application data: reads booking (evidence: `api/booking_status.php`)
- Booking status → API helpers: uses helpers (evidence: `api/booking_status.php`)
- Association officer → Manage accounts: manages users (evidence: `officer_users.php`)
- Manage accounts → Application data: writes accounts (evidence: `officer_users.php`)
- Login → Session and roles: authenticates (evidence: `login.php`)
- Passenger registration → Session and roles: uses account rules (evidence: `register.php`)
- Session and roles → Application data: loads user (evidence: `config/auth.php`)
- Create booking → Session and roles: checks access (evidence: `api/booking_create.php`)
- Dispatch queue → Session and roles: checks access (evidence: `api/operator_queue.php`)
- Trip actions → Session and roles: checks access (evidence: `api/driver_action.php`)
