# chhana-chea/sereyromanea-parking-system architecture

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

- Interactive diagram: https://gitdiagram.com/chhana-chea/sereyromanea-parking-system
- Repository: https://github.com/chhana-chea/sereyromanea-parking-system

## Overview

MotorPark is an IoT-enabled motorcycle parking and management system. Riders use a browser kiosk for self-service check-in and ticketing; staff use the management console to monitor spaces, verify vehicles with camera captures, and process check-outs and fees. Managers administer accounts, camera settings, and financial reports. The Flask backend coordinates these workflows with PostgreSQL, local image storage, and an ESP32-CAM. Several responsibilities are described in the README but their route implementations were not sampled, so those documented relationships cite the README; the graph does not infer calls among backend features.

Main entry points: [`frontend/script.js`](https://github.com/chhana-chea/sereyromanea-parking-system/blob/main/frontend/script.js) (Browser workflows), [`backend/app.py`](https://github.com/chhana-chea/sereyromanea-parking-system/blob/main/backend/app.py) (Parking and ticket API), [`frontend/index.html`](https://github.com/chhana-chea/sereyromanea-parking-system/blob/main/frontend/index.html) (Management console), [`backend/auth.py`](https://github.com/chhana-chea/sereyromanea-parking-system/blob/main/backend/auth.py) (Authentication and accounts)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["Browser clients"]
  node_management_ui["Management console<br/>[index.html]"]
  node_kiosk_ui["Customer kiosk"]
  node_ticket_ui["Ticket view<br/>[ticket.html]"]
  node_frontend_logic["Browser workflows<br/>[script.js]"]
end

subgraph group_operations["Parking operations"]
  node_parking["Parking and ticket API<br/>[app.py]"]
  node_camera_proxy["Camera proxy and frame cache<br/>[app.py]"]
  node_camera_settings["Camera configuration<br/>[camera_config.json]"]
end

subgraph group_management["Access and reporting"]
  node_auth["Authentication and accounts<br/>[auth.py]"]
  node_analytics["Financial and shift reports<br/>[app.py]"]
end

subgraph group_infrastructure["Data and IoT"]
  node_image_storage[("Capture image files")]
  node_postgres[("PostgreSQL records<br/>[database.sql]")]
  node_camera_pins["Board pin mapping<br/>[board_config.h]"]
end

node_rider(("Arriving rider"))
node_staff(("Parking staff"))
node_manager(("System manager"))
node_camera{{"ESP32-CAM<br/>[esp32cam.ino]"}}

node_rider -->|"uses"| node_kiosk_ui
node_staff -->|"uses"| node_management_ui
node_manager -->|"uses"| node_management_ui
node_management_ui -->|"runs"| node_frontend_logic
node_kiosk_ui -->|"runs"| node_frontend_logic
node_frontend_logic -->|"requests API"| node_parking
node_frontend_logic -->|"requests snapshots"| node_camera_proxy
node_frontend_logic -->|"submits login"| node_auth
node_parking -->|"reads and writes"| node_postgres
node_auth -->|"reads and writes accounts"| node_postgres
node_parking -->|"stores captures"| node_image_storage
node_camera_proxy -->|"fetches frames"| node_camera
node_camera_proxy -->|"reads IP setting"| node_camera_settings
node_parking -->|"uses verification captures"| node_camera_proxy
node_frontend_logic -->|"renders ticket"| node_ticket_ui
node_frontend_logic -->|"requests reports"| node_analytics
node_analytics -->|"queries revenue"| node_postgres
node_manager -->|"manages accounts"| node_auth
node_camera -.->|"uses pin map"| node_camera_pins

click node_management_ui "https://github.com/chhana-chea/sereyromanea-parking-system/blob/main/frontend/index.html"
click node_kiosk_ui "https://github.com/chhana-chea/sereyromanea-parking-system/blob/main/frontend/mobile_scanner.html"
click node_ticket_ui "https://github.com/chhana-chea/sereyromanea-parking-system/blob/main/frontend/ticket.html"
click node_frontend_logic "https://github.com/chhana-chea/sereyromanea-parking-system/blob/main/frontend/script.js"
click node_auth "https://github.com/chhana-chea/sereyromanea-parking-system/blob/main/backend/auth.py"
click node_parking "https://github.com/chhana-chea/sereyromanea-parking-system/blob/main/backend/app.py"
click node_camera_proxy "https://github.com/chhana-chea/sereyromanea-parking-system/blob/main/backend/app.py"
click node_image_storage "https://github.com/chhana-chea/sereyromanea-parking-system/tree/main/uploads/parking"
click node_analytics "https://github.com/chhana-chea/sereyromanea-parking-system/blob/main/backend/app.py"
click node_camera_settings "https://github.com/chhana-chea/sereyromanea-parking-system/blob/main/backend/camera_config.json"
click node_postgres "https://github.com/chhana-chea/sereyromanea-parking-system/blob/main/backend/database.sql"
click node_camera "https://github.com/chhana-chea/sereyromanea-parking-system/blob/main/esp32cam/esp32cam.ino"
click node_camera_pins "https://github.com/chhana-chea/sereyromanea-parking-system/blob/main/esp32cam/board_config.h"

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_management_ui,node_kiosk_ui,node_ticket_ui,node_frontend_logic toneBlue
class node_parking,node_camera_proxy,node_camera_settings toneAmber
class node_auth,node_analytics toneMint
class node_image_storage,node_postgres,node_camera_pins toneRose
class node_rider,node_staff,node_manager toneIndigo
class node_camera toneTeal
```

## Components

### Browser clients

- [Management console](https://github.com/chhana-chea/sereyromanea-parking-system/blob/main/frontend/index.html): `frontend/index.html`
- [Customer kiosk](https://github.com/chhana-chea/sereyromanea-parking-system/blob/main/frontend/mobile_scanner.html): `frontend/mobile_scanner.html`
- [Ticket view](https://github.com/chhana-chea/sereyromanea-parking-system/blob/main/frontend/ticket.html): `frontend/ticket.html`
- [Browser workflows](https://github.com/chhana-chea/sereyromanea-parking-system/blob/main/frontend/script.js): `frontend/script.js`

### Parking operations

- [Parking and ticket API](https://github.com/chhana-chea/sereyromanea-parking-system/blob/main/backend/app.py): `backend/app.py`
- [Camera proxy and frame cache](https://github.com/chhana-chea/sereyromanea-parking-system/blob/main/backend/app.py): `backend/app.py`
- [Camera configuration](https://github.com/chhana-chea/sereyromanea-parking-system/blob/main/backend/camera_config.json): `backend/camera_config.json`

### Access and reporting

- [Authentication and accounts](https://github.com/chhana-chea/sereyromanea-parking-system/blob/main/backend/auth.py): `backend/auth.py`
- [Financial and shift reports](https://github.com/chhana-chea/sereyromanea-parking-system/blob/main/backend/app.py): `backend/app.py`

### Data and IoT

- [Capture image files](https://github.com/chhana-chea/sereyromanea-parking-system/tree/main/uploads/parking): `uploads/parking`
- [PostgreSQL records](https://github.com/chhana-chea/sereyromanea-parking-system/blob/main/backend/database.sql): `backend/database.sql`
- [Board pin mapping](https://github.com/chhana-chea/sereyromanea-parking-system/blob/main/esp32cam/board_config.h): `esp32cam/board_config.h`

### Other components

- **Arriving rider**
- **Parking staff**
- **System manager**
- [ESP32-CAM](https://github.com/chhana-chea/sereyromanea-parking-system/blob/main/esp32cam/esp32cam.ino): `esp32cam/esp32cam.ino`

## Connections

- Arriving rider → Customer kiosk: uses (evidence: `README.md`)
- Parking staff → Management console: uses (evidence: `README.md`)
- System manager → Management console: uses (evidence: `README.md`)
- Management console → Browser workflows: runs (evidence: `README.md`)
- Customer kiosk → Browser workflows: runs (evidence: `README.md`)
- Browser workflows → Parking and ticket API: requests API (evidence: `frontend/script.js`)
- Browser workflows → Camera proxy and frame cache: requests snapshots (evidence: `frontend/script.js`)
- Browser workflows → Authentication and accounts: submits login (evidence: `frontend/script.js`)
- Parking and ticket API → PostgreSQL records: reads and writes (evidence: `README.md`)
- Authentication and accounts → PostgreSQL records: reads and writes accounts (evidence: `backend/auth.py`)
- Parking and ticket API → Capture image files: stores captures (evidence: `README.md`)
- Camera proxy and frame cache → ESP32-CAM: fetches frames (evidence: `backend/app.py`)
- Camera proxy and frame cache → Camera configuration: reads IP setting (evidence: `backend/app.py`)
- Parking and ticket API → Camera proxy and frame cache: uses verification captures (evidence: `README.md`)
- Browser workflows → Ticket view: renders ticket (evidence: `README.md`)
- Browser workflows → Financial and shift reports: requests reports (evidence: `frontend/script.js`)
- Financial and shift reports → PostgreSQL records: queries revenue (evidence: `backend/app.py`)
- System manager → Authentication and accounts: manages accounts (evidence: `backend/auth.py`)
- ESP32-CAM → Board pin mapping: uses pin map
