# wdfjcnvp/smarticct architecture

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

- Interactive diagram: https://gitdiagram.com/wdfjcnvp/smarticct
- Repository: https://github.com/wdfjcnvp/smarticct

## Overview

#### Purpose and Entry Points
This is a Laravel PHP application for passenger transport operations: vehicle queues, routes/schedules, RFID/card fare handling, top-ups, rental/trip requests, and role-specific admin, cashier, commuter, and operator workflows. HTTP starts at `public/index.php`, boots through `bootstrap/app.php`, and is exposed through `routes/web.php` and `routes/api.php`.

#### Delivery and Access Boundary
Web routes serve Blade-based dashboards and public/account flows; API controllers support card registration, card operations, and vehicle skipping. Role authorization is centralized in middleware and dashboard controllers split presentation by actor type.
- `app/Http/Middleware/RoleMiddleware.php`
- `app/Http/Controllers/Web/User/AdminPanelController.php`
- `app/Http/Controllers/Api/RfidCardRegistrationController.php`

#### Transport Queue and Departure Flow
Queue management is the operational core. Queue, vehicle, vehicle-group, terminal, route, schedule, and travel-record entities model dispatch state. Queue services likely own ordering and lifecycle transitions; events and a post-departure job decouple downstream processing from departure actions.
- `app/Services/QueueManagementService.php`
- `app/Services/QueueOrderService.php`
- `app/Models/Queue.php`
- `app/Events/TriggerDepartingEvent.php`
- `app/Jobs/ProcessAfterDepart.php`

A likely control flow is: cashier/operator action updates queue and vehicle state → departure event is emitted → queued job records or performs post-departure work → role dashboards receive updated operational state.

#### Fare Cards, Payments, and Ledger Records
Card and payment endpoints form a financial boundary around commuter travel. Persistent card, card-transaction, top-up, cash-transaction, payment, and travel-record models support auditability of balance and fare activity. Web payment/top-up controllers handle transaction initiation and completion views, while APIs support card/RFID interaction.
- `app/Http/Controllers/PaymentController.php`
- `app/Http/Controllers/TopUpTransactionController.php`
- `app/Http/Controllers/Api/CardController.php`
- `app/Models/CardTransaction.php`
- `app/Models/TopUpTransaction.php`
- `app/Models/CashTransaction.php`

The repository does not identify a named external payment provider; credentials/integrations would be expected through `config/services.php` and environment variables.

#### Rental and Trip-Request Workflow
Beyond scheduled transport, the system supports commuter trip requests and operator rental offers. Requests, offers, and rent transactions form a separate transaction lifecycle surfaced in commuter/operator dashboard views.
- `app/Models/TripRequest.php`
- `app/Models/RentalOffer.php`
- `app/Models/RentTransaction.php`
- `resources/views/pages/content-by-role/operator/⚡trip-request-modal.blade.php`
- `resources/views/pages/content-by-role/commuter/⚡active-renting-transaction.blade.php`

#### User, Social, Notification, and Audit Domain
Users have profile/settings flows and role-scoped views. A post/feed subsystem lets users create posts and express interest; notification events/models distribute activity updates. Audit logging is explicitly modeled and serviced for administrative traceability.
- `app/Models/User.php`
- `app/Services/PostService.php`
- `app/Services/PostInterestService.php`
- `app/Models/Notification.php`
- `app/Services/AuditLogsService.php`

#### Runtime, Persistence, and Realtime Infrastructure
Laravel runs on PHP with Composer (`composer.json`), Eloquent migrations defining the relational schema (`database/migrations`), and a JavaScript/Vite frontend bundle (`resources/js/app.js`, `vite.config.js`). Queue, cache, database, mail, session, broadcasting, and Reverb settings are Laravel-configured infrastructure boundaries. Mail classes indicate OTP/password-reset/registration email delivery; events plus Echo/Reverb support realtime updates.
- `config/database.php`
- `config/queue.php`
- `config/broadcasting.php`
- `config/reverb.php`
- `resources/js/echo.js`
- `app/Mail/PasswordResetOtpMail.php`

Main entry points: [`app/Models/CardTransaction.php`](https://github.com/wdfjcnvp/smarticct/blob/main/app/Models/CardTransaction.php) (Fare ledger), [`app/Services/QueueManagementService.php`](https://github.com/wdfjcnvp/smarticct/blob/main/app/Services/QueueManagementService.php) (Queue lifecycle), [`app/Http/Controllers/Web/User/AdminPanelController.php`](https://github.com/wdfjcnvp/smarticct/blob/main/app/Http/Controllers/Web/User/AdminPanelController.php) (Role dashboards), [`config/database.php`](https://github.com/wdfjcnvp/smarticct/blob/main/config/database.php) (Relational database)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_http["HTTP &amp; UI"]
  node_public_index["Public entry<br/>PHP entrypoint<br/>[index.php]"]
  node_laravel_bootstrap["Laravel bootstrap<br/>application bootstrap<br/>[app.php]"]
  node_web_routes["Web routes<br/>Blade HTTP routes<br/>[web.php]"]
  node_api_routes["API routes<br/>card and queue API<br/>[api.php]"]
  node_role_middleware["Role authorization<br/>middleware<br/>[RoleMiddleware.php]"]
  node_role_dashboards["Role dashboards<br/>web controller"]
  node_rfid_registration["RFID registration API<br/>API controller"]
end

subgraph group_operations["Transport Operations"]
  node_queue_management["Queue lifecycle<br/>queue service"]
  node_queue_ordering["Queue ordering<br/>queue service"]
  node_transport_entities[("Dispatch records<br/>Eloquent domain<br/>[Queue.php]")]
  node_departure_event{{"Departure event<br/>Laravel event"}}
  node_post_departure_job["Post-departure worker<br/>queued job"]
end

subgraph group_commerce["Fares &amp; Rentals"]
  node_payment_flow["Payment flow<br/>web controller"]
  node_topup_flow["Top-up flow<br/>web controller"]
  node_card_api["Card operations API<br/>API controller<br/>[CardController.php]"]
  node_fare_ledger[("Fare ledger<br/>Eloquent transactions")]
  node_rental_lifecycle[("Rental lifecycle<br/>Eloquent domain<br/>[TripRequest.php]")]
end

subgraph group_platform["Platform Infrastructure"]
  node_social_audit["Social, notifications &amp; audit<br/>application services<br/>[PostService.php]"]
  node_relational_database[("Relational database<br/>Laravel database config<br/>[database.php]")]
  node_queue_runtime["Queue runtime<br/>Laravel queue config<br/>[queue.php]"]
  node_realtime{{"Realtime updates<br/>Broadcasting and Echo<br/>[echo.js]"}}
  node_mail_delivery["OTP email delivery<br/>Laravel mail"]
end

node_public_index -->|"boots"| node_laravel_bootstrap
node_laravel_bootstrap -->|"loads"| node_web_routes
node_laravel_bootstrap -->|"loads"| node_api_routes
node_web_routes -->|"authorizes"| node_role_middleware
node_role_middleware -->|"permits"| node_role_dashboards
node_api_routes -->|"dispatches"| node_rfid_registration
node_api_routes -->|"dispatches"| node_card_api
node_role_dashboards -->|"operates"| node_queue_management
node_queue_management -->|"orders"| node_queue_ordering
node_queue_management -->|"updates"| node_transport_entities
node_queue_management -->|"emits on departure"| node_departure_event
node_departure_event -->|"queues"| node_post_departure_job
node_post_departure_job -->|"records follow-up"| node_transport_entities
node_payment_flow -->|"records"| node_fare_ledger
node_topup_flow -->|"records"| node_fare_ledger
node_card_api -->|"reads and updates"| node_fare_ledger
node_rfid_registration -->|"registers card"| node_fare_ledger
node_role_dashboards -->|"manages"| node_rental_lifecycle
node_fare_ledger -->|"persists"| node_relational_database
node_transport_entities -->|"persists"| node_relational_database
node_rental_lifecycle -->|"persists"| node_relational_database
node_post_departure_job -->|"runs through"| node_queue_runtime
node_departure_event -.->|"broadcasts"| node_realtime
node_realtime -.->|"updates UI"| node_role_dashboards
node_social_audit -->|"persists activity"| node_relational_database

click node_public_index "https://github.com/wdfjcnvp/smarticct/blob/main/public/index.php"
click node_laravel_bootstrap "https://github.com/wdfjcnvp/smarticct/blob/main/bootstrap/app.php"
click node_web_routes "https://github.com/wdfjcnvp/smarticct/blob/main/routes/web.php"
click node_api_routes "https://github.com/wdfjcnvp/smarticct/blob/main/routes/api.php"
click node_role_middleware "https://github.com/wdfjcnvp/smarticct/blob/main/app/Http/Middleware/RoleMiddleware.php"
click node_role_dashboards "https://github.com/wdfjcnvp/smarticct/blob/main/app/Http/Controllers/Web/User/AdminPanelController.php"
click node_rfid_registration "https://github.com/wdfjcnvp/smarticct/blob/main/app/Http/Controllers/Api/RfidCardRegistrationController.php"
click node_queue_management "https://github.com/wdfjcnvp/smarticct/blob/main/app/Services/QueueManagementService.php"
click node_queue_ordering "https://github.com/wdfjcnvp/smarticct/blob/main/app/Services/QueueOrderService.php"
click node_transport_entities "https://github.com/wdfjcnvp/smarticct/blob/main/app/Models/Queue.php"
click node_departure_event "https://github.com/wdfjcnvp/smarticct/blob/main/app/Events/TriggerDepartingEvent.php"
click node_post_departure_job "https://github.com/wdfjcnvp/smarticct/blob/main/app/Jobs/ProcessAfterDepart.php"
click node_payment_flow "https://github.com/wdfjcnvp/smarticct/blob/main/app/Http/Controllers/PaymentController.php"
click node_topup_flow "https://github.com/wdfjcnvp/smarticct/blob/main/app/Http/Controllers/TopUpTransactionController.php"
click node_card_api "https://github.com/wdfjcnvp/smarticct/blob/main/app/Http/Controllers/Api/CardController.php"
click node_fare_ledger "https://github.com/wdfjcnvp/smarticct/blob/main/app/Models/CardTransaction.php"
click node_rental_lifecycle "https://github.com/wdfjcnvp/smarticct/blob/main/app/Models/TripRequest.php"
click node_social_audit "https://github.com/wdfjcnvp/smarticct/blob/main/app/Services/PostService.php"
click node_relational_database "https://github.com/wdfjcnvp/smarticct/blob/main/config/database.php"
click node_queue_runtime "https://github.com/wdfjcnvp/smarticct/blob/main/config/queue.php"
click node_realtime "https://github.com/wdfjcnvp/smarticct/blob/main/resources/js/echo.js"
click node_mail_delivery "https://github.com/wdfjcnvp/smarticct/blob/main/app/Mail/PasswordResetOtpMail.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_public_index,node_laravel_bootstrap,node_web_routes,node_api_routes,node_role_middleware,node_role_dashboards,node_rfid_registration toneBlue
class node_queue_management,node_queue_ordering,node_transport_entities,node_departure_event,node_post_departure_job toneAmber
class node_payment_flow,node_topup_flow,node_card_api,node_fare_ledger,node_rental_lifecycle toneMint
class node_social_audit,node_relational_database,node_queue_runtime,node_realtime,node_mail_delivery toneRose
```

## Components

### HTTP & UI

- [Public entry](https://github.com/wdfjcnvp/smarticct/blob/main/public/index.php): PHP entrypoint · `public/index.php`
- [Laravel bootstrap](https://github.com/wdfjcnvp/smarticct/blob/main/bootstrap/app.php): application bootstrap · `bootstrap/app.php`
- [Web routes](https://github.com/wdfjcnvp/smarticct/blob/main/routes/web.php): Blade HTTP routes · Serves public, account, and role dashboard flows. · `routes/web.php`
- [API routes](https://github.com/wdfjcnvp/smarticct/blob/main/routes/api.php): card and queue API · `routes/api.php`
- [Role authorization](https://github.com/wdfjcnvp/smarticct/blob/main/app/Http/Middleware/RoleMiddleware.php): middleware · `app/Http/Middleware/RoleMiddleware.php`
- [Role dashboards](https://github.com/wdfjcnvp/smarticct/blob/main/app/Http/Controllers/Web/User/AdminPanelController.php): web controller · Splits presentation for admin, cashier, commuter, and operator actors. · `app/Http/Controllers/Web/User/AdminPanelController.php`
- [RFID registration API](https://github.com/wdfjcnvp/smarticct/blob/main/app/Http/Controllers/Api/RfidCardRegistrationController.php): API controller · `app/Http/Controllers/Api/RfidCardRegistrationController.php`

### Transport Operations

- [Queue lifecycle](https://github.com/wdfjcnvp/smarticct/blob/main/app/Services/QueueManagementService.php): queue service · Owns dispatch-state transitions and queue management. · `app/Services/QueueManagementService.php`
- [Queue ordering](https://github.com/wdfjcnvp/smarticct/blob/main/app/Services/QueueOrderService.php): queue service · `app/Services/QueueOrderService.php`
- [Dispatch records](https://github.com/wdfjcnvp/smarticct/blob/main/app/Models/Queue.php): Eloquent domain · Queue state connects vehicles, terminals, routes, schedules, and travel records. · `app/Models/Queue.php`
- [Departure event](https://github.com/wdfjcnvp/smarticct/blob/main/app/Events/TriggerDepartingEvent.php): Laravel event · `app/Events/TriggerDepartingEvent.php`
- [Post-departure worker](https://github.com/wdfjcnvp/smarticct/blob/main/app/Jobs/ProcessAfterDepart.php): queued job · `app/Jobs/ProcessAfterDepart.php`

### Fares & Rentals

- [Payment flow](https://github.com/wdfjcnvp/smarticct/blob/main/app/Http/Controllers/PaymentController.php): web controller · Initiates and completes fare payment views. · `app/Http/Controllers/PaymentController.php`
- [Top-up flow](https://github.com/wdfjcnvp/smarticct/blob/main/app/Http/Controllers/TopUpTransactionController.php): web controller · `app/Http/Controllers/TopUpTransactionController.php`
- [Card operations API](https://github.com/wdfjcnvp/smarticct/blob/main/app/Http/Controllers/Api/CardController.php): API controller · `app/Http/Controllers/Api/CardController.php`
- [Fare ledger](https://github.com/wdfjcnvp/smarticct/blob/main/app/Models/CardTransaction.php): Eloquent transactions · Card, top-up, cash, payment, and travel records provide financial auditability. · `app/Models/CardTransaction.php`
- [Rental lifecycle](https://github.com/wdfjcnvp/smarticct/blob/main/app/Models/TripRequest.php): Eloquent domain · Trip requests, operator offers, and rent transactions form a separate lifecycle. · `app/Models/TripRequest.php`

### Platform Infrastructure

- [Social, notifications & audit](https://github.com/wdfjcnvp/smarticct/blob/main/app/Services/PostService.php): application services · Posts, interests, notifications, and audit logging support user activity and traceability. · `app/Services/PostService.php`
- [Relational database](https://github.com/wdfjcnvp/smarticct/blob/main/config/database.php): Laravel database config · Eloquent persistence is defined by migrations. · `config/database.php`
- [Queue runtime](https://github.com/wdfjcnvp/smarticct/blob/main/config/queue.php): Laravel queue config · `config/queue.php`
- [Realtime updates](https://github.com/wdfjcnvp/smarticct/blob/main/resources/js/echo.js): Broadcasting and Echo · Events are delivered to the frontend through Laravel broadcasting/Reverb. · `resources/js/echo.js`
- [OTP email delivery](https://github.com/wdfjcnvp/smarticct/blob/main/app/Mail/PasswordResetOtpMail.php): Laravel mail · `app/Mail/PasswordResetOtpMail.php`

## Connections

- Public entry → Laravel bootstrap: boots
- Laravel bootstrap → Web routes: loads
- Laravel bootstrap → API routes: loads
- Web routes → Role authorization: authorizes
- Role authorization → Role dashboards: permits
- API routes → RFID registration API: dispatches
- API routes → Card operations API: dispatches
- Role dashboards → Queue lifecycle: operates
- Queue lifecycle → Queue ordering: orders
- Queue lifecycle → Dispatch records: updates
- Queue lifecycle → Departure event: emits on departure
- Departure event → Post-departure worker: queues
- Post-departure worker → Dispatch records: records follow-up
- Payment flow → Fare ledger: records
- Top-up flow → Fare ledger: records
- Card operations API → Fare ledger: reads and updates
- RFID registration API → Fare ledger: registers card
- Role dashboards → Rental lifecycle: manages
- Fare ledger → Relational database: persists
- Dispatch records → Relational database: persists
- Rental lifecycle → Relational database: persists
- Post-departure worker → Queue runtime: runs through
- Departure event → Realtime updates: broadcasts
- Realtime updates → Role dashboards: updates UI
- Social, notifications & audit → Relational database: persists activity
