# deekshith-spl/coldtwin architecture

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

- Interactive diagram: https://gitdiagram.com/deekshith-spl/coldtwin
- Repository: https://github.com/deekshith-spl/coldtwin

## Overview

ColdTwin is a browser-based cold-store decision-support prototype: staff enter or upload readings and lot records, the app stores them locally, and owners use dashboard, lot, and report views to decide what to sell first and what chamber to inspect. Digital Twin adds expected-temperature comparisons and fault simulation. The README documents energy estimates, multilingual labels, and assumptions transparency. Edges reflect shown imports/calls or README claims; unsampled page internals are not inferred.

Main entry points: [`src/App.tsx`](https://github.com/deekshith-spl/coldtwin/blob/main/src/App.tsx) (Routes and shell), [`src/pages/Dashboard.tsx`](https://github.com/deekshith-spl/coldtwin/blob/main/src/pages/Dashboard.tsx) (Dashboard), [`src/store/useStore.ts`](https://github.com/deekshith-spl/coldtwin/blob/main/src/store/useStore.ts) (Persisted app state), [`src/pages/DigitalTwin.tsx`](https://github.com/deekshith-spl/coldtwin/blob/main/src/pages/DigitalTwin.tsx) (Digital Twin)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["App experience"]
  node_app["Routes and shell<br/>[App.tsx]"]
  node_dashboard["Dashboard<br/>[Dashboard.tsx]"]
  node_digital_twin["Digital Twin<br/>[DigitalTwin.tsx]"]
  node_lots["Lots<br/>[Lots.tsx]"]
  node_reports["Reports<br/>[Reports.tsx]"]
  node_settings["Settings<br/>[Settings.tsx]"]
  node_assumptions["Assumptions<br/>[Assumptions.tsx]"]
end

subgraph group_data["Data and state"]
  node_input["Data input<br/>[DataInput.tsx]"]
  node_store[("Persisted app state<br/>[useStore.ts]")]
  node_demo["Demo records<br/>[demoData.ts]"]
end

subgraph group_models["Twin and models"]
  node_thermal["Thermal twin<br/>[thermalTwin.ts]"]
  node_fault["Fault detection<br/>[faultDetection.ts]"]
  node_baseline["Learned baseline<br/>[learnedBaseline.ts]"]
  node_shelf["Shelf-life estimates<br/>[shelfLife.ts]"]
  node_ranking["Lot ranking<br/>[ranking.ts]"]
  node_energy["Energy waste<br/>[energyWaste.ts]"]
end

subgraph group_decisions["Operational decisions"]
  node_sell_card["Sell First card<br/>[SellFirstCard.tsx]"]
  node_fix_card["Fix Before Breaks card"]
  node_energy_card["Energy waste card"]
end

subgraph group_shared["Shared interface"]
  node_i18n["English Telugu Hindi"]
  node_risk_gauge["Risk gauge<br/>[RiskGauge.tsx]"]
  node_urgency["Urgency chip<br/>[UrgencyChip.tsx]"]
  node_shelf_chart["Shelf-life chart<br/>[ShelfLifeChart.tsx]"]
end

node_user(("Store staff"))

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_input
node_app -->|"routes to"| node_digital_twin
node_app -->|"routes to"| node_lots
node_app -->|"routes to"| node_reports
node_app -->|"routes to"| node_settings
node_app -->|"routes to"| node_assumptions
node_app -->|"reads language"| node_store
node_app -->|"provides strings"| node_i18n
node_input -->|"updates records"| node_store
node_store -->|"loads demo data"| node_demo
node_store -->|"injects simulation"| node_fault
node_dashboard -->|"reads state"| node_store
node_dashboard -->|"computes temperatures"| node_thermal
node_dashboard -->|"computes risk"| node_fault
node_dashboard -->|"ranks lots"| node_ranking
node_dashboard -->|"estimates waste"| node_energy
node_dashboard -->|"renders"| node_sell_card
node_dashboard -->|"renders"| node_fix_card
node_dashboard -->|"renders"| node_energy_card
node_digital_twin -->|"simulates fault"| node_store
node_digital_twin -->|"predicts temperature"| node_thermal
node_digital_twin -->|"computes risk"| node_fault
node_digital_twin -->|"uses baseline"| node_baseline
node_fault -->|"scores anomaly"| node_baseline
node_lots -->|"ranks lots"| node_ranking
node_lots -->|"estimates freshness"| node_shelf
node_lots -->|"renders curve"| node_shelf_chart
node_reports -->|"ranks lots"| node_ranking
node_reports -->|"computes risk"| node_fault
node_reports -->|"predicts temperature"| node_thermal
node_reports -->|"renders urgency"| node_urgency
node_fix_card -->|"renders gauge"| node_risk_gauge
node_sell_card -->|"renders urgency"| node_urgency
node_ranking -->|"estimates shelf life"| node_shelf

click node_app "https://github.com/deekshith-spl/coldtwin/blob/main/src/App.tsx"
click node_dashboard "https://github.com/deekshith-spl/coldtwin/blob/main/src/pages/Dashboard.tsx"
click node_digital_twin "https://github.com/deekshith-spl/coldtwin/blob/main/src/pages/DigitalTwin.tsx"
click node_lots "https://github.com/deekshith-spl/coldtwin/blob/main/src/pages/Lots.tsx"
click node_reports "https://github.com/deekshith-spl/coldtwin/blob/main/src/pages/Reports.tsx"
click node_settings "https://github.com/deekshith-spl/coldtwin/blob/main/src/pages/Settings.tsx"
click node_assumptions "https://github.com/deekshith-spl/coldtwin/blob/main/src/pages/Assumptions.tsx"
click node_input "https://github.com/deekshith-spl/coldtwin/blob/main/src/pages/DataInput.tsx"
click node_store "https://github.com/deekshith-spl/coldtwin/blob/main/src/store/useStore.ts"
click node_demo "https://github.com/deekshith-spl/coldtwin/blob/main/src/engine/demoData.ts"
click node_thermal "https://github.com/deekshith-spl/coldtwin/blob/main/src/engine/thermalTwin.ts"
click node_fault "https://github.com/deekshith-spl/coldtwin/blob/main/src/engine/faultDetection.ts"
click node_baseline "https://github.com/deekshith-spl/coldtwin/blob/main/src/engine/learnedBaseline.ts"
click node_shelf "https://github.com/deekshith-spl/coldtwin/blob/main/src/engine/shelfLife.ts"
click node_ranking "https://github.com/deekshith-spl/coldtwin/blob/main/src/engine/ranking.ts"
click node_energy "https://github.com/deekshith-spl/coldtwin/blob/main/src/engine/energyWaste.ts"
click node_sell_card "https://github.com/deekshith-spl/coldtwin/blob/main/src/components/dashboard/SellFirstCard.tsx"
click node_fix_card "https://github.com/deekshith-spl/coldtwin/blob/main/src/components/dashboard/FixBeforeBreaksCard.tsx"
click node_energy_card "https://github.com/deekshith-spl/coldtwin/blob/main/src/components/dashboard/EnergyWasteCard.tsx"
click node_i18n "https://github.com/deekshith-spl/coldtwin/tree/main/src/i18n"
click node_risk_gauge "https://github.com/deekshith-spl/coldtwin/blob/main/src/components/ui/RiskGauge.tsx"
click node_urgency "https://github.com/deekshith-spl/coldtwin/blob/main/src/components/ui/UrgencyChip.tsx"
click node_shelf_chart "https://github.com/deekshith-spl/coldtwin/blob/main/src/components/ui/ShelfLifeChart.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_app,node_dashboard,node_digital_twin,node_lots,node_reports,node_settings,node_assumptions toneBlue
class node_input,node_store,node_demo toneAmber
class node_thermal,node_fault,node_baseline,node_shelf,node_ranking,node_energy toneMint
class node_sell_card,node_fix_card,node_energy_card toneRose
class node_i18n,node_risk_gauge,node_urgency,node_shelf_chart,node_user toneIndigo
```

## Components

### App experience

- [Routes and shell](https://github.com/deekshith-spl/coldtwin/blob/main/src/App.tsx): `src/App.tsx`
- [Dashboard](https://github.com/deekshith-spl/coldtwin/blob/main/src/pages/Dashboard.tsx): `src/pages/Dashboard.tsx`
- [Digital Twin](https://github.com/deekshith-spl/coldtwin/blob/main/src/pages/DigitalTwin.tsx): `src/pages/DigitalTwin.tsx`
- [Lots](https://github.com/deekshith-spl/coldtwin/blob/main/src/pages/Lots.tsx): `src/pages/Lots.tsx`
- [Reports](https://github.com/deekshith-spl/coldtwin/blob/main/src/pages/Reports.tsx): `src/pages/Reports.tsx`
- [Settings](https://github.com/deekshith-spl/coldtwin/blob/main/src/pages/Settings.tsx): `src/pages/Settings.tsx`
- [Assumptions](https://github.com/deekshith-spl/coldtwin/blob/main/src/pages/Assumptions.tsx): `src/pages/Assumptions.tsx`

### Data and state

- [Data input](https://github.com/deekshith-spl/coldtwin/blob/main/src/pages/DataInput.tsx): `src/pages/DataInput.tsx`
- [Persisted app state](https://github.com/deekshith-spl/coldtwin/blob/main/src/store/useStore.ts): `src/store/useStore.ts`
- [Demo records](https://github.com/deekshith-spl/coldtwin/blob/main/src/engine/demoData.ts): `src/engine/demoData.ts`

### Twin and models

- [Thermal twin](https://github.com/deekshith-spl/coldtwin/blob/main/src/engine/thermalTwin.ts): `src/engine/thermalTwin.ts`
- [Fault detection](https://github.com/deekshith-spl/coldtwin/blob/main/src/engine/faultDetection.ts): `src/engine/faultDetection.ts`
- [Learned baseline](https://github.com/deekshith-spl/coldtwin/blob/main/src/engine/learnedBaseline.ts): `src/engine/learnedBaseline.ts`
- [Shelf-life estimates](https://github.com/deekshith-spl/coldtwin/blob/main/src/engine/shelfLife.ts): `src/engine/shelfLife.ts`
- [Lot ranking](https://github.com/deekshith-spl/coldtwin/blob/main/src/engine/ranking.ts): `src/engine/ranking.ts`
- [Energy waste](https://github.com/deekshith-spl/coldtwin/blob/main/src/engine/energyWaste.ts): `src/engine/energyWaste.ts`

### Operational decisions

- [Sell First card](https://github.com/deekshith-spl/coldtwin/blob/main/src/components/dashboard/SellFirstCard.tsx): `src/components/dashboard/SellFirstCard.tsx`
- [Fix Before Breaks card](https://github.com/deekshith-spl/coldtwin/blob/main/src/components/dashboard/FixBeforeBreaksCard.tsx): `src/components/dashboard/FixBeforeBreaksCard.tsx`
- [Energy waste card](https://github.com/deekshith-spl/coldtwin/blob/main/src/components/dashboard/EnergyWasteCard.tsx): `src/components/dashboard/EnergyWasteCard.tsx`

### Shared interface

- [English Telugu Hindi](https://github.com/deekshith-spl/coldtwin/tree/main/src/i18n): `src/i18n`
- [Risk gauge](https://github.com/deekshith-spl/coldtwin/blob/main/src/components/ui/RiskGauge.tsx): `src/components/ui/RiskGauge.tsx`
- [Urgency chip](https://github.com/deekshith-spl/coldtwin/blob/main/src/components/ui/UrgencyChip.tsx): `src/components/ui/UrgencyChip.tsx`
- [Shelf-life chart](https://github.com/deekshith-spl/coldtwin/blob/main/src/components/ui/ShelfLifeChart.tsx): `src/components/ui/ShelfLifeChart.tsx`

### Other components

- **Store staff**

## Connections

- Store staff → Routes and shell: uses (evidence: `README.md`)
- Routes and shell → Dashboard: routes to (evidence: `src/App.tsx`)
- Routes and shell → Data input: routes to (evidence: `src/App.tsx`)
- Routes and shell → Digital Twin: routes to (evidence: `src/App.tsx`)
- Routes and shell → Lots: routes to (evidence: `src/App.tsx`)
- Routes and shell → Reports: routes to (evidence: `src/App.tsx`)
- Routes and shell → Settings: routes to (evidence: `src/App.tsx`)
- Routes and shell → Assumptions: routes to (evidence: `src/App.tsx`)
- Routes and shell → Persisted app state: reads language (evidence: `src/App.tsx`)
- Routes and shell → English Telugu Hindi: provides strings (evidence: `src/App.tsx`)
- Data input → Persisted app state: updates records (evidence: `src/pages/DataInput.tsx`)
- Persisted app state → Demo records: loads demo data (evidence: `src/store/useStore.ts`)
- Persisted app state → Fault detection: injects simulation (evidence: `src/store/useStore.ts`)
- Dashboard → Persisted app state: reads state (evidence: `src/pages/Dashboard.tsx`)
- Dashboard → Thermal twin: computes temperatures (evidence: `src/pages/Dashboard.tsx`)
- Dashboard → Fault detection: computes risk (evidence: `src/pages/Dashboard.tsx`)
- Dashboard → Lot ranking: ranks lots (evidence: `src/pages/Dashboard.tsx`)
- Dashboard → Energy waste: estimates waste (evidence: `src/pages/Dashboard.tsx`)
- Dashboard → Sell First card: renders (evidence: `src/pages/Dashboard.tsx`)
- Dashboard → Fix Before Breaks card: renders (evidence: `src/pages/Dashboard.tsx`)
- Dashboard → Energy waste card: renders (evidence: `src/pages/Dashboard.tsx`)
- Digital Twin → Persisted app state: simulates fault (evidence: `src/pages/DigitalTwin.tsx`)
- Digital Twin → Thermal twin: predicts temperature (evidence: `src/pages/DigitalTwin.tsx`)
- Digital Twin → Fault detection: computes risk (evidence: `src/pages/DigitalTwin.tsx`)
- Digital Twin → Learned baseline: uses baseline (evidence: `src/pages/DigitalTwin.tsx`)
- Fault detection → Learned baseline: scores anomaly (evidence: `src/engine/faultDetection.ts`)
- Lots → Lot ranking: ranks lots (evidence: `src/pages/Lots.tsx`)
- Lots → Shelf-life estimates: estimates freshness (evidence: `src/pages/Lots.tsx`)
- Lots → Shelf-life chart: renders curve (evidence: `src/pages/Lots.tsx`)
- Reports → Lot ranking: ranks lots (evidence: `src/pages/Reports.tsx`)
- Reports → Fault detection: computes risk (evidence: `src/pages/Reports.tsx`)
- Reports → Thermal twin: predicts temperature (evidence: `src/pages/Reports.tsx`)
- Reports → Urgency chip: renders urgency (evidence: `src/pages/Reports.tsx`)
- Fix Before Breaks card → Risk gauge: renders gauge (evidence: `src/components/dashboard/FixBeforeBreaksCard.tsx`)
- Sell First card → Urgency chip: renders urgency (evidence: `src/components/dashboard/SellFirstCard.tsx`)
- Lot ranking → Shelf-life estimates: estimates shelf life (evidence: `src/engine/ranking.ts`)
