# theheetchaudhari/plantnexus architecture

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

- Interactive diagram: https://gitdiagram.com/theheetchaudhari/plantnexus
- Repository: https://github.com/theheetchaudhari/plantnexus

## Overview

PlantNexus monitors industrial machine telemetry and guides operators from observing readings through deterministic condition analysis, evidence-grounded explanation, and recovery verification. The simulator generates healthy, degraded, and recovery scenarios; the backend ingests and stores readings, serves analytics and analysis APIs, and verifies sustained improvement; the dashboard presents these capabilities. The graph includes the landing experience and major dashboard views. Backend-to-frontend and simulator-to-backend links follow the README; some internal route details were not sampled, so uncertain calls are omitted.

Main entry points: [`frontend/src/App.tsx`](https://github.com/theheetchaudhari/plantnexus/blob/main/frontend/src/App.tsx) (Dashboard application), [`backend/src/server.js`](https://github.com/theheetchaudhari/plantnexus/blob/main/backend/src/server.js) (API service), [`frontend/src/api/client.ts`](https://github.com/theheetchaudhari/plantnexus/blob/main/frontend/src/api/client.ts) (API client), [`simulator/main.py`](https://github.com/theheetchaudhari/plantnexus/blob/main/simulator/main.py) (Scenario simulator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_simulation["Telemetry simulation"]
  node_simulator["Scenario simulator<br/>[main.py]"]
  node_machine["Machine scenarios<br/>[machine.py]"]
  node_simconfig["Machine configuration<br/>[config.py]"]
end

subgraph group_service["Backend intelligence"]
  node_api["API service<br/>[server.js]"]
  node_store[("PlantNexus data<br/>[server.js]")]
  node_analytics["Telemetry analytics<br/>[analytics.js]"]
  node_detector["Anomaly detection<br/>[detector.js]"]
  node_explanation["Evidence explanation<br/>[explain.js]"]
  node_recovery["Recovery verification<br/>[recovery.js]"]
end

subgraph group_dashboard["Operator dashboard"]
  node_app["Dashboard application<br/>[App.tsx]"]
  node_router["Route state<br/>[router.ts]"]
  node_api_client["API client<br/>[client.ts]"]
  node_analysis_hook["Analysis state<br/>[useAnalysis.ts]"]
  node_recovery_hook["Recovery state"]
  node_overview["Operations overview"]
  node_trends["Telemetry trends"]
  node_analysis_view["Analysis and evidence"]
  node_condition["Condition badge<br/>[ConditionBadge.tsx]"]
  node_recovery_view["Recovery dashboard"]
end

subgraph group_presentation["Landing experience"]
  node_landing["Landing experience<br/>[LandingPage.tsx]"]
  node_preview["Dashboard preview"]
end

node_operator(("Plant operator"))
node_supabase[("Hosted Supabase")]

node_operator -->|"selects scenario"| node_simulator
node_simconfig -->|"configures"| node_machine
node_simulator -->|"runs cycles"| node_machine
node_simulator -->|"posts telemetry"| node_api
node_operator -->|"uses dashboard"| node_app
node_app -->|"reads routes"| node_router
node_app -->|"renders"| node_overview
node_app -->|"renders"| node_trends
node_app -->|"renders"| node_analysis_view
node_app -->|"renders"| node_recovery_view
node_app -->|"renders"| node_landing
node_landing -->|"renders"| node_preview
node_analysis_view -->|"uses state"| node_analysis_hook
node_analysis_view -->|"renders"| node_condition
node_recovery_view -->|"uses state"| node_recovery_hook
node_overview -->|"uses state"| node_analysis_hook
node_overview -->|"uses state"| node_recovery_hook
node_analysis_hook -->|"requests analysis"| node_api_client
node_recovery_hook -->|"requests verification"| node_api_client
node_trends -->|"fetches telemetry"| node_api_client
node_api_client -->|"calls API"| node_api
node_api -->|"reads and writes"| node_store
node_store -->|"persists records"| node_supabase
node_api -->|"computes summaries"| node_analytics
node_api -->|"detects anomalies"| node_detector
node_api -->|"grounds narrative"| node_explanation
node_api -->|"verifies recovery"| node_recovery
node_analytics -->|"provides baselines"| node_detector

click node_simulator "https://github.com/theheetchaudhari/plantnexus/blob/main/simulator/main.py"
click node_machine "https://github.com/theheetchaudhari/plantnexus/blob/main/simulator/machine.py"
click node_simconfig "https://github.com/theheetchaudhari/plantnexus/blob/main/simulator/config.py"
click node_api "https://github.com/theheetchaudhari/plantnexus/blob/main/backend/src/server.js"
click node_store "https://github.com/theheetchaudhari/plantnexus/blob/main/backend/src/server.js"
click node_analytics "https://github.com/theheetchaudhari/plantnexus/blob/main/backend/src/analytics.js"
click node_detector "https://github.com/theheetchaudhari/plantnexus/blob/main/backend/src/detector.js"
click node_explanation "https://github.com/theheetchaudhari/plantnexus/blob/main/backend/src/explain.js"
click node_recovery "https://github.com/theheetchaudhari/plantnexus/blob/main/backend/src/recovery.js"
click node_app "https://github.com/theheetchaudhari/plantnexus/blob/main/frontend/src/App.tsx"
click node_router "https://github.com/theheetchaudhari/plantnexus/blob/main/frontend/src/router.ts"
click node_api_client "https://github.com/theheetchaudhari/plantnexus/blob/main/frontend/src/api/client.ts"
click node_analysis_hook "https://github.com/theheetchaudhari/plantnexus/blob/main/frontend/src/hooks/useAnalysis.ts"
click node_recovery_hook "https://github.com/theheetchaudhari/plantnexus/blob/main/frontend/src/hooks/useRecoveryVerification.ts"
click node_overview "https://github.com/theheetchaudhari/plantnexus/blob/main/frontend/src/components/OverviewDashboard.tsx"
click node_trends "https://github.com/theheetchaudhari/plantnexus/blob/main/frontend/src/components/TelemetryTrends.tsx"
click node_analysis_view "https://github.com/theheetchaudhari/plantnexus/blob/main/frontend/src/components/AnalysisDashboard.tsx"
click node_condition "https://github.com/theheetchaudhari/plantnexus/blob/main/frontend/src/components/ConditionBadge.tsx"
click node_recovery_view "https://github.com/theheetchaudhari/plantnexus/blob/main/frontend/src/components/RecoveryDashboard.tsx"
click node_landing "https://github.com/theheetchaudhari/plantnexus/blob/main/frontend/src/components/LandingPage/LandingPage.tsx"
click node_preview "https://github.com/theheetchaudhari/plantnexus/blob/main/frontend/src/components/LandingPage/DashboardPreview.tsx"

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_simulator,node_machine,node_simconfig toneBlue
class node_api,node_store,node_analytics,node_detector,node_explanation,node_recovery,node_supabase toneAmber
class node_app,node_router,node_api_client,node_analysis_hook,node_recovery_hook,node_overview,node_trends,node_analysis_view,node_condition,node_recovery_view toneMint
class node_landing,node_preview toneRose
class node_operator toneIndigo
```

## Components

### Telemetry simulation

- [Scenario simulator](https://github.com/theheetchaudhari/plantnexus/blob/main/simulator/main.py): `simulator/main.py`
- [Machine scenarios](https://github.com/theheetchaudhari/plantnexus/blob/main/simulator/machine.py): `simulator/machine.py`
- [Machine configuration](https://github.com/theheetchaudhari/plantnexus/blob/main/simulator/config.py): `simulator/config.py`

### Backend intelligence

- [API service](https://github.com/theheetchaudhari/plantnexus/blob/main/backend/src/server.js): `backend/src/server.js`
- [PlantNexus data](https://github.com/theheetchaudhari/plantnexus/blob/main/backend/src/server.js): `backend/src/server.js`
- [Telemetry analytics](https://github.com/theheetchaudhari/plantnexus/blob/main/backend/src/analytics.js): `backend/src/analytics.js`
- [Anomaly detection](https://github.com/theheetchaudhari/plantnexus/blob/main/backend/src/detector.js): `backend/src/detector.js`
- [Evidence explanation](https://github.com/theheetchaudhari/plantnexus/blob/main/backend/src/explain.js): `backend/src/explain.js`
- [Recovery verification](https://github.com/theheetchaudhari/plantnexus/blob/main/backend/src/recovery.js): `backend/src/recovery.js`

### Operator dashboard

- [Dashboard application](https://github.com/theheetchaudhari/plantnexus/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Route state](https://github.com/theheetchaudhari/plantnexus/blob/main/frontend/src/router.ts): `frontend/src/router.ts`
- [API client](https://github.com/theheetchaudhari/plantnexus/blob/main/frontend/src/api/client.ts): `frontend/src/api/client.ts`
- [Analysis state](https://github.com/theheetchaudhari/plantnexus/blob/main/frontend/src/hooks/useAnalysis.ts): `frontend/src/hooks/useAnalysis.ts`
- [Recovery state](https://github.com/theheetchaudhari/plantnexus/blob/main/frontend/src/hooks/useRecoveryVerification.ts): `frontend/src/hooks/useRecoveryVerification.ts`
- [Operations overview](https://github.com/theheetchaudhari/plantnexus/blob/main/frontend/src/components/OverviewDashboard.tsx): `frontend/src/components/OverviewDashboard.tsx`
- [Telemetry trends](https://github.com/theheetchaudhari/plantnexus/blob/main/frontend/src/components/TelemetryTrends.tsx): `frontend/src/components/TelemetryTrends.tsx`
- [Analysis and evidence](https://github.com/theheetchaudhari/plantnexus/blob/main/frontend/src/components/AnalysisDashboard.tsx): `frontend/src/components/AnalysisDashboard.tsx`
- [Condition badge](https://github.com/theheetchaudhari/plantnexus/blob/main/frontend/src/components/ConditionBadge.tsx): `frontend/src/components/ConditionBadge.tsx`
- [Recovery dashboard](https://github.com/theheetchaudhari/plantnexus/blob/main/frontend/src/components/RecoveryDashboard.tsx): `frontend/src/components/RecoveryDashboard.tsx`

### Landing experience

- [Landing experience](https://github.com/theheetchaudhari/plantnexus/blob/main/frontend/src/components/LandingPage/LandingPage.tsx): `frontend/src/components/LandingPage/LandingPage.tsx`
- [Dashboard preview](https://github.com/theheetchaudhari/plantnexus/blob/main/frontend/src/components/LandingPage/DashboardPreview.tsx): `frontend/src/components/LandingPage/DashboardPreview.tsx`

### Other components

- **Plant operator**
- **Hosted Supabase**

## Connections

- Plant operator → Scenario simulator: selects scenario
- Machine configuration → Machine scenarios: configures (evidence: `simulator/main.py`)
- Scenario simulator → Machine scenarios: runs cycles (evidence: `simulator/main.py`)
- Scenario simulator → API service: posts telemetry
- Plant operator → Dashboard application: uses dashboard
- Dashboard application → Route state: reads routes (evidence: `frontend/src/App.tsx`)
- Dashboard application → Operations overview: renders (evidence: `frontend/src/App.tsx`)
- Dashboard application → Telemetry trends: renders (evidence: `frontend/src/App.tsx`)
- Dashboard application → Analysis and evidence: renders (evidence: `frontend/src/App.tsx`)
- Dashboard application → Recovery dashboard: renders (evidence: `frontend/src/App.tsx`)
- Dashboard application → Landing experience: renders (evidence: `frontend/src/App.tsx`)
- Landing experience → Dashboard preview: renders (evidence: `frontend/src/components/LandingPage/LandingPage.tsx`)
- Analysis and evidence → Analysis state: uses state (evidence: `frontend/src/components/AnalysisDashboard.tsx`)
- Analysis and evidence → Condition badge: renders (evidence: `frontend/src/components/AnalysisDashboard.tsx`)
- Recovery dashboard → Recovery state: uses state (evidence: `frontend/src/components/RecoveryDashboard.tsx`)
- Operations overview → Analysis state: uses state (evidence: `frontend/src/App.tsx`)
- Operations overview → Recovery state: uses state (evidence: `frontend/src/App.tsx`)
- Analysis state → API client: requests analysis (evidence: `frontend/src/hooks/useAnalysis.ts`)
- Recovery state → API client: requests verification (evidence: `frontend/src/hooks/useRecoveryVerification.ts`)
- Telemetry trends → API client: fetches telemetry
- API client → API service: calls API
- API service → PlantNexus data: reads and writes (evidence: `backend/src/server.js`)
- PlantNexus data → Hosted Supabase: persists records
- API service → Telemetry analytics: computes summaries (evidence: `backend/src/server.js`)
- API service → Anomaly detection: detects anomalies (evidence: `backend/src/server.js`)
- API service → Evidence explanation: grounds narrative (evidence: `backend/src/server.js`)
- API service → Recovery verification: verifies recovery (evidence: `backend/src/server.js`)
- Telemetry analytics → Anomaly detection: provides baselines (evidence: `backend/src/detector.js`)
