# sabarees3578/thingzkit-cloud architecture

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

- Interactive diagram: https://gitdiagram.com/sabarees3578/thingzkit-cloud
- Repository: https://github.com/sabarees3578/thingzkit-cloud

## Overview

#### Purpose and entry points
Thingzkit Cloud is an IoT management dashboard paired with an Arduino client library and device OTA sketch storage. The browser application starts at `src/main.jsx`, renders the root application in `src/App.jsx`, and is built with Vite (`vite.config.js`). Server/deployment entry points are `server.cjs`, `Dockerfile`, and platform manifests `railway.toml` and `render.yaml`.

#### Frontend application shell
The React UI is organized around a dashboard shell: `src/components/layout/DashboardLayout.jsx` composes navigation from `src/components/Sidebar.jsx` and top-level controls from `src/components/Topbar.jsx`. Global styling is initialized in `src/styles/globals.css`; layout and feature components use colocated CSS modules.

#### Application state and identity boundary
Shared client state is separated into application/domain state in `src/context/AppContext.jsx` and authentication state in `src/context/AuthContext.jsx`. Firebase integration is centralized at `src/firebase.js`, making Firebase the primary external backend/auth boundary exposed by the frontend. `src/data/mockData.js` supports local or placeholder dashboard data where live integration is unavailable.

#### Dashboard and operational views
Page-level modules represent the main IoT control-plane areas: device management (`src/pages/DevicesPage.jsx`), dashboard visualization (`src/pages/DashboardPage.jsx`), telemetry/log review (`src/pages/DataLogPage.jsx`), analytics (`src/pages/AnalyticsPage.jsx`), alerts (`src/pages/AlertsPage.jsx`), and automations (`src/pages/AutomationsPage.jsx`). `src/pages/WelcomePage.jsx` provides the initial/onboarding route, while settings and team management live in `src/pages/SettingsPage.jsx` and `src/pages/TeamPage.jsx`.

#### Provisioning and dashboard composition
Device/project/widget creation is handled through modal workflows rather than dedicated pages. `src/components/modals/AddDeviceWizard.jsx` and `src/components/modals/AddDeviceModal.jsx` drive device onboarding; `src/components/modals/NewProjectModal.jsx` creates projects; `src/components/modals/AddWidgetModal.jsx` adds dashboard widgets. The embedded code-editing surface is `src/components/WebEditor.jsx`, likely linking cloud-side device setup with sketch authoring.

#### Embedded-device integration
The reusable Arduino-facing SDK is `arduino-library/EnthutechIoT/EnthutechIoT.h` and `arduino-library/EnthutechIoT/EnthutechIoT.cpp`. Its intended device-to-cloud patterns are demonstrated by `arduino-library/EnthutechIoT/examples/BasicSensor/BasicSensor.ino` and `arduino-library/EnthutechIoT/examples/FullBidirectional/FullBidirectional.ino`, indicating telemetry publishing plus bidirectional cloud/device interaction.

#### OTA and deployment boundary
Per-device OTA source is stored under device identifiers, including `ota/DEV-A2DD2A86/sketch/sketch.ino` and `ota/DEV-FC61DC23/sketch/sketch.ino`. This is a filesystem-backed boundary between cloud-managed device records and deployable firmware artifacts. CI/CD deployment is defined in `.github/workflows/deploy.yml`; container deployment is supported through `Dockerfile`, with Railway and Render-specific configuration available.

Main entry points: [`src/components/layout/DashboardLayout.jsx`](https://github.com/sabarees3578/thingzkit-cloud/blob/main/src/components/layout/DashboardLayout.jsx) (Dashboard shell), [`src/App.jsx`](https://github.com/sabarees3578/thingzkit-cloud/blob/main/src/App.jsx) (Root app), [`ota/DEV-A2DD2A86/sketch/sketch.ino`](https://github.com/sabarees3578/thingzkit-cloud/blob/main/ota/DEV-A2DD2A86/sketch/sketch.ino) (OTA sketches), [`src/firebase.js`](https://github.com/sabarees3578/thingzkit-cloud/blob/main/src/firebase.js) (Firebase)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["React dashboard"]
  node_vite{{"Vite build<br/>build tool<br/>[vite.config.js]"}}
  node_main["Browser entry<br/>React entry<br/>[main.jsx]"]
  node_app["Root app<br/>application root<br/>[App.jsx]"]
  node_layout["Dashboard shell<br/>layout"]
  node_navigation["Sidebar &amp; topbar<br/>navigation controls"]
  node_app_state["Domain state<br/>React context<br/>[AppContext.jsx]"]
  node_auth_state["Auth state<br/>React context<br/>[AuthContext.jsx]"]
  node_views["Operational views<br/>dashboard pages"]
  node_onboarding["Welcome route<br/>onboarding page<br/>[WelcomePage.jsx]"]
  node_admin["Settings &amp; team<br/>administration pages"]
  node_provisioning["Provisioning modals<br/>device/project workflows"]
  node_widget_modal["Widget composer<br/>dashboard workflow<br/>[AddWidgetModal.jsx]"]
  node_editor["Web editor<br/>sketch editor<br/>[WebEditor.jsx]"]
end

subgraph group_cloud["Cloud &amp; deployment"]
  node_firebase[("Firebase<br/>backend/auth boundary<br/>[firebase.js]")]
  node_server["Server entry<br/>server runtime<br/>[server.cjs]"]
  node_ota["OTA sketches<br/>firmware artifact store<br/>[sketch.ino]"]
  node_deployment["Deployment pipeline<br/>CI/container deployment<br/>[deploy.yml]"]
end

subgraph group_embedded["Embedded integration"]
  node_arduino_sdk["EnthutechIoT SDK<br/>Arduino library<br/>[EnthutechIoT.cpp]"]
  node_device_examples["Device examples<br/>Arduino sketches"]
end

node_vite -->|"builds"| node_main
node_main -->|"renders"| node_app
node_app -->|"hosts"| node_layout
node_layout -->|"composes"| node_navigation
node_layout -->|"routes to"| node_views
node_layout -->|"routes to"| node_onboarding
node_layout -->|"routes to"| node_admin
node_app -->|"uses"| node_app_state
node_app -->|"uses"| node_auth_state
node_auth_state -->|"authenticates via"| node_firebase
node_app_state -->|"integrates with"| node_firebase
node_views -->|"opens"| node_provisioning
node_views -->|"composes dashboards with"| node_widget_modal
node_provisioning -.->|"can lead to"| node_editor
node_editor -->|"authors"| node_ota
node_server -.->|"serves managed"| node_ota
node_deployment -->|"deploys"| node_server
node_arduino_sdk -->|"exchanges cloud data with"| node_firebase
node_device_examples -->|"uses"| node_arduino_sdk
node_ota -.->|"device firmware pattern"| node_device_examples

click node_vite "https://github.com/sabarees3578/thingzkit-cloud/blob/main/vite.config.js"
click node_main "https://github.com/sabarees3578/thingzkit-cloud/blob/main/src/main.jsx"
click node_app "https://github.com/sabarees3578/thingzkit-cloud/blob/main/src/App.jsx"
click node_layout "https://github.com/sabarees3578/thingzkit-cloud/blob/main/src/components/layout/DashboardLayout.jsx"
click node_app_state "https://github.com/sabarees3578/thingzkit-cloud/blob/main/src/context/AppContext.jsx"
click node_auth_state "https://github.com/sabarees3578/thingzkit-cloud/blob/main/src/context/AuthContext.jsx"
click node_firebase "https://github.com/sabarees3578/thingzkit-cloud/blob/main/src/firebase.js"
click node_onboarding "https://github.com/sabarees3578/thingzkit-cloud/blob/main/src/pages/WelcomePage.jsx"
click node_widget_modal "https://github.com/sabarees3578/thingzkit-cloud/blob/main/src/components/modals/AddWidgetModal.jsx"
click node_editor "https://github.com/sabarees3578/thingzkit-cloud/blob/main/src/components/WebEditor.jsx"
click node_server "https://github.com/sabarees3578/thingzkit-cloud/blob/main/server.cjs"
click node_ota "https://github.com/sabarees3578/thingzkit-cloud/blob/main/ota/DEV-A2DD2A86/sketch/sketch.ino"
click node_deployment "https://github.com/sabarees3578/thingzkit-cloud/blob/main/.github/workflows/deploy.yml"
click node_arduino_sdk "https://github.com/sabarees3578/thingzkit-cloud/blob/main/arduino-library/EnthutechIoT/EnthutechIoT.cpp"
click node_device_examples "https://github.com/sabarees3578/thingzkit-cloud/blob/main/arduino-library/EnthutechIoT/examples/FullBidirectional/FullBidirectional.ino"

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_vite,node_main,node_app,node_layout,node_navigation,node_app_state,node_auth_state,node_views,node_onboarding,node_admin,node_provisioning,node_widget_modal,node_editor toneBlue
class node_firebase,node_server,node_ota,node_deployment toneAmber
class node_arduino_sdk,node_device_examples toneMint
```

## Components

### React dashboard

Browser control-plane application.

- [Vite build](https://github.com/sabarees3578/thingzkit-cloud/blob/main/vite.config.js): build tool · `vite.config.js`
- [Browser entry](https://github.com/sabarees3578/thingzkit-cloud/blob/main/src/main.jsx): React entry · `src/main.jsx`
- [Root app](https://github.com/sabarees3578/thingzkit-cloud/blob/main/src/App.jsx): application root · `src/App.jsx`
- [Dashboard shell](https://github.com/sabarees3578/thingzkit-cloud/blob/main/src/components/layout/DashboardLayout.jsx): layout · `src/components/layout/DashboardLayout.jsx`
- **Sidebar & topbar**: navigation controls
- [Domain state](https://github.com/sabarees3578/thingzkit-cloud/blob/main/src/context/AppContext.jsx): React context · `src/context/AppContext.jsx`
- [Auth state](https://github.com/sabarees3578/thingzkit-cloud/blob/main/src/context/AuthContext.jsx): React context · `src/context/AuthContext.jsx`
- **Operational views**: dashboard pages · Devices, dashboards, logs, analytics, alerts, and automations.
- [Welcome route](https://github.com/sabarees3578/thingzkit-cloud/blob/main/src/pages/WelcomePage.jsx): onboarding page · `src/pages/WelcomePage.jsx`
- **Settings & team**: administration pages
- **Provisioning modals**: device/project workflows · Creates devices and projects through modal flows.
- [Widget composer](https://github.com/sabarees3578/thingzkit-cloud/blob/main/src/components/modals/AddWidgetModal.jsx): dashboard workflow · `src/components/modals/AddWidgetModal.jsx`
- [Web editor](https://github.com/sabarees3578/thingzkit-cloud/blob/main/src/components/WebEditor.jsx): sketch editor · Cloud-side device setup and sketch authoring surface. · `src/components/WebEditor.jsx`

### Cloud & deployment

Backend boundary, OTA storage, and deployment.

- [Firebase](https://github.com/sabarees3578/thingzkit-cloud/blob/main/src/firebase.js): backend/auth boundary · Primary frontend integration boundary. · `src/firebase.js`
- [Server entry](https://github.com/sabarees3578/thingzkit-cloud/blob/main/server.cjs): server runtime · `server.cjs`
- [OTA sketches](https://github.com/sabarees3578/thingzkit-cloud/blob/main/ota/DEV-A2DD2A86/sketch/sketch.ino): firmware artifact store · Per-device deployable sketch sources. · `ota/DEV-A2DD2A86/sketch/sketch.ino`
- [Deployment pipeline](https://github.com/sabarees3578/thingzkit-cloud/blob/main/.github/workflows/deploy.yml): CI/container deployment · Builds and deploys the cloud runtime. · `.github/workflows/deploy.yml`

### Embedded integration

Arduino SDK and device firmware.

- [EnthutechIoT SDK](https://github.com/sabarees3578/thingzkit-cloud/blob/main/arduino-library/EnthutechIoT/EnthutechIoT.cpp): Arduino library · Reusable device-to-cloud client library. · `arduino-library/EnthutechIoT/EnthutechIoT.cpp`
- [Device examples](https://github.com/sabarees3578/thingzkit-cloud/blob/main/arduino-library/EnthutechIoT/examples/FullBidirectional/FullBidirectional.ino): Arduino sketches · Demonstrate telemetry publishing and bidirectional interaction. · `arduino-library/EnthutechIoT/examples/FullBidirectional/FullBidirectional.ino`

## Connections

- Vite build → Browser entry: builds
- Browser entry → Root app: renders
- Root app → Dashboard shell: hosts
- Dashboard shell → Sidebar & topbar: composes
- Dashboard shell → Operational views: routes to
- Dashboard shell → Welcome route: routes to
- Dashboard shell → Settings & team: routes to
- Root app → Domain state: uses
- Root app → Auth state: uses
- Auth state → Firebase: authenticates via
- Domain state → Firebase: integrates with
- Operational views → Provisioning modals: opens
- Operational views → Widget composer: composes dashboards with
- Provisioning modals → Web editor: can lead to
- Web editor → OTA sketches: authors
- Server entry → OTA sketches: serves managed
- Deployment pipeline → Server entry: deploys
- EnthutechIoT SDK → Firebase: exchanges cloud data with
- Device examples → EnthutechIoT SDK: uses
- OTA sketches → Device examples: device firmware pattern
