# clouden56/projectkitchen architecture

> Architecture diagram of the GitHub repository clouden56/projectkitchen, 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/clouden56/projectkitchen
- Repository: https://github.com/clouden56/projectkitchen

## Overview

Fridge Recipe Tracker is an interactive terminal app for managing food inventory, finding items nearing expiry, and generating safety-checked recipes intended to reduce food waste. Its main workflow collects recipe preferences, sends inventory and constraints to Gemini, evaluates the returned recipe against domain rules, saves the evaluation to history, and displays the result. The README documents additional inventory and history management capabilities. Relationships are based on the README and shown excerpts; internal data and AI details not shown in the excerpts are kept at subsystem level.

Main entry points: [`main.py`](https://github.com/clouden56/projectkitchen/blob/main/main.py) (Application coordinator), [`src/data_manager.py`](https://github.com/clouden56/projectkitchen/blob/main/src/data_manager.py) (Inventory and history operations), [`src/ai_manager.py`](https://github.com/clouden56/projectkitchen/blob/main/src/ai_manager.py) (Recipe generation and validation), [`src/io_manager.py`](https://github.com/clouden56/projectkitchen/blob/main/src/io_manager.py) (Prompts and displays)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_coordination["Application Coordination"]
  node_main["Application coordinator<br/>[main.py]"]
end

subgraph group_terminal["Terminal Experience"]
  node_terminal_ui["Prompts and displays<br/>[io_manager.py]"]
end

subgraph group_recipes["Recipe Intelligence"]
  node_ai["Recipe generation and validation<br/>[ai_manager.py]"]
  node_evaluation["Safety, matching, and waste scoring<br/>[logic_manager.py]"]
end

subgraph group_storage["Inventory and History"]
  node_data["Inventory and history operations<br/>[data_manager.py]"]
  node_inventory_store[("Inventory JSON<br/>[inventory.json]")]
  node_history_store[("Recipe history JSON")]
end

node_user(("Kitchen user"))
node_gemini{{"Google Gemini API"}}

node_user -->|"enters preferences"| node_terminal_ui
node_main -->|"requests and displays"| node_terminal_ui
node_main -->|"loads and updates"| node_data
node_main -->|"requests recipe"| node_ai
node_ai -->|"calls API"| node_gemini
node_main -->|"evaluates recipe"| node_evaluation
node_main -->|"saves evaluation"| node_data
node_data -->|"reads and writes"| node_inventory_store
node_data -->|"reads and writes"| node_history_store
node_main -->|"queries expiring items"| node_data
node_main -->|"filters recipe history"| node_data

click node_main "https://github.com/clouden56/projectkitchen/blob/main/main.py"
click node_terminal_ui "https://github.com/clouden56/projectkitchen/blob/main/src/io_manager.py"
click node_ai "https://github.com/clouden56/projectkitchen/blob/main/src/ai_manager.py"
click node_evaluation "https://github.com/clouden56/projectkitchen/blob/main/src/logic_manager.py"
click node_data "https://github.com/clouden56/projectkitchen/blob/main/src/data_manager.py"
click node_inventory_store "https://github.com/clouden56/projectkitchen/blob/main/data/inventory.json"
click node_history_store "https://github.com/clouden56/projectkitchen/blob/main/data/recipe_history.json"

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_main,node_user toneBlue
class node_terminal_ui toneAmber
class node_ai,node_evaluation,node_gemini toneMint
class node_data,node_inventory_store,node_history_store toneRose
```

## Components

### Application Coordination

- [Application coordinator](https://github.com/clouden56/projectkitchen/blob/main/main.py): `main.py`

### Terminal Experience

- [Prompts and displays](https://github.com/clouden56/projectkitchen/blob/main/src/io_manager.py): `src/io_manager.py`

### Recipe Intelligence

- [Recipe generation and validation](https://github.com/clouden56/projectkitchen/blob/main/src/ai_manager.py): `src/ai_manager.py`
- [Safety, matching, and waste scoring](https://github.com/clouden56/projectkitchen/blob/main/src/logic_manager.py): `src/logic_manager.py`

### Inventory and History

- [Inventory and history operations](https://github.com/clouden56/projectkitchen/blob/main/src/data_manager.py): `src/data_manager.py`
- [Inventory JSON](https://github.com/clouden56/projectkitchen/blob/main/data/inventory.json): `data/inventory.json`
- [Recipe history JSON](https://github.com/clouden56/projectkitchen/blob/main/data/recipe_history.json): `data/recipe_history.json`

### Other components

- **Kitchen user**
- **Google Gemini API**

## Connections

- Kitchen user → Prompts and displays: enters preferences (evidence: `src/io_manager.py`)
- Application coordinator → Prompts and displays: requests and displays (evidence: `main.py`)
- Application coordinator → Inventory and history operations: loads and updates (evidence: `main.py`)
- Application coordinator → Recipe generation and validation: requests recipe (evidence: `main.py`)
- Recipe generation and validation → Google Gemini API: calls API (evidence: `src/ai_manager.py`)
- Application coordinator → Safety, matching, and waste scoring: evaluates recipe (evidence: `main.py`)
- Application coordinator → Inventory and history operations: saves evaluation (evidence: `main.py`)
- Inventory and history operations → Inventory JSON: reads and writes (evidence: `README.md`)
- Inventory and history operations → Recipe history JSON: reads and writes (evidence: `README.md`)
- Application coordinator → Inventory and history operations: queries expiring items (evidence: `main.py`)
- Application coordinator → Inventory and history operations: filters recipe history (evidence: `main.py`)
