# sharsdylow/calit2 architecture

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

- Interactive diagram: https://gitdiagram.com/sharsdylow/calit2
- Repository: https://github.com/sharsdylow/calit2

## Overview

This repository is a web interface for monitoring sensors and cameras and managing devices. The main workflow is navigating to a dashboard or feature page, loading device or camera data, and presenting it as location-based charts, camera streams, or device controls. Sensor search and device registration/deletion are separate feature branches. The source index and excerpts support the frontend call paths; the camera backend’s implementation was not excerpted, so its connection to the frontend stream request is unverified.

Main entry points: [`frontend/src/App.js`](https://github.com/sharsdylow/calit2/blob/main/frontend/src/App.js) (App router), [`frontend/src/pages/Dashboard.jsx`](https://github.com/sharsdylow/calit2/blob/main/frontend/src/pages/Dashboard.jsx) (Dashboard), [`frontend/src/components/DashBoardItem.jsx`](https://github.com/sharsdylow/calit2/blob/main/frontend/src/components/DashBoardItem.jsx) (Dashboard items), [`frontend/src/features/sensors/SensorsGroup.jsx`](https://github.com/sharsdylow/calit2/blob/main/frontend/src/features/sensors/SensorsGroup.jsx) (Sensor groups)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_navigation["App navigation"]
  node_app["App router<br/>[App.js]"]
  node_navbar["Navigation bar<br/>[Navbar.jsx]"]
  node_dashboard["Dashboard<br/>[Dashboard.jsx]"]
  node_verticaltabs["Location tabs<br/>[VerticalTabs.jsx]"]
  node_dashboarditem["Dashboard items<br/>[DashBoardItem.jsx]"]
end

subgraph group_devices["Device management"]
  node_settings["Device settings<br/>[Setting.jsx]"]
  node_registerdevice["Register device<br/>[RegisterDevice.jsx]"]
  node_deletedevice["Delete device<br/>[DeleteDevice.jsx]"]
  node_deviceslice["Device state<br/>[deviceSlice.js]"]
  node_deviceservice["Device API client<br/>[deviceService.js]"]
end

subgraph group_sensors["Sensor monitoring"]
  node_sensorpage["Sensor page<br/>[Sensor.jsx]"]
  node_sensorgroup["Sensor groups<br/>[SensorsGroup.jsx]"]
  node_realtimechart["Realtime chart"]
  node_sensorswitch["Sensor visibility<br/>[SensorSwitch.jsx]"]
  node_sensorslice["Sensor state<br/>[sensorsSlice.js]"]
  node_search["Sensor data search"]
  node_searchdata["Search helper<br/>[SearchData.js]"]
  node_statchart["Statistics chart"]
end

subgraph group_cameras["Camera viewing"]
  node_camerapage["Camera page<br/>[Camera.jsx]"]
  node_cameraslice["Camera state<br/>[camerasSlice.js]"]
  node_cameraservice["Stream request client<br/>[cameraService.js]"]
  node_cameraitem["Camera player view<br/>[CameraItem.jsx]"]
  node_jsmpeg["JSMpeg player<br/>[JsmpegPlayer.jsx]"]
  node_camerabackend["Camera backend<br/>[server.js]"]
end

node_user(("User"))
node_deviceapi{{"Device API"}}
node_streamservice{{"Stream endpoint"}}

node_user -->|"opens"| node_app
node_app -->|"renders"| node_navbar
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_sensorpage
node_app -->|"routes to"| node_camerapage
node_dashboard -->|"dispatches fetch"| node_deviceslice
node_dashboard -->|"dispatches fetch"| node_cameraslice
node_dashboard -->|"renders"| node_verticaltabs
node_verticaltabs -->|"uses"| node_dashboarditem
node_dashboarditem -->|"renders"| node_realtimechart
node_dashboarditem -->|"renders"| node_sensorswitch
node_dashboarditem -->|"renders"| node_cameraitem
node_app -->|"routes to"| node_settings
node_settings -->|"renders"| node_registerdevice
node_settings -->|"renders"| node_deletedevice
node_registerdevice -->|"dispatches actions"| node_deviceslice
node_deletedevice -->|"dispatches actions"| node_deviceslice
node_deviceslice -->|"calls"| node_deviceservice
node_deviceservice -->|"HTTP requests"| node_deviceapi
node_sensorpage -->|"renders"| node_sensorgroup
node_sensorpage -->|"renders"| node_search
node_sensorgroup -->|"renders"| node_realtimechart
node_sensorgroup -->|"renders"| node_sensorswitch
node_sensorgroup -->|"uses state"| node_sensorslice
node_realtimechart -->|"dispatches fetch"| node_sensorslice
node_sensorswitch -->|"dispatches visibility"| node_sensorslice
node_sensorslice -->|"fetches devices"| node_deviceservice
node_search -->|"calls"| node_searchdata
node_search -->|"renders results"| node_statchart
node_camerapage -->|"dispatches fetch"| node_cameraslice
node_camerapage -->|"renders"| node_cameraitem
node_cameraslice -->|"fetches camera records"| node_deviceservice
node_cameraslice -->|"requests streams"| node_cameraservice
node_cameraservice -->|"requests stream"| node_streamservice
node_cameraitem -->|"renders stream"| node_jsmpeg
node_camerabackend -.-> node_streamservice

click node_app "https://github.com/sharsdylow/calit2/blob/main/frontend/src/App.js"
click node_navbar "https://github.com/sharsdylow/calit2/blob/main/frontend/src/components/Navbar.jsx"
click node_dashboard "https://github.com/sharsdylow/calit2/blob/main/frontend/src/pages/Dashboard.jsx"
click node_verticaltabs "https://github.com/sharsdylow/calit2/blob/main/frontend/src/components/VerticalTabs.jsx"
click node_dashboarditem "https://github.com/sharsdylow/calit2/blob/main/frontend/src/components/DashBoardItem.jsx"
click node_settings "https://github.com/sharsdylow/calit2/blob/main/frontend/src/pages/Setting.jsx"
click node_registerdevice "https://github.com/sharsdylow/calit2/blob/main/frontend/src/features/device/RegisterDevice.jsx"
click node_deletedevice "https://github.com/sharsdylow/calit2/blob/main/frontend/src/features/device/DeleteDevice.jsx"
click node_deviceslice "https://github.com/sharsdylow/calit2/blob/main/frontend/src/features/device/deviceSlice.js"
click node_deviceservice "https://github.com/sharsdylow/calit2/blob/main/frontend/src/features/device/deviceService.js"
click node_sensorpage "https://github.com/sharsdylow/calit2/blob/main/frontend/src/pages/Sensor.jsx"
click node_sensorgroup "https://github.com/sharsdylow/calit2/blob/main/frontend/src/features/sensors/SensorsGroup.jsx"
click node_realtimechart "https://github.com/sharsdylow/calit2/blob/main/frontend/src/features/sensors/RealtimeSensorChart.jsx"
click node_sensorswitch "https://github.com/sharsdylow/calit2/blob/main/frontend/src/features/sensors/SensorSwitch.jsx"
click node_sensorslice "https://github.com/sharsdylow/calit2/blob/main/frontend/src/features/sensors/sensorsSlice.js"
click node_search "https://github.com/sharsdylow/calit2/blob/main/frontend/src/features/sensors/SensorDataSearch.jsx"
click node_searchdata "https://github.com/sharsdylow/calit2/blob/main/frontend/src/lib/SearchData.js"
click node_statchart "https://github.com/sharsdylow/calit2/blob/main/frontend/src/features/sensors/StatisticSensorChart.jsx"
click node_camerapage "https://github.com/sharsdylow/calit2/blob/main/frontend/src/pages/Camera.jsx"
click node_cameraslice "https://github.com/sharsdylow/calit2/blob/main/frontend/src/features/camera/camerasSlice.js"
click node_cameraservice "https://github.com/sharsdylow/calit2/blob/main/frontend/src/features/camera/cameraService.js"
click node_cameraitem "https://github.com/sharsdylow/calit2/blob/main/frontend/src/features/camera/CameraItem.jsx"
click node_jsmpeg "https://github.com/sharsdylow/calit2/blob/main/frontend/src/components/JsmpegPlayer.jsx"
click node_camerabackend "https://github.com/sharsdylow/calit2/blob/main/camera-backend/server.js"

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_app,node_navbar,node_dashboard,node_verticaltabs,node_dashboarditem,node_user toneBlue
class node_settings,node_registerdevice,node_deletedevice,node_deviceslice,node_deviceservice toneAmber
class node_sensorpage,node_sensorgroup,node_realtimechart,node_sensorswitch,node_sensorslice,node_search,node_searchdata,node_statchart,node_deviceapi toneMint
class node_camerapage,node_cameraslice,node_cameraservice,node_cameraitem,node_jsmpeg,node_camerabackend toneRose
class node_streamservice toneIndigo
```

## Components

### App navigation

- [App router](https://github.com/sharsdylow/calit2/blob/main/frontend/src/App.js): `frontend/src/App.js`
- [Navigation bar](https://github.com/sharsdylow/calit2/blob/main/frontend/src/components/Navbar.jsx): `frontend/src/components/Navbar.jsx`
- [Dashboard](https://github.com/sharsdylow/calit2/blob/main/frontend/src/pages/Dashboard.jsx): `frontend/src/pages/Dashboard.jsx`
- [Location tabs](https://github.com/sharsdylow/calit2/blob/main/frontend/src/components/VerticalTabs.jsx): `frontend/src/components/VerticalTabs.jsx`
- [Dashboard items](https://github.com/sharsdylow/calit2/blob/main/frontend/src/components/DashBoardItem.jsx): `frontend/src/components/DashBoardItem.jsx`

### Device management

- [Device settings](https://github.com/sharsdylow/calit2/blob/main/frontend/src/pages/Setting.jsx): `frontend/src/pages/Setting.jsx`
- [Register device](https://github.com/sharsdylow/calit2/blob/main/frontend/src/features/device/RegisterDevice.jsx): `frontend/src/features/device/RegisterDevice.jsx`
- [Delete device](https://github.com/sharsdylow/calit2/blob/main/frontend/src/features/device/DeleteDevice.jsx): `frontend/src/features/device/DeleteDevice.jsx`
- [Device state](https://github.com/sharsdylow/calit2/blob/main/frontend/src/features/device/deviceSlice.js): `frontend/src/features/device/deviceSlice.js`
- [Device API client](https://github.com/sharsdylow/calit2/blob/main/frontend/src/features/device/deviceService.js): `frontend/src/features/device/deviceService.js`

### Sensor monitoring

- [Sensor page](https://github.com/sharsdylow/calit2/blob/main/frontend/src/pages/Sensor.jsx): `frontend/src/pages/Sensor.jsx`
- [Sensor groups](https://github.com/sharsdylow/calit2/blob/main/frontend/src/features/sensors/SensorsGroup.jsx): `frontend/src/features/sensors/SensorsGroup.jsx`
- [Realtime chart](https://github.com/sharsdylow/calit2/blob/main/frontend/src/features/sensors/RealtimeSensorChart.jsx): `frontend/src/features/sensors/RealtimeSensorChart.jsx`
- [Sensor visibility](https://github.com/sharsdylow/calit2/blob/main/frontend/src/features/sensors/SensorSwitch.jsx): `frontend/src/features/sensors/SensorSwitch.jsx`
- [Sensor state](https://github.com/sharsdylow/calit2/blob/main/frontend/src/features/sensors/sensorsSlice.js): `frontend/src/features/sensors/sensorsSlice.js`
- [Sensor data search](https://github.com/sharsdylow/calit2/blob/main/frontend/src/features/sensors/SensorDataSearch.jsx): `frontend/src/features/sensors/SensorDataSearch.jsx`
- [Search helper](https://github.com/sharsdylow/calit2/blob/main/frontend/src/lib/SearchData.js): `frontend/src/lib/SearchData.js`
- [Statistics chart](https://github.com/sharsdylow/calit2/blob/main/frontend/src/features/sensors/StatisticSensorChart.jsx): `frontend/src/features/sensors/StatisticSensorChart.jsx`

### Camera viewing

- [Camera page](https://github.com/sharsdylow/calit2/blob/main/frontend/src/pages/Camera.jsx): `frontend/src/pages/Camera.jsx`
- [Camera state](https://github.com/sharsdylow/calit2/blob/main/frontend/src/features/camera/camerasSlice.js): `frontend/src/features/camera/camerasSlice.js`
- [Stream request client](https://github.com/sharsdylow/calit2/blob/main/frontend/src/features/camera/cameraService.js): `frontend/src/features/camera/cameraService.js`
- [Camera player view](https://github.com/sharsdylow/calit2/blob/main/frontend/src/features/camera/CameraItem.jsx): `frontend/src/features/camera/CameraItem.jsx`
- [JSMpeg player](https://github.com/sharsdylow/calit2/blob/main/frontend/src/components/JsmpegPlayer.jsx): `frontend/src/components/JsmpegPlayer.jsx`
- [Camera backend](https://github.com/sharsdylow/calit2/blob/main/camera-backend/server.js): `camera-backend/server.js`

### Other components

- **User**
- **Device API**
- **Stream endpoint**

## Connections

- User → App router: opens (evidence: `frontend/src/App.js`)
- App router → Navigation bar: renders (evidence: `frontend/src/App.js`)
- App router → Dashboard: routes to (evidence: `frontend/src/App.js`)
- App router → Sensor page: routes to (evidence: `frontend/src/App.js`)
- App router → Camera page: routes to (evidence: `frontend/src/App.js`)
- Dashboard → Device state: dispatches fetch (evidence: `frontend/src/pages/Dashboard.jsx`)
- Dashboard → Camera state: dispatches fetch (evidence: `frontend/src/pages/Dashboard.jsx`)
- Dashboard → Location tabs: renders (evidence: `frontend/src/pages/Dashboard.jsx`)
- Location tabs → Dashboard items: uses (evidence: `frontend/src/components/VerticalTabs.jsx`)
- Dashboard items → Realtime chart: renders (evidence: `frontend/src/components/DashBoardItem.jsx`)
- Dashboard items → Sensor visibility: renders (evidence: `frontend/src/components/DashBoardItem.jsx`)
- Dashboard items → Camera player view: renders (evidence: `frontend/src/components/DashBoardItem.jsx`)
- App router → Device settings: routes to (evidence: `frontend/src/App.js`)
- Device settings → Register device: renders (evidence: `frontend/src/pages/Setting.jsx`)
- Device settings → Delete device: renders (evidence: `frontend/src/pages/Setting.jsx`)
- Register device → Device state: dispatches actions (evidence: `frontend/src/features/device/RegisterDevice.jsx`)
- Delete device → Device state: dispatches actions (evidence: `frontend/src/features/device/DeleteDevice.jsx`)
- Device state → Device API client: calls (evidence: `frontend/src/features/device/deviceSlice.js`)
- Device API client → Device API: HTTP requests (evidence: `frontend/src/features/device/deviceService.js`)
- Sensor page → Sensor groups: renders (evidence: `frontend/src/pages/Sensor.jsx`)
- Sensor page → Sensor data search: renders (evidence: `frontend/src/pages/Sensor.jsx`)
- Sensor groups → Realtime chart: renders (evidence: `frontend/src/features/sensors/SensorsGroup.jsx`)
- Sensor groups → Sensor visibility: renders (evidence: `frontend/src/features/sensors/SensorsGroup.jsx`)
- Sensor groups → Sensor state: uses state (evidence: `frontend/src/features/sensors/SensorsGroup.jsx`)
- Realtime chart → Sensor state: dispatches fetch (evidence: `frontend/src/features/sensors/RealtimeSensorChart.jsx`)
- Sensor visibility → Sensor state: dispatches visibility (evidence: `frontend/src/features/sensors/SensorSwitch.jsx`)
- Sensor state → Device API client: fetches devices (evidence: `frontend/src/features/sensors/sensorsSlice.js`)
- Sensor data search → Search helper: calls (evidence: `frontend/src/features/sensors/SensorDataSearch.jsx`)
- Sensor data search → Statistics chart: renders results (evidence: `frontend/src/features/sensors/SensorDataSearch.jsx`)
- Camera page → Camera state: dispatches fetch (evidence: `frontend/src/pages/Camera.jsx`)
- Camera page → Camera player view: renders (evidence: `frontend/src/pages/Camera.jsx`)
- Camera state → Device API client: fetches camera records (evidence: `frontend/src/features/camera/camerasSlice.js`)
- Camera state → Stream request client: requests streams (evidence: `frontend/src/features/camera/camerasSlice.js`)
- Stream request client → Stream endpoint: requests stream (evidence: `frontend/src/features/camera/cameraService.js`)
- Camera player view → JSMpeg player: renders stream (evidence: `frontend/src/features/camera/CameraItem.jsx`)
- Camera backend → Stream endpoint
