# feohuman/squishcart architecture

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

- Interactive diagram: https://gitdiagram.com/feohuman/squishcart
- Repository: https://github.com/feohuman/squishcart

## Overview

Mega is a grocery-shopping and inventory application with a Streamlit interface and a FastAPI service. The user workflow spans account registration/login, product browsing and administration, basket management, and QR-based scanning and checkout. The API persists users, products, and baskets in SQLite; a separate recommendation utility updates recipe popularity from purchase history. The README is empty, so capabilities and connections here are based on sampled source and the source index; several data-file relationships are not shown.

Main entry points: [`src/index.py`](https://github.com/feohuman/squishcart/blob/main/src/index.py) (Storefront UI), [`src/main.py`](https://github.com/feohuman/squishcart/blob/main/src/main.py) (Store API), [`src/recalg.py`](https://github.com/feohuman/squishcart/blob/main/src/recalg.py) (Recipe popularity), [`src/middleware.py`](https://github.com/feohuman/squishcart/blob/main/src/middleware.py) (Backend client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Shopping interface"]
  node_streamlit["Storefront UI<br/>[index.py]"]
  node_http_client["Backend client<br/>[middleware.py]"]
  node_qr_scan["QR scanner<br/>[scanner.py]"]
end

subgraph group_service["API and domain"]
  node_api["Store API<br/>[main.py]"]
  node_auth["Token and passwords<br/>[auth.py]"]
  node_domain_objects["Shopping objects<br/>[objects.py]"]
end

subgraph group_storage["Persistence"]
  node_orm_models["Store data models<br/>[models.py]"]
  node_db_session["Database sessions<br/>[database.py]"]
  node_sqlite[("SQLite store<br/>[test.db]")]
end

subgraph group_recommend["Recommendations"]
  node_recommender["Recipe popularity<br/>[recalg.py]"]
  node_purchase_data["Purchase history data<br/>[Marcel.json]"]
  node_recipe_data["Recipe data<br/>[recipes.json]"]
  node_favorites_data["Recommended recipes data"]
end

node_shopper(("Shopper or admin"))
node_camera["Camera"]

node_shopper -->|"uses"| node_streamlit
node_streamlit -->|"calls"| node_http_client
node_http_client -->|"sends requests"| node_api
node_streamlit -->|"starts scanning"| node_qr_scan
node_qr_scan -->|"captures frames"| node_camera
node_streamlit -->|"creates products"| node_domain_objects
node_api -->|"calls"| node_auth
node_api -->|"queries and updates"| node_orm_models
node_api -->|"gets engine and sessions"| node_db_session
node_db_session -->|"connects"| node_sqlite
node_recommender -.->|"reads history"| node_purchase_data
node_recommender -.->|"updates popularity"| node_recipe_data
node_recommender -.->|"writes recommendations"| node_favorites_data

click node_streamlit "https://github.com/feohuman/squishcart/blob/main/src/index.py"
click node_http_client "https://github.com/feohuman/squishcart/blob/main/src/middleware.py"
click node_qr_scan "https://github.com/feohuman/squishcart/blob/main/src/scanner.py"
click node_api "https://github.com/feohuman/squishcart/blob/main/src/main.py"
click node_auth "https://github.com/feohuman/squishcart/blob/main/src/auth.py"
click node_domain_objects "https://github.com/feohuman/squishcart/blob/main/src/objects.py"
click node_orm_models "https://github.com/feohuman/squishcart/blob/main/src/models.py"
click node_db_session "https://github.com/feohuman/squishcart/blob/main/src/database.py"
click node_sqlite "https://github.com/feohuman/squishcart/blob/main/src/test.db"
click node_recommender "https://github.com/feohuman/squishcart/blob/main/src/recalg.py"
click node_purchase_data "https://github.com/feohuman/squishcart/blob/main/src/Marcel.json"
click node_recipe_data "https://github.com/feohuman/squishcart/blob/main/src/recipes.json"
click node_favorites_data "https://github.com/feohuman/squishcart/blob/main/src/recommendations.Marcel.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_streamlit,node_http_client,node_qr_scan toneBlue
class node_api,node_auth,node_domain_objects toneAmber
class node_orm_models,node_db_session,node_sqlite toneMint
class node_recommender,node_purchase_data,node_recipe_data,node_favorites_data toneRose
class node_shopper,node_camera toneIndigo
```

## Components

### Shopping interface

- [Storefront UI](https://github.com/feohuman/squishcart/blob/main/src/index.py): `src/index.py`
- [Backend client](https://github.com/feohuman/squishcart/blob/main/src/middleware.py): `src/middleware.py`
- [QR scanner](https://github.com/feohuman/squishcart/blob/main/src/scanner.py): `src/scanner.py`

### API and domain

- [Store API](https://github.com/feohuman/squishcart/blob/main/src/main.py): `src/main.py`
- [Token and passwords](https://github.com/feohuman/squishcart/blob/main/src/auth.py): `src/auth.py`
- [Shopping objects](https://github.com/feohuman/squishcart/blob/main/src/objects.py): `src/objects.py`

### Persistence

- [Store data models](https://github.com/feohuman/squishcart/blob/main/src/models.py): `src/models.py`
- [Database sessions](https://github.com/feohuman/squishcart/blob/main/src/database.py): `src/database.py`
- [SQLite store](https://github.com/feohuman/squishcart/blob/main/src/test.db): `src/test.db`

### Recommendations

- [Recipe popularity](https://github.com/feohuman/squishcart/blob/main/src/recalg.py): `src/recalg.py`
- [Purchase history data](https://github.com/feohuman/squishcart/blob/main/src/Marcel.json): `src/Marcel.json`
- [Recipe data](https://github.com/feohuman/squishcart/blob/main/src/recipes.json): `src/recipes.json`
- [Recommended recipes data](https://github.com/feohuman/squishcart/blob/main/src/recommendations.Marcel.json): `src/recommendations.Marcel.json`

### Other components

- **Shopper or admin**
- **Camera**

## Connections

- Shopper or admin → Storefront UI: uses (evidence: `src/index.py`)
- Storefront UI → Backend client: calls (evidence: `src/index.py`)
- Backend client → Store API: sends requests (evidence: `src/middleware.py`)
- Storefront UI → QR scanner: starts scanning (evidence: `src/index.py`)
- QR scanner → Camera: captures frames (evidence: `src/scanner.py`)
- Storefront UI → Shopping objects: creates products (evidence: `src/index.py`)
- Store API → Token and passwords: calls (evidence: `src/main.py`)
- Store API → Store data models: queries and updates (evidence: `src/main.py`)
- Store API → Database sessions: gets engine and sessions (evidence: `src/main.py`)
- Database sessions → SQLite store: connects (evidence: `src/database.py`)
- Recipe popularity → Purchase history data: reads history
- Recipe popularity → Recipe data: updates popularity
- Recipe popularity → Recommended recipes data: writes recommendations
