# krishna99-tech/smartkitchen architecture

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

- Interactive diagram: https://gitdiagram.com/krishna99-tech/smartkitchen
- Repository: https://github.com/krishna99-tech/smartkitchen

## Overview

KitchenOS combines dual-ESP32 kitchen hardware, an AWS serverless backend, a Flutter mobile client, and an administrative portal. The documented device workflow provisions a gateway, publishes scale telemetry, processes it in cloud functions, persists kitchen state, and updates connected clients; scheduled jobs also send reminders and reports. Admin pages cover device, inventory, activity, logs, users, settings, and reporting. Firmware and backend source excerpts are partial, and Flutter/Dart implementation files were not present in the supplied tree, so some subsystem links rely on the README architecture.

Main entry points: [`aws/lambdas/index.js`](https://github.com/krishna99-tech/smartkitchen/blob/work-reports-ff6bf61/aws/lambdas/index.js) (Unified Backend), [`flutterapp`](https://github.com/krishna99-tech/smartkitchen/tree/work-reports-ff6bf61/flutterapp) (Flutter App), [`aws/lambdas/reminders.js`](https://github.com/krishna99-tech/smartkitchen/blob/work-reports-ff6bf61/aws/lambdas/reminders.js) (Scheduled Reminders), [`firmware/main_ble/Nodes/KitchenOS_NodeB_Net/NetworkManager.cpp`](https://github.com/krishna99-tech/smartkitchen/blob/work-reports-ff6bf61/firmware/main_ble/Nodes/KitchenOS_NodeB_Net/NetworkManager.cpp) (Network Gateway)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_edge["Kitchen Hardware"]
  node_scales["Scale Sensors<br/>[SensorManager.cpp]"]
  node_nodea["Scale UI Node<br/>[CommsManager.cpp]"]
  node_nodeb["Network Gateway<br/>[NetworkManager.cpp]"]
  node_device_state[("Device State<br/>[StorageManager.cpp]")]
end

subgraph group_cloud["Cloud Platform"]
  node_fleet["Fleet Provisioning<br/>[index.js]"]
  node_iot{{"AWS IoT Core"}}
  node_unified["Unified Backend<br/>[index.js]"]
  node_analytics["Analytics<br/>[analytics.js]"]
  node_nutrition["Nutrition<br/>[nutrition.js]"]
  node_reports["Report Generation<br/>[reports.js]"]
  node_pdf["PDF Reports<br/>[pdf_report.js]"]
  node_reminders["Scheduled Reminders<br/>[reminders.js]"]
  node_appsync{{"GraphQL API<br/>[schema.graphql]"}}
  node_websocket{{"WebSocket API<br/>[ws.js]"}}
  node_dynamodb[("Kitchen Data")]
  node_cognito{{"Cognito Auth"}}
  node_eventbridge["Scheduled Events"]
  node_notifications{{"FCM and SES"}}
end

subgraph group_client["Client Apps"]
  node_mobile["Flutter App"]
end

subgraph group_admin["Administration"]
  node_admin_pages["Admin Console"]
  node_admin_actions["Admin Actions"]
  node_admin_pdf["Admin PDF Reports<br/>[pdf_report.ts]"]
end

node_operator(("Kitchen User"))

node_scales -->|"sends readings"| node_nodea
node_nodea -->|"UART exchange"| node_nodeb
node_nodeb -->|"requests provisioning"| node_fleet
node_fleet -->|"provisions device"| node_iot
node_nodeb -->|"publishes telemetry"| node_iot
node_iot -->|"triggers"| node_unified
node_unified -->|"reads and writes"| node_dynamodb
node_unified -->|"uses analytics"| node_analytics
node_unified -->|"uses nutrition"| node_nutrition
node_unified -->|"uses reports"| node_reports
node_reports -->|"generates PDFs"| node_pdf
node_unified -->|"pushes updates"| node_websocket
node_unified -->|"invokes asynchronously"| node_reminders
node_eventbridge -->|"invokes on schedule"| node_reminders
node_reminders -->|"reads kitchen data"| node_dynamodb
node_reminders -->|"sends reminders"| node_notifications
node_mobile -->|"authenticates"| node_cognito
node_mobile -->|"queries and subscribes"| node_appsync
node_mobile -->|"receives live updates"| node_websocket
node_mobile -->|"receives push"| node_notifications
node_operator -->|"uses"| node_mobile
node_admin_pages -.->|"uses actions"| node_admin_actions
node_admin_actions -->|"requests reports"| node_admin_pdf

click node_scales "https://github.com/krishna99-tech/smartkitchen/blob/work-reports-ff6bf61/firmware/main_ble/Nodes/KitchenOS_NodeA_UI/SensorManager.cpp"
click node_nodea "https://github.com/krishna99-tech/smartkitchen/blob/work-reports-ff6bf61/firmware/main_ble/Nodes/KitchenOS_NodeA_UI/CommsManager.cpp"
click node_nodeb "https://github.com/krishna99-tech/smartkitchen/blob/work-reports-ff6bf61/firmware/main_ble/Nodes/KitchenOS_NodeB_Net/NetworkManager.cpp"
click node_device_state "https://github.com/krishna99-tech/smartkitchen/blob/work-reports-ff6bf61/firmware/main_ble/Nodes/KitchenOS_NodeB_Net/StorageManager.cpp"
click node_fleet "https://github.com/krishna99-tech/smartkitchen/blob/work-reports-ff6bf61/aws/lambdas/index.js"
click node_unified "https://github.com/krishna99-tech/smartkitchen/blob/work-reports-ff6bf61/aws/lambdas/index.js"
click node_analytics "https://github.com/krishna99-tech/smartkitchen/blob/work-reports-ff6bf61/aws/lambdas/analytics.js"
click node_nutrition "https://github.com/krishna99-tech/smartkitchen/blob/work-reports-ff6bf61/aws/lambdas/nutrition.js"
click node_reports "https://github.com/krishna99-tech/smartkitchen/blob/work-reports-ff6bf61/aws/lambdas/reports.js"
click node_pdf "https://github.com/krishna99-tech/smartkitchen/blob/work-reports-ff6bf61/aws/lambdas/pdf_report.js"
click node_reminders "https://github.com/krishna99-tech/smartkitchen/blob/work-reports-ff6bf61/aws/lambdas/reminders.js"
click node_appsync "https://github.com/krishna99-tech/smartkitchen/blob/work-reports-ff6bf61/aws/schema.graphql"
click node_websocket "https://github.com/krishna99-tech/smartkitchen/blob/work-reports-ff6bf61/aws/lambdas/ws.js"
click node_mobile "https://github.com/krishna99-tech/smartkitchen/tree/work-reports-ff6bf61/flutterapp"
click node_admin_pages "https://github.com/krishna99-tech/smartkitchen/tree/work-reports-ff6bf61/admin_portal/app"
click node_admin_actions "https://github.com/krishna99-tech/smartkitchen/tree/work-reports-ff6bf61/admin_portal/lib/actions"
click node_admin_pdf "https://github.com/krishna99-tech/smartkitchen/blob/work-reports-ff6bf61/admin_portal/lib/actions/pdf_report.ts"

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_scales,node_nodea,node_nodeb,node_device_state,node_operator toneBlue
class node_fleet,node_iot,node_unified,node_analytics,node_nutrition,node_reports,node_pdf,node_reminders,node_appsync,node_websocket,node_dynamodb,node_cognito,node_eventbridge,node_notifications toneAmber
class node_mobile toneMint
class node_admin_pages,node_admin_actions,node_admin_pdf toneRose
```

## Components

### Kitchen Hardware

- [Scale Sensors](https://github.com/krishna99-tech/smartkitchen/blob/work-reports-ff6bf61/firmware/main_ble/Nodes/KitchenOS_NodeA_UI/SensorManager.cpp): `firmware/main_ble/Nodes/KitchenOS_NodeA_UI/SensorManager.cpp`
- [Scale UI Node](https://github.com/krishna99-tech/smartkitchen/blob/work-reports-ff6bf61/firmware/main_ble/Nodes/KitchenOS_NodeA_UI/CommsManager.cpp): `firmware/main_ble/Nodes/KitchenOS_NodeA_UI/CommsManager.cpp`
- [Network Gateway](https://github.com/krishna99-tech/smartkitchen/blob/work-reports-ff6bf61/firmware/main_ble/Nodes/KitchenOS_NodeB_Net/NetworkManager.cpp): `firmware/main_ble/Nodes/KitchenOS_NodeB_Net/NetworkManager.cpp`
- [Device State](https://github.com/krishna99-tech/smartkitchen/blob/work-reports-ff6bf61/firmware/main_ble/Nodes/KitchenOS_NodeB_Net/StorageManager.cpp): `firmware/main_ble/Nodes/KitchenOS_NodeB_Net/StorageManager.cpp`

### Cloud Platform

- [Fleet Provisioning](https://github.com/krishna99-tech/smartkitchen/blob/work-reports-ff6bf61/aws/lambdas/index.js): `aws/lambdas/index.js`
- **AWS IoT Core**
- [Unified Backend](https://github.com/krishna99-tech/smartkitchen/blob/work-reports-ff6bf61/aws/lambdas/index.js): `aws/lambdas/index.js`
- [Analytics](https://github.com/krishna99-tech/smartkitchen/blob/work-reports-ff6bf61/aws/lambdas/analytics.js): `aws/lambdas/analytics.js`
- [Nutrition](https://github.com/krishna99-tech/smartkitchen/blob/work-reports-ff6bf61/aws/lambdas/nutrition.js): `aws/lambdas/nutrition.js`
- [Report Generation](https://github.com/krishna99-tech/smartkitchen/blob/work-reports-ff6bf61/aws/lambdas/reports.js): `aws/lambdas/reports.js`
- [PDF Reports](https://github.com/krishna99-tech/smartkitchen/blob/work-reports-ff6bf61/aws/lambdas/pdf_report.js): `aws/lambdas/pdf_report.js`
- [Scheduled Reminders](https://github.com/krishna99-tech/smartkitchen/blob/work-reports-ff6bf61/aws/lambdas/reminders.js): `aws/lambdas/reminders.js`
- [GraphQL API](https://github.com/krishna99-tech/smartkitchen/blob/work-reports-ff6bf61/aws/schema.graphql): `aws/schema.graphql`
- [WebSocket API](https://github.com/krishna99-tech/smartkitchen/blob/work-reports-ff6bf61/aws/lambdas/ws.js): `aws/lambdas/ws.js`
- **Kitchen Data**
- **Cognito Auth**
- **Scheduled Events**
- **FCM and SES**

### Client Apps

- [Flutter App](https://github.com/krishna99-tech/smartkitchen/tree/work-reports-ff6bf61/flutterapp): `flutterapp`

### Administration

- [Admin Console](https://github.com/krishna99-tech/smartkitchen/tree/work-reports-ff6bf61/admin_portal/app): `admin_portal/app`
- [Admin Actions](https://github.com/krishna99-tech/smartkitchen/tree/work-reports-ff6bf61/admin_portal/lib/actions): `admin_portal/lib/actions`
- [Admin PDF Reports](https://github.com/krishna99-tech/smartkitchen/blob/work-reports-ff6bf61/admin_portal/lib/actions/pdf_report.ts): `admin_portal/lib/actions/pdf_report.ts`

### Other components

- **Kitchen User**

## Connections

- Scale Sensors → Scale UI Node: sends readings
- Scale UI Node → Network Gateway: UART exchange
- Network Gateway → Fleet Provisioning: requests provisioning
- Fleet Provisioning → AWS IoT Core: provisions device
- Network Gateway → AWS IoT Core: publishes telemetry
- AWS IoT Core → Unified Backend: triggers
- Unified Backend → Kitchen Data: reads and writes
- Unified Backend → Analytics: uses analytics (evidence: `aws/lambdas/index.js`)
- Unified Backend → Nutrition: uses nutrition (evidence: `aws/lambdas/index.js`)
- Unified Backend → Report Generation: uses reports (evidence: `aws/lambdas/index.js`)
- Report Generation → PDF Reports: generates PDFs (evidence: `aws/lambdas/reports.js`)
- Unified Backend → WebSocket API: pushes updates
- Unified Backend → Scheduled Reminders: invokes asynchronously
- Scheduled Events → Scheduled Reminders: invokes on schedule
- Scheduled Reminders → Kitchen Data: reads kitchen data
- Scheduled Reminders → FCM and SES: sends reminders
- Flutter App → Cognito Auth: authenticates
- Flutter App → GraphQL API: queries and subscribes
- Flutter App → WebSocket API: receives live updates
- Flutter App → FCM and SES: receives push
- Kitchen User → Flutter App: uses
- Admin Console → Admin Actions: uses actions
- Admin Actions → Admin PDF Reports: requests reports (evidence: `admin_portal/lib/actions/reports.ts`)
