# itzap77/sambhav architecture

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

- Interactive diagram: https://gitdiagram.com/itzap77/sambhav
- Repository: https://github.com/itzap77/sambhav

## Overview

This is a Flask-based storefront. A shopper loads the page, browses products, adds items to a session-backed cart, and submits checkout; the backend validates stock and records an order while reducing inventory in SQLite. The main runtime is concentrated in app.py and main.js. The template and database schema are present in the tree but were not excerpted, so their internal wiring and data model are not expanded here; no external payment integration is shown.

Main entry points: [`fullstack_store/static/js/main.js`](https://github.com/itzap77/sambhav/blob/main/fullstack_store/static/js/main.js) (Store Interactions), [`fullstack_store/app.py`](https://github.com/itzap77/sambhav/blob/main/fullstack_store/app.py) (Cart API), [`fullstack_store/database/store.db`](https://github.com/itzap77/sambhav/blob/main/fullstack_store/database/store.db) (Store Database), [`fullstack_store/templates/index.html`](https://github.com/itzap77/sambhav/blob/main/fullstack_store/templates/index.html) (Store Page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Storefront"]
  node_page["Store Page<br/>[index.html]"]
  node_ui["Store Interactions<br/>[main.js]"]
end

subgraph group_backend["Store API"]
  node_catalog["Product Catalog<br/>[app.py]"]
  node_cart_api["Cart API<br/>[app.py]"]
  node_cart_state["Session Cart<br/>[app.py]"]
  node_checkout["Checkout<br/>[app.py]"]
end

subgraph group_data["Store Data"]
  node_store_db[("Store Database<br/>[store.db]")]
end

node_shopper(("Shopper"))

node_shopper -->|"requests page"| node_page
node_page -.->|"renders interactions"| node_ui
node_ui -->|"fetches products"| node_catalog
node_catalog -->|"reads products"| node_store_db
node_catalog -->|"returns products"| node_ui
node_ui -->|"adds and views"| node_cart_api
node_cart_api -->|"updates and reads"| node_cart_state
node_cart_api -->|"checks and reads products"| node_store_db
node_cart_api -->|"returns cart data"| node_ui
node_ui -->|"submits checkout"| node_checkout
node_checkout -->|"reads and clears"| node_cart_state
node_checkout -->|"records order and updates stock"| node_store_db
node_checkout -->|"returns order result"| node_ui

click node_page "https://github.com/itzap77/sambhav/blob/main/fullstack_store/templates/index.html"
click node_ui "https://github.com/itzap77/sambhav/blob/main/fullstack_store/static/js/main.js"
click node_catalog "https://github.com/itzap77/sambhav/blob/main/fullstack_store/app.py"
click node_cart_api "https://github.com/itzap77/sambhav/blob/main/fullstack_store/app.py"
click node_cart_state "https://github.com/itzap77/sambhav/blob/main/fullstack_store/app.py"
click node_checkout "https://github.com/itzap77/sambhav/blob/main/fullstack_store/app.py"
click node_store_db "https://github.com/itzap77/sambhav/blob/main/fullstack_store/database/store.db"

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_page,node_ui toneBlue
class node_catalog,node_cart_api,node_cart_state,node_checkout toneAmber
class node_store_db toneMint
class node_shopper toneIndigo
```

## Components

### Storefront

- [Store Page](https://github.com/itzap77/sambhav/blob/main/fullstack_store/templates/index.html): `fullstack_store/templates/index.html`
- [Store Interactions](https://github.com/itzap77/sambhav/blob/main/fullstack_store/static/js/main.js): `fullstack_store/static/js/main.js`

### Store API

- [Product Catalog](https://github.com/itzap77/sambhav/blob/main/fullstack_store/app.py): `fullstack_store/app.py`
- [Cart API](https://github.com/itzap77/sambhav/blob/main/fullstack_store/app.py): `fullstack_store/app.py`
- [Session Cart](https://github.com/itzap77/sambhav/blob/main/fullstack_store/app.py): `fullstack_store/app.py`
- [Checkout](https://github.com/itzap77/sambhav/blob/main/fullstack_store/app.py): `fullstack_store/app.py`

### Store Data

- [Store Database](https://github.com/itzap77/sambhav/blob/main/fullstack_store/database/store.db): `fullstack_store/database/store.db`

### Other components

- **Shopper**

## Connections

- Shopper → Store Page: requests page
- Store Page → Store Interactions: renders interactions
- Store Interactions → Product Catalog: fetches products (evidence: `fullstack_store/static/js/main.js`)
- Product Catalog → Store Database: reads products (evidence: `fullstack_store/app.py`)
- Product Catalog → Store Interactions: returns products (evidence: `fullstack_store/app.py`)
- Store Interactions → Cart API: adds and views (evidence: `fullstack_store/static/js/main.js`)
- Cart API → Session Cart: updates and reads (evidence: `fullstack_store/app.py`)
- Cart API → Store Database: checks and reads products (evidence: `fullstack_store/app.py`)
- Cart API → Store Interactions: returns cart data (evidence: `fullstack_store/app.py`)
- Store Interactions → Checkout: submits checkout (evidence: `fullstack_store/static/js/main.js`)
- Checkout → Session Cart: reads and clears (evidence: `fullstack_store/app.py`)
- Checkout → Store Database: records order and updates stock (evidence: `fullstack_store/app.py`)
- Checkout → Store Interactions: returns order result (evidence: `fullstack_store/app.py`)
