# vivekthecreator/packwise architecture

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

- Interactive diagram: https://gitdiagram.com/vivekthecreator/packwise
- Repository: https://github.com/vivekthecreator/packwise

## Overview

PackWise is a bilingual food-packaging decision-support dashboard. Users enter product and supply-chain conditions, receive a packaging recommendation with scientific checks and sustainability metrics, then explore shelf-life comparisons and generate a technical report. The README documents the tiered analysis flow; sampled source confirms formula, audit, and sustainability logic, but excerpts do not expose every frontend/API connection, so uncertain wiring is omitted.

Main entry points: [`server.py`](https://github.com/vivekthecreator/packwise/blob/main/server.py) (FastAPI service), [`js/app.js`](https://github.com/vivekthecreator/packwise/blob/main/js/app.js) (Bilingual controller), [`index.html`](https://github.com/vivekthecreator/packwise/blob/main/index.html) (Dashboard interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Dashboard"]
  node_dashboard["Dashboard interface<br/>[index.html]"]
  node_frontend["Bilingual controller<br/>[app.js]"]
  node_core_ui["Core logic controller<br/>[app.js]"]
  node_settings["AI settings<br/>[index.html]"]
end

subgraph group_analysis["Packaging Analysis"]
  node_api["FastAPI service<br/>[server.py]"]
  node_formula["Formula engine<br/>[server.py]"]
  node_materials["Materials matching<br/>[server.py]"]
  node_auditor["Scientific auditor<br/>[server.py]"]
  node_sustainability["Sustainability assessment<br/>[server.py]"]
end

subgraph group_outputs["Decision Outputs"]
  node_material_catalog["Material catalog<br/>[app.js]"]
  node_simulator["Shelf-life simulator<br/>[app.js]"]
  node_report["Technical report<br/>[app.js]"]
end

node_user(("Food scientist"))
node_gemini["Google Gemini"]
node_chartjs["Chart.js"]

node_user -->|"uses"| node_dashboard
node_dashboard -->|"loads"| node_frontend
node_frontend -->|"submits analysis"| node_api
node_api -->|"calculates"| node_formula
node_api -->|"matches materials"| node_materials
node_api -->|"requests audit"| node_auditor
node_api -->|"calculates metrics"| node_sustainability
node_auditor -.->|"requests explanation"| node_gemini
node_frontend -->|"renders"| node_material_catalog
node_frontend -->|"updates"| node_simulator
node_simulator -->|"renders chart"| node_chartjs
node_frontend -->|"generates"| node_report
node_user -->|"configures"| node_settings
node_settings -->|"sets API key"| node_api

click node_dashboard "https://github.com/vivekthecreator/packwise/blob/main/index.html"
click node_frontend "https://github.com/vivekthecreator/packwise/blob/main/js/app.js"
click node_core_ui "https://github.com/vivekthecreator/packwise/blob/main/app.js"
click node_api "https://github.com/vivekthecreator/packwise/blob/main/server.py"
click node_formula "https://github.com/vivekthecreator/packwise/blob/main/server.py"
click node_materials "https://github.com/vivekthecreator/packwise/blob/main/server.py"
click node_auditor "https://github.com/vivekthecreator/packwise/blob/main/server.py"
click node_sustainability "https://github.com/vivekthecreator/packwise/blob/main/server.py"
click node_material_catalog "https://github.com/vivekthecreator/packwise/blob/main/js/app.js"
click node_simulator "https://github.com/vivekthecreator/packwise/blob/main/js/app.js"
click node_report "https://github.com/vivekthecreator/packwise/blob/main/js/app.js"
click node_settings "https://github.com/vivekthecreator/packwise/blob/main/index.html"

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_dashboard,node_frontend,node_core_ui,node_settings toneBlue
class node_api,node_formula,node_materials,node_auditor,node_sustainability toneAmber
class node_material_catalog,node_simulator,node_report toneMint
class node_user,node_gemini,node_chartjs toneIndigo
```

## Components

### Dashboard

- [Dashboard interface](https://github.com/vivekthecreator/packwise/blob/main/index.html): `index.html`
- [Bilingual controller](https://github.com/vivekthecreator/packwise/blob/main/js/app.js): `js/app.js`
- [Core logic controller](https://github.com/vivekthecreator/packwise/blob/main/app.js): `app.js`
- [AI settings](https://github.com/vivekthecreator/packwise/blob/main/index.html): `index.html`

### Packaging Analysis

- [FastAPI service](https://github.com/vivekthecreator/packwise/blob/main/server.py): `server.py`
- [Formula engine](https://github.com/vivekthecreator/packwise/blob/main/server.py): `server.py`
- [Materials matching](https://github.com/vivekthecreator/packwise/blob/main/server.py): `server.py`
- [Scientific auditor](https://github.com/vivekthecreator/packwise/blob/main/server.py): `server.py`
- [Sustainability assessment](https://github.com/vivekthecreator/packwise/blob/main/server.py): `server.py`

### Decision Outputs

- [Material catalog](https://github.com/vivekthecreator/packwise/blob/main/js/app.js): `js/app.js`
- [Shelf-life simulator](https://github.com/vivekthecreator/packwise/blob/main/js/app.js): `js/app.js`
- [Technical report](https://github.com/vivekthecreator/packwise/blob/main/js/app.js): `js/app.js`

### Other components

- **Food scientist**
- **Google Gemini**
- **Chart.js**

## Connections

- Food scientist → Dashboard interface: uses
- Dashboard interface → Bilingual controller: loads
- Bilingual controller → FastAPI service: submits analysis
- FastAPI service → Formula engine: calculates
- FastAPI service → Materials matching: matches materials
- FastAPI service → Scientific auditor: requests audit
- FastAPI service → Sustainability assessment: calculates metrics
- Scientific auditor → Google Gemini: requests explanation
- Bilingual controller → Material catalog: renders
- Bilingual controller → Shelf-life simulator: updates
- Shelf-life simulator → Chart.js: renders chart
- Bilingual controller → Technical report: generates
- Food scientist → AI settings: configures
- AI settings → FastAPI service: sets API key
