# dancarteryu/tapos architecture

> Architecture diagram of the GitHub repository dancarteryu/tapos, 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/dancarteryu/tapos
- Repository: https://github.com/dancarteryu/tapos

## Overview

RFID Fare System is a role-based ferry fare and passenger-account application. Collectors manage trips and record single or group fares; passengers review balances, request top-ups, and access receipts and rewards; management configures routes and passenger records and reviews operational and financial activity. Shared PHP pages use a PDO-backed database, with a common receipt renderer and upload helper. The README is empty, so capabilities are identified from the tree and sampled source; links for unsampled features are omitted where their callers are not evidenced.

Main entry points: [`rfid-fare-system/config/database.php`](https://github.com/dancarteryu/tapos/blob/main/rfid-fare-system/config/database.php) (PDO Connection), [`rfid-fare-system/collector/trips.php`](https://github.com/dancarteryu/tapos/blob/main/rfid-fare-system/collector/trips.php) (Trip Operations), [`rfid-fare-system/collector/fare_collection.php`](https://github.com/dancarteryu/tapos/blob/main/rfid-fare-system/collector/fare_collection.php) (Fare Collection), [`rfid-fare-system/passenger/balance_request.php`](https://github.com/dancarteryu/tapos/blob/main/rfid-fare-system/passenger/balance_request.php) (Balance Requests)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_collector["Collector Portal"]
  node_collector_trips["Trip Operations<br/>[trips.php]"]
  node_fare_collection["Fare Collection"]
  node_group_fares["Group Fares"]
  node_collector_transactions["Transaction History<br/>[transactions.php]"]
  node_collector_load["Balance Loading<br/>[load_balance.php]"]
  node_collector_manifest["Trip Manifest<br/>[manifest.php]"]
end

subgraph group_passenger["Passenger Portal"]
  node_passenger_account["Passenger Account<br/>[profile.php]"]
  node_passenger_balance["Balance History"]
  node_balance_request["Balance Requests"]
  node_passenger_receipts["Receipts<br/>[receipts.php]"]
  node_points_shop["Points Shop<br/>[points_shop.php]"]
end

subgraph group_management["Management Portal"]
  node_management_routes["Route Setup"]
  node_management_passengers["Passenger Records<br/>[passengers.php]"]
  node_management_transactions["Transaction Reports<br/>[transactions.php]"]
  node_management_balance["Request Review"]
  node_management_loyalty["Loyalty Settings<br/>[loyalty_points.php]"]
  node_management_trips["Trip Reports<br/>[trip_reports.php]"]
end

subgraph group_shared["Shared Services"]
  node_database_config["PDO Connection<br/>[database.php]"]
  node_receipt_template["Receipt Renderer"]
  node_upload_helper["Upload Helper<br/>[upload_helper.php]"]
  node_session_guard["Role Session Guard<br/>[session.php]"]
end

node_fare_db[("Fare System DB")]

node_fare_collection -->|"opens connection"| node_database_config
node_fare_collection -->|"renders receipt"| node_receipt_template
node_collector_trips -->|"queries trips"| node_database_config
node_collector_trips -->|"checks access"| node_session_guard
node_group_fares -->|"uses connection"| node_database_config
node_collector_transactions -->|"uses connection"| node_database_config
node_collector_load -->|"uses connection"| node_database_config
node_collector_manifest -->|"uses connection"| node_database_config
node_passenger_balance -->|"uses connection"| node_database_config
node_balance_request -->|"uses connection"| node_database_config
node_balance_request -->|"uses uploads"| node_upload_helper
node_passenger_receipts -->|"uses connection"| node_database_config
node_passenger_account -->|"uses connection"| node_database_config
node_points_shop -->|"uses connection"| node_database_config
node_management_routes -->|"uses connection"| node_database_config
node_management_routes -->|"checks access"| node_session_guard
node_management_passengers -->|"uses connection"| node_database_config
node_management_transactions -->|"queries reports"| node_database_config
node_management_balance -->|"uses connection"| node_database_config
node_management_loyalty -->|"uses connection"| node_database_config
node_management_trips -->|"uses connection"| node_database_config
node_database_config -->|"connects to"| node_fare_db

click node_collector_trips "https://github.com/dancarteryu/tapos/blob/main/rfid-fare-system/collector/trips.php"
click node_fare_collection "https://github.com/dancarteryu/tapos/blob/main/rfid-fare-system/collector/fare_collection.php"
click node_group_fares "https://github.com/dancarteryu/tapos/blob/main/rfid-fare-system/collector/fare_collection_group.php"
click node_collector_transactions "https://github.com/dancarteryu/tapos/blob/main/rfid-fare-system/collector/transactions.php"
click node_collector_load "https://github.com/dancarteryu/tapos/blob/main/rfid-fare-system/collector/load_balance.php"
click node_collector_manifest "https://github.com/dancarteryu/tapos/blob/main/rfid-fare-system/collector/manifest.php"
click node_passenger_account "https://github.com/dancarteryu/tapos/blob/main/rfid-fare-system/passenger/profile.php"
click node_passenger_balance "https://github.com/dancarteryu/tapos/blob/main/rfid-fare-system/passenger/balance_history.php"
click node_balance_request "https://github.com/dancarteryu/tapos/blob/main/rfid-fare-system/passenger/balance_request.php"
click node_passenger_receipts "https://github.com/dancarteryu/tapos/blob/main/rfid-fare-system/passenger/receipts.php"
click node_points_shop "https://github.com/dancarteryu/tapos/blob/main/rfid-fare-system/passenger/points_shop.php"
click node_management_routes "https://github.com/dancarteryu/tapos/blob/main/rfid-fare-system/management/destinations_edit.php"
click node_management_passengers "https://github.com/dancarteryu/tapos/blob/main/rfid-fare-system/management/passengers.php"
click node_management_transactions "https://github.com/dancarteryu/tapos/blob/main/rfid-fare-system/management/transactions.php"
click node_management_balance "https://github.com/dancarteryu/tapos/blob/main/rfid-fare-system/management/balance_requests.php"
click node_management_loyalty "https://github.com/dancarteryu/tapos/blob/main/rfid-fare-system/management/loyalty_points.php"
click node_management_trips "https://github.com/dancarteryu/tapos/blob/main/rfid-fare-system/management/trip_reports.php"
click node_database_config "https://github.com/dancarteryu/tapos/blob/main/rfid-fare-system/config/database.php"
click node_receipt_template "https://github.com/dancarteryu/tapos/blob/main/rfid-fare-system/includes/receipt_template.php"
click node_upload_helper "https://github.com/dancarteryu/tapos/blob/main/rfid-fare-system/includes/upload_helper.php"
click node_session_guard "https://github.com/dancarteryu/tapos/blob/main/rfid-fare-system/includes/session.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_collector_trips,node_fare_collection,node_group_fares,node_collector_transactions,node_collector_load,node_collector_manifest toneBlue
class node_passenger_account,node_passenger_balance,node_balance_request,node_passenger_receipts,node_points_shop,node_fare_db toneAmber
class node_management_routes,node_management_passengers,node_management_transactions,node_management_balance,node_management_loyalty,node_management_trips toneMint
class node_database_config,node_receipt_template,node_upload_helper,node_session_guard toneRose
```

## Components

### Collector Portal

- [Trip Operations](https://github.com/dancarteryu/tapos/blob/main/rfid-fare-system/collector/trips.php): `rfid-fare-system/collector/trips.php`
- [Fare Collection](https://github.com/dancarteryu/tapos/blob/main/rfid-fare-system/collector/fare_collection.php): `rfid-fare-system/collector/fare_collection.php`
- [Group Fares](https://github.com/dancarteryu/tapos/blob/main/rfid-fare-system/collector/fare_collection_group.php): `rfid-fare-system/collector/fare_collection_group.php`
- [Transaction History](https://github.com/dancarteryu/tapos/blob/main/rfid-fare-system/collector/transactions.php): `rfid-fare-system/collector/transactions.php`
- [Balance Loading](https://github.com/dancarteryu/tapos/blob/main/rfid-fare-system/collector/load_balance.php): `rfid-fare-system/collector/load_balance.php`
- [Trip Manifest](https://github.com/dancarteryu/tapos/blob/main/rfid-fare-system/collector/manifest.php): `rfid-fare-system/collector/manifest.php`

### Passenger Portal

- [Passenger Account](https://github.com/dancarteryu/tapos/blob/main/rfid-fare-system/passenger/profile.php): `rfid-fare-system/passenger/profile.php`
- [Balance History](https://github.com/dancarteryu/tapos/blob/main/rfid-fare-system/passenger/balance_history.php): `rfid-fare-system/passenger/balance_history.php`
- [Balance Requests](https://github.com/dancarteryu/tapos/blob/main/rfid-fare-system/passenger/balance_request.php): `rfid-fare-system/passenger/balance_request.php`
- [Receipts](https://github.com/dancarteryu/tapos/blob/main/rfid-fare-system/passenger/receipts.php): `rfid-fare-system/passenger/receipts.php`
- [Points Shop](https://github.com/dancarteryu/tapos/blob/main/rfid-fare-system/passenger/points_shop.php): `rfid-fare-system/passenger/points_shop.php`

### Management Portal

- [Route Setup](https://github.com/dancarteryu/tapos/blob/main/rfid-fare-system/management/destinations_edit.php): `rfid-fare-system/management/destinations_edit.php`
- [Passenger Records](https://github.com/dancarteryu/tapos/blob/main/rfid-fare-system/management/passengers.php): `rfid-fare-system/management/passengers.php`
- [Transaction Reports](https://github.com/dancarteryu/tapos/blob/main/rfid-fare-system/management/transactions.php): `rfid-fare-system/management/transactions.php`
- [Request Review](https://github.com/dancarteryu/tapos/blob/main/rfid-fare-system/management/balance_requests.php): `rfid-fare-system/management/balance_requests.php`
- [Loyalty Settings](https://github.com/dancarteryu/tapos/blob/main/rfid-fare-system/management/loyalty_points.php): `rfid-fare-system/management/loyalty_points.php`
- [Trip Reports](https://github.com/dancarteryu/tapos/blob/main/rfid-fare-system/management/trip_reports.php): `rfid-fare-system/management/trip_reports.php`

### Shared Services

- [PDO Connection](https://github.com/dancarteryu/tapos/blob/main/rfid-fare-system/config/database.php): `rfid-fare-system/config/database.php`
- [Receipt Renderer](https://github.com/dancarteryu/tapos/blob/main/rfid-fare-system/includes/receipt_template.php): `rfid-fare-system/includes/receipt_template.php`
- [Upload Helper](https://github.com/dancarteryu/tapos/blob/main/rfid-fare-system/includes/upload_helper.php): `rfid-fare-system/includes/upload_helper.php`
- [Role Session Guard](https://github.com/dancarteryu/tapos/blob/main/rfid-fare-system/includes/session.php): `rfid-fare-system/includes/session.php`

### Other components

- **Fare System DB**

## Connections

- Fare Collection → PDO Connection: opens connection (evidence: `rfid-fare-system/collector/fare_collection.php`)
- Fare Collection → Receipt Renderer: renders receipt (evidence: `rfid-fare-system/collector/fare_collection.php`)
- Trip Operations → PDO Connection: queries trips (evidence: `rfid-fare-system/collector/trips.php`)
- Trip Operations → Role Session Guard: checks access (evidence: `rfid-fare-system/collector/trips.php`)
- Group Fares → PDO Connection: uses connection (evidence: `rfid-fare-system/collector/fare_collection_group.php`)
- Transaction History → PDO Connection: uses connection (evidence: `rfid-fare-system/collector/transactions.php`)
- Balance Loading → PDO Connection: uses connection (evidence: `rfid-fare-system/collector/load_balance.php`)
- Trip Manifest → PDO Connection: uses connection (evidence: `rfid-fare-system/collector/manifest.php`)
- Balance History → PDO Connection: uses connection (evidence: `rfid-fare-system/passenger/balance_history.php`)
- Balance Requests → PDO Connection: uses connection (evidence: `rfid-fare-system/passenger/balance_request.php`)
- Balance Requests → Upload Helper: uses uploads (evidence: `rfid-fare-system/passenger/balance_request.php`)
- Receipts → PDO Connection: uses connection (evidence: `rfid-fare-system/passenger/receipts.php`)
- Passenger Account → PDO Connection: uses connection (evidence: `rfid-fare-system/passenger/profile.php`)
- Points Shop → PDO Connection: uses connection (evidence: `rfid-fare-system/passenger/points_shop.php`)
- Route Setup → PDO Connection: uses connection (evidence: `rfid-fare-system/management/destinations_edit.php`)
- Route Setup → Role Session Guard: checks access (evidence: `rfid-fare-system/management/destinations_edit.php`)
- Passenger Records → PDO Connection: uses connection (evidence: `rfid-fare-system/management/passengers.php`)
- Transaction Reports → PDO Connection: queries reports (evidence: `rfid-fare-system/management/transactions.php`)
- Request Review → PDO Connection: uses connection (evidence: `rfid-fare-system/management/balance_requests.php`)
- Loyalty Settings → PDO Connection: uses connection (evidence: `rfid-fare-system/management/loyalty_points.php`)
- Trip Reports → PDO Connection: uses connection (evidence: `rfid-fare-system/management/trip_reports.php`)
- PDO Connection → Fare System DB: connects to (evidence: `rfid-fare-system/config/database.php`)
