# kaz0342/ta architecture

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

- Interactive diagram: https://gitdiagram.com/kaz0342/ta
- Repository: https://github.com/kaz0342/ta

## Overview

Smart Shroom SCM manages baglog inventory and spatial rack allocation through harvest, sales, and dynamic HPP accounting, while monitoring and automating kumbung climate. The React SPA is the user entry point; its Laravel API handles business operations and persists domain records, and the IoT simulator is a separate edge-behavior model. The README documents key capabilities, but several controller/service implementations and all firmware source are absent from the supplied tree, so uncertain connections are omitted or marked unverified.

Main entry points: [`backend/routes/api.php`](https://github.com/kaz0342/ta/blob/main/backend/routes/api.php) (API routing), [`frontend/src/App.tsx`](https://github.com/kaz0342/ta/blob/main/frontend/src/App.tsx) (React application), [`frontend/src/services/api.ts`](https://github.com/kaz0342/ta/blob/main/frontend/src/services/api.ts) (API client), [`backend/app/Http/Controllers/Api/SensorDataController.php`](https://github.com/kaz0342/ta/blob/main/backend/app/Http/Controllers/Api/SensorDataController.php) (Climate and device API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["User application"]
  node_spa["React application<br/>[App.tsx]"]
  node_dashboard["Live dashboard<br/>[Dashboard.tsx]"]
  node_baglog_ui["Baglog management"]
  node_grid_ui["Rack grid and harvest map<br/>[KumbungGrid.tsx]"]
  node_harvest_ui["Harvest management"]
  node_sales_ui["Sales management"]
  node_settings_ui["Climate settings<br/>[Settings.tsx]"]
  node_http_client["API client<br/>[api.ts]"]
end

subgraph group_inventory["Cultivation operations"]
  node_api_routes["API routing<br/>[api.php]"]
  node_batch_logic["Baglog lifecycle<br/>[BaglogService.php]"]
  node_rack_allocation["Rack allocation"]
  node_rack_map["Spatial rack data<br/>[SlotController.php]"]
  node_cull_ledger["Cull ledger"]
end

subgraph group_climate["Climate monitoring"]
  node_climate_api["Climate and device API"]
  node_climate_history["Sensor history queries"]
  node_thresholds["Climate thresholds"]
  node_simulator["IoT simulator<br/>[iot_simulator.py]"]
end

subgraph group_supply["Harvest and supply chain"]
  node_harvest_logic["Harvest records<br/>[HarvestService.php]"]
  node_sales_logic["Sales and HPP<br/>[SaleService.php]"]
  node_dashboard_logic["Dashboard aggregation"]
  node_domain_store[("Operational records<br/>[BaglogBatch.php]")]
end

node_farmer(("Admin or worker"))

node_farmer -->|"uses"| node_spa
node_spa -->|"routes to"| node_dashboard
node_spa -->|"routes to"| node_baglog_ui
node_spa -->|"routes to"| node_grid_ui
node_spa -->|"routes to"| node_harvest_ui
node_spa -->|"routes to"| node_sales_ui
node_spa -->|"routes to"| node_settings_ui
node_dashboard -.->|"requests data"| node_http_client
node_baglog_ui -.->|"requests data"| node_http_client
node_grid_ui -.->|"requests data"| node_http_client
node_harvest_ui -.->|"requests data"| node_http_client
node_sales_ui -.->|"requests data"| node_http_client
node_settings_ui -.->|"requests data"| node_http_client
node_http_client -.->|"calls API"| node_api_routes
node_api_routes -->|"routes requests"| node_batch_logic
node_api_routes -->|"routes requests"| node_rack_allocation
node_api_routes -->|"routes requests"| node_rack_map
node_api_routes -->|"routes requests"| node_cull_ledger
node_api_routes -->|"routes requests"| node_climate_api
node_api_routes -->|"routes requests"| node_harvest_logic
node_api_routes -->|"routes requests"| node_sales_logic
node_api_routes -->|"routes requests"| node_dashboard_logic
node_climate_api -.->|"queries readings"| node_climate_history
node_climate_api -.->|"uses limits"| node_thresholds
node_simulator -.->|"submits readings"| node_climate_api
node_rack_map -.->|"reads records"| node_domain_store
node_harvest_logic -.->|"records harvest"| node_domain_store
node_sales_logic -.->|"calculates HPP"| node_domain_store

click node_spa "https://github.com/kaz0342/ta/blob/main/frontend/src/App.tsx"
click node_dashboard "https://github.com/kaz0342/ta/blob/main/frontend/src/pages/Dashboard.tsx"
click node_baglog_ui "https://github.com/kaz0342/ta/blob/main/frontend/src/pages/BaglogManagement.tsx"
click node_grid_ui "https://github.com/kaz0342/ta/blob/main/frontend/src/pages/KumbungGrid.tsx"
click node_harvest_ui "https://github.com/kaz0342/ta/blob/main/frontend/src/pages/HarvestManagement.tsx"
click node_sales_ui "https://github.com/kaz0342/ta/blob/main/frontend/src/pages/SalesManagement.tsx"
click node_settings_ui "https://github.com/kaz0342/ta/blob/main/frontend/src/pages/Settings.tsx"
click node_http_client "https://github.com/kaz0342/ta/blob/main/frontend/src/services/api.ts"
click node_api_routes "https://github.com/kaz0342/ta/blob/main/backend/routes/api.php"
click node_batch_logic "https://github.com/kaz0342/ta/blob/main/backend/app/Services/BaglogService.php"
click node_rack_allocation "https://github.com/kaz0342/ta/blob/main/backend/app/Http/Controllers/Api/BatchSlotAssignmentController.php"
click node_rack_map "https://github.com/kaz0342/ta/blob/main/backend/app/Http/Controllers/Api/SlotController.php"
click node_cull_ledger "https://github.com/kaz0342/ta/blob/main/backend/app/Http/Controllers/Api/BaglogCullController.php"
click node_climate_api "https://github.com/kaz0342/ta/blob/main/backend/app/Http/Controllers/Api/SensorDataController.php"
click node_climate_history "https://github.com/kaz0342/ta/blob/main/backend/app/Repositories/SensorDataRepository.php"
click node_thresholds "https://github.com/kaz0342/ta/blob/main/backend/app/Models/ThresholdSetting.php"
click node_simulator "https://github.com/kaz0342/ta/blob/main/iot_simulator.py"
click node_harvest_logic "https://github.com/kaz0342/ta/blob/main/backend/app/Services/HarvestService.php"
click node_sales_logic "https://github.com/kaz0342/ta/blob/main/backend/app/Services/SaleService.php"
click node_dashboard_logic "https://github.com/kaz0342/ta/blob/main/backend/app/Services/DashboardService.php"
click node_domain_store "https://github.com/kaz0342/ta/blob/main/backend/app/Models/BaglogBatch.php"

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_spa,node_dashboard,node_baglog_ui,node_grid_ui,node_harvest_ui,node_sales_ui,node_settings_ui,node_http_client toneBlue
class node_api_routes,node_batch_logic,node_rack_allocation,node_rack_map,node_cull_ledger toneAmber
class node_climate_api,node_climate_history,node_thresholds,node_simulator toneMint
class node_harvest_logic,node_sales_logic,node_dashboard_logic,node_domain_store,node_farmer toneRose
```

## Components

### User application

- [React application](https://github.com/kaz0342/ta/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Live dashboard](https://github.com/kaz0342/ta/blob/main/frontend/src/pages/Dashboard.tsx): `frontend/src/pages/Dashboard.tsx`
- [Baglog management](https://github.com/kaz0342/ta/blob/main/frontend/src/pages/BaglogManagement.tsx): `frontend/src/pages/BaglogManagement.tsx`
- [Rack grid and harvest map](https://github.com/kaz0342/ta/blob/main/frontend/src/pages/KumbungGrid.tsx): `frontend/src/pages/KumbungGrid.tsx`
- [Harvest management](https://github.com/kaz0342/ta/blob/main/frontend/src/pages/HarvestManagement.tsx): `frontend/src/pages/HarvestManagement.tsx`
- [Sales management](https://github.com/kaz0342/ta/blob/main/frontend/src/pages/SalesManagement.tsx): `frontend/src/pages/SalesManagement.tsx`
- [Climate settings](https://github.com/kaz0342/ta/blob/main/frontend/src/pages/Settings.tsx): `frontend/src/pages/Settings.tsx`
- [API client](https://github.com/kaz0342/ta/blob/main/frontend/src/services/api.ts): `frontend/src/services/api.ts`

### Cultivation operations

- [API routing](https://github.com/kaz0342/ta/blob/main/backend/routes/api.php): `backend/routes/api.php`
- [Baglog lifecycle](https://github.com/kaz0342/ta/blob/main/backend/app/Services/BaglogService.php): `backend/app/Services/BaglogService.php`
- [Rack allocation](https://github.com/kaz0342/ta/blob/main/backend/app/Http/Controllers/Api/BatchSlotAssignmentController.php): `backend/app/Http/Controllers/Api/BatchSlotAssignmentController.php`
- [Spatial rack data](https://github.com/kaz0342/ta/blob/main/backend/app/Http/Controllers/Api/SlotController.php): `backend/app/Http/Controllers/Api/SlotController.php`
- [Cull ledger](https://github.com/kaz0342/ta/blob/main/backend/app/Http/Controllers/Api/BaglogCullController.php): `backend/app/Http/Controllers/Api/BaglogCullController.php`

### Climate monitoring

- [Climate and device API](https://github.com/kaz0342/ta/blob/main/backend/app/Http/Controllers/Api/SensorDataController.php): `backend/app/Http/Controllers/Api/SensorDataController.php`
- [Sensor history queries](https://github.com/kaz0342/ta/blob/main/backend/app/Repositories/SensorDataRepository.php): `backend/app/Repositories/SensorDataRepository.php`
- [Climate thresholds](https://github.com/kaz0342/ta/blob/main/backend/app/Models/ThresholdSetting.php): `backend/app/Models/ThresholdSetting.php`
- [IoT simulator](https://github.com/kaz0342/ta/blob/main/iot_simulator.py): `iot_simulator.py`

### Harvest and supply chain

- [Harvest records](https://github.com/kaz0342/ta/blob/main/backend/app/Services/HarvestService.php): `backend/app/Services/HarvestService.php`
- [Sales and HPP](https://github.com/kaz0342/ta/blob/main/backend/app/Services/SaleService.php): `backend/app/Services/SaleService.php`
- [Dashboard aggregation](https://github.com/kaz0342/ta/blob/main/backend/app/Services/DashboardService.php): `backend/app/Services/DashboardService.php`
- [Operational records](https://github.com/kaz0342/ta/blob/main/backend/app/Models/BaglogBatch.php): `backend/app/Models/BaglogBatch.php`

### Other components

- **Admin or worker**

## Connections

- Admin or worker → React application: uses
- React application → Live dashboard: routes to (evidence: `frontend/src/App.tsx`)
- React application → Baglog management: routes to (evidence: `frontend/src/App.tsx`)
- React application → Rack grid and harvest map: routes to (evidence: `frontend/src/App.tsx`)
- React application → Harvest management: routes to (evidence: `frontend/src/App.tsx`)
- React application → Sales management: routes to (evidence: `frontend/src/App.tsx`)
- React application → Climate settings: routes to (evidence: `frontend/src/App.tsx`)
- Live dashboard → API client: requests data
- Baglog management → API client: requests data
- Rack grid and harvest map → API client: requests data
- Harvest management → API client: requests data
- Sales management → API client: requests data
- Climate settings → API client: requests data
- API client → API routing: calls API
- API routing → Baglog lifecycle: routes requests (evidence: `backend/routes/api.php`)
- API routing → Rack allocation: routes requests (evidence: `backend/routes/api.php`)
- API routing → Spatial rack data: routes requests (evidence: `backend/routes/api.php`)
- API routing → Cull ledger: routes requests (evidence: `backend/routes/api.php`)
- API routing → Climate and device API: routes requests (evidence: `backend/routes/api.php`)
- API routing → Harvest records: routes requests (evidence: `backend/routes/api.php`)
- API routing → Sales and HPP: routes requests (evidence: `backend/routes/api.php`)
- API routing → Dashboard aggregation: routes requests (evidence: `backend/routes/api.php`)
- Climate and device API → Sensor history queries: queries readings
- Climate and device API → Climate thresholds: uses limits
- IoT simulator → Climate and device API: submits readings
- Spatial rack data → Operational records: reads records
- Harvest records → Operational records: records harvest (evidence: `backend/app/Services/HarvestService.php`)
- Sales and HPP → Operational records: calculates HPP
