# prahalcoder/honeychain architecture

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

- Interactive diagram: https://gitdiagram.com/prahalcoder/honeychain
- Repository: https://github.com/prahalcoder/honeychain

## Overview

Honey Chain combines beekeeper and trader operations, KVIC oversight, hive monitoring, and public honey verification. The main traceability workflow records organization and harvest activity through the Keeper-facing API, persists business data, and exposes batch or jar verification to consumers. Admin provides jurisdictional approvals and inspections; trade and public purchasing are related product branches. The excerpts establish server startup, route mounting, database setup, and the IoT monitor’s telemetry and camera responsibilities; other subsystem links rely on README descriptions and are kept high-level.

Main entry points: [`APICtech/backend/src/server.js`](https://github.com/prahalcoder/honeychain/blob/main/APICtech/backend/src/server.js) (Express API), [`APICtech/beehive/python_app/app.py`](https://github.com/prahalcoder/honeychain/blob/main/APICtech/beehive/python_app/app.py) (Hive monitor API), [`APICtech/frontend/src/App.jsx`](https://github.com/prahalcoder/honeychain/blob/main/APICtech/frontend/src/App.jsx) (Keeper app), [`apictech-admin/src/App.jsx`](https://github.com/prahalcoder/honeychain/blob/main/apictech-admin/src/App.jsx) (KVIC Admin)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workspaces["User workspaces"]
  node_keeper["Keeper app<br/>[App.jsx]"]
  node_officer["KVIC Admin<br/>[App.jsx]"]
  node_market["Keeper trade workspace<br/>[Market.jsx]"]
end

subgraph group_api["API and domain"]
  node_api_server["Express API<br/>[server.js]"]
  node_auth["Authentication<br/>[auth.js]"]
  node_org_routes["Organization routes<br/>[org.js]"]
  node_trace_routes["Traceability routes<br/>[traceability.js]"]
  node_admin_routes["Admin routes<br/>[admin.js]"]
  node_trade_routes["Trade routes<br/>[trade.js]"]
  node_shop_routes["Shop routes<br/>[shop.js]"]
  node_verification["QR verification<br/>[traceability.js]"]
end

subgraph group_records["Records and ledger"]
  node_database[("Common and company data<br/>[database.js]")]
  node_chain_service["Blockchain ledger<br/>[blockchain.js]"]
  node_ipfs["Pinned documents<br/>[ipfs.js]"]
end

subgraph group_monitoring["Hive monitoring"]
  node_iot_service["Hive monitor API<br/>[app.py]"]
  node_telemetry_db[("Telemetry logs<br/>[database.py]")]
  node_camera["Camera capture<br/>[camera_manager.py]"]
  node_hive_insights["Hive health insights<br/>[insights.py]"]
end

subgraph group_public["Public access"]
  node_public_site["Public website<br/>[App.jsx]"]
  node_verify_panel["Verification panel<br/>[Verify.jsx]"]
end

node_beekeeper(("Beekeeper"))
node_kvic(("KVIC officer"))
node_esp32["ESP32 hive sensors"]
node_public_consumer(("Honey buyer"))

node_beekeeper -->|"uses"| node_keeper
node_kvic -->|"uses"| node_officer
node_keeper -->|"API requests"| node_api_server
node_officer -->|"API requests"| node_api_server
node_api_server -->|"mounts routes"| node_auth
node_api_server -->|"mounts routes"| node_org_routes
node_api_server -->|"mounts routes"| node_trace_routes
node_api_server -->|"mounts routes"| node_admin_routes
node_api_server -->|"mounts routes"| node_trade_routes
node_api_server -->|"mounts routes"| node_shop_routes
node_api_server -->|"initializes"| node_database
node_api_server -->|"starts chain"| node_chain_service
node_api_server -->|"seals pending block"| node_chain_service
node_keeper -->|"opens trade"| node_market
node_market -->|"API requests"| node_api_server
node_public_consumer -->|"visits or scans QR"| node_public_site
node_public_site -->|"renders verification"| node_verify_panel
node_verify_panel -->|"verification request"| node_api_server
node_verification -->|"reads registry"| node_database
node_esp32 -->|"sends readings"| node_iot_service
node_iot_service -->|"stores readings"| node_telemetry_db
node_iot_service -->|"controls capture"| node_camera
node_iot_service -->|"reads recent logs"| node_telemetry_db
node_iot_service -->|"analyzes readings"| node_hive_insights

click node_keeper "https://github.com/prahalcoder/honeychain/blob/main/APICtech/frontend/src/App.jsx"
click node_officer "https://github.com/prahalcoder/honeychain/blob/main/apictech-admin/src/App.jsx"
click node_api_server "https://github.com/prahalcoder/honeychain/blob/main/APICtech/backend/src/server.js"
click node_auth "https://github.com/prahalcoder/honeychain/blob/main/APICtech/backend/src/routes/auth.js"
click node_org_routes "https://github.com/prahalcoder/honeychain/blob/main/APICtech/backend/src/routes/org.js"
click node_trace_routes "https://github.com/prahalcoder/honeychain/blob/main/APICtech/backend/src/routes/traceability.js"
click node_admin_routes "https://github.com/prahalcoder/honeychain/blob/main/APICtech/backend/src/routes/admin.js"
click node_trade_routes "https://github.com/prahalcoder/honeychain/blob/main/APICtech/backend/src/routes/trade.js"
click node_shop_routes "https://github.com/prahalcoder/honeychain/blob/main/APICtech/backend/src/routes/shop.js"
click node_verification "https://github.com/prahalcoder/honeychain/blob/main/APICtech/backend/src/routes/traceability.js"
click node_database "https://github.com/prahalcoder/honeychain/blob/main/APICtech/backend/src/database/database.js"
click node_chain_service "https://github.com/prahalcoder/honeychain/blob/main/APICtech/backend/src/services/blockchain.js"
click node_ipfs "https://github.com/prahalcoder/honeychain/blob/main/APICtech/backend/src/services/ipfs.js"
click node_iot_service "https://github.com/prahalcoder/honeychain/blob/main/APICtech/beehive/python_app/app.py"
click node_telemetry_db "https://github.com/prahalcoder/honeychain/blob/main/APICtech/beehive/python_app/database.py"
click node_camera "https://github.com/prahalcoder/honeychain/blob/main/APICtech/beehive/python_app/camera_manager.py"
click node_hive_insights "https://github.com/prahalcoder/honeychain/blob/main/APICtech/beehive/python_app/insights.py"
click node_public_site "https://github.com/prahalcoder/honeychain/blob/main/honeychain-web/src/App.jsx"
click node_verify_panel "https://github.com/prahalcoder/honeychain/blob/main/honeychain-web/src/Verify.jsx"
click node_market "https://github.com/prahalcoder/honeychain/blob/main/APICtech/frontend/src/pages/trade/Market.jsx"

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_keeper,node_officer,node_market toneBlue
class node_api_server,node_auth,node_org_routes,node_trace_routes,node_admin_routes,node_trade_routes,node_shop_routes,node_verification toneAmber
class node_database,node_chain_service,node_ipfs toneMint
class node_iot_service,node_telemetry_db,node_camera,node_hive_insights toneRose
class node_public_site,node_verify_panel,node_beekeeper,node_kvic,node_esp32,node_public_consumer toneIndigo
```

## Components

### User workspaces

- [Keeper app](https://github.com/prahalcoder/honeychain/blob/main/APICtech/frontend/src/App.jsx): `APICtech/frontend/src/App.jsx`
- [KVIC Admin](https://github.com/prahalcoder/honeychain/blob/main/apictech-admin/src/App.jsx): `apictech-admin/src/App.jsx`
- [Keeper trade workspace](https://github.com/prahalcoder/honeychain/blob/main/APICtech/frontend/src/pages/trade/Market.jsx): `APICtech/frontend/src/pages/trade/Market.jsx`

### API and domain

- [Express API](https://github.com/prahalcoder/honeychain/blob/main/APICtech/backend/src/server.js): `APICtech/backend/src/server.js`
- [Authentication](https://github.com/prahalcoder/honeychain/blob/main/APICtech/backend/src/routes/auth.js): `APICtech/backend/src/routes/auth.js`
- [Organization routes](https://github.com/prahalcoder/honeychain/blob/main/APICtech/backend/src/routes/org.js): `APICtech/backend/src/routes/org.js`
- [Traceability routes](https://github.com/prahalcoder/honeychain/blob/main/APICtech/backend/src/routes/traceability.js): `APICtech/backend/src/routes/traceability.js`
- [Admin routes](https://github.com/prahalcoder/honeychain/blob/main/APICtech/backend/src/routes/admin.js): `APICtech/backend/src/routes/admin.js`
- [Trade routes](https://github.com/prahalcoder/honeychain/blob/main/APICtech/backend/src/routes/trade.js): `APICtech/backend/src/routes/trade.js`
- [Shop routes](https://github.com/prahalcoder/honeychain/blob/main/APICtech/backend/src/routes/shop.js): `APICtech/backend/src/routes/shop.js`
- [QR verification](https://github.com/prahalcoder/honeychain/blob/main/APICtech/backend/src/routes/traceability.js): `APICtech/backend/src/routes/traceability.js`

### Records and ledger

- [Common and company data](https://github.com/prahalcoder/honeychain/blob/main/APICtech/backend/src/database/database.js): `APICtech/backend/src/database/database.js`
- [Blockchain ledger](https://github.com/prahalcoder/honeychain/blob/main/APICtech/backend/src/services/blockchain.js): `APICtech/backend/src/services/blockchain.js`
- [Pinned documents](https://github.com/prahalcoder/honeychain/blob/main/APICtech/backend/src/services/ipfs.js): `APICtech/backend/src/services/ipfs.js`

### Hive monitoring

- [Hive monitor API](https://github.com/prahalcoder/honeychain/blob/main/APICtech/beehive/python_app/app.py): `APICtech/beehive/python_app/app.py`
- [Telemetry logs](https://github.com/prahalcoder/honeychain/blob/main/APICtech/beehive/python_app/database.py): `APICtech/beehive/python_app/database.py`
- [Camera capture](https://github.com/prahalcoder/honeychain/blob/main/APICtech/beehive/python_app/camera_manager.py): `APICtech/beehive/python_app/camera_manager.py`
- [Hive health insights](https://github.com/prahalcoder/honeychain/blob/main/APICtech/beehive/python_app/insights.py): `APICtech/beehive/python_app/insights.py`

### Public access

- [Public website](https://github.com/prahalcoder/honeychain/blob/main/honeychain-web/src/App.jsx): `honeychain-web/src/App.jsx`
- [Verification panel](https://github.com/prahalcoder/honeychain/blob/main/honeychain-web/src/Verify.jsx): `honeychain-web/src/Verify.jsx`

### Other components

- **Beekeeper**
- **KVIC officer**
- **ESP32 hive sensors**
- **Honey buyer**

## Connections

- Beekeeper → Keeper app: uses
- KVIC officer → KVIC Admin: uses
- Keeper app → Express API: API requests
- KVIC Admin → Express API: API requests
- Express API → Authentication: mounts routes
- Express API → Organization routes: mounts routes
- Express API → Traceability routes: mounts routes
- Express API → Admin routes: mounts routes
- Express API → Trade routes: mounts routes
- Express API → Shop routes: mounts routes
- Express API → Common and company data: initializes
- Express API → Blockchain ledger: starts chain
- Express API → Blockchain ledger: seals pending block
- Keeper app → Keeper trade workspace: opens trade
- Keeper trade workspace → Express API: API requests
- Honey buyer → Public website: visits or scans QR
- Public website → Verification panel: renders verification
- Verification panel → Express API: verification request
- QR verification → Common and company data: reads registry
- ESP32 hive sensors → Hive monitor API: sends readings
- Hive monitor API → Telemetry logs: stores readings
- Hive monitor API → Camera capture: controls capture
- Hive monitor API → Telemetry logs: reads recent logs
- Hive monitor API → Hive health insights: analyzes readings
