# Firebase Data Flow Diagram

Firebase is the real-time bridge between the ESP32 robot and the operator dashboard.

```mermaid
flowchart LR
    UI[Dashboard UI] -->|write commands| CMD[( /robotCommands )]
    CMD -->|poll / GET| ESP32[ESP32 Firmware]
    ESP32 -->|status updates| STATUS[( /robotStatus )]
    ESP32 -->|GPS telemetry| GPS[( /robotGPS )]
    UI <-->|read live state| STATUS
    UI <-->|read live state| GPS
    UI -->|OTP / delivery workflow| OTP[( /deliveryOTP )]
    OTP -->|verified state| UI
```

## Data Paths

- `/robotCommands` is the operator control channel.
- `/robotStatus` is the live health and motion state channel.
- `/robotGPS` is the tracking channel for map visualization.
- `/deliveryOTP` supports secure handoff and proof-of-delivery workflows.

## Access Strategy

- Public read access is allowed only for non-sensitive telemetry nodes.
- Motion commands and OTP data require authentication.
- Robot writes are accepted only after the ESP32 connects with valid Firebase credentials or rules.
