# fenil5456/cozynest-azure-three-tier architecture

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

- Interactive diagram: https://gitdiagram.com/fenil5456/cozynest-azure-three-tier
- Repository: https://github.com/fenil5456/cozynest-azure-three-tier

## Overview

CozyNest is a Flask home-decor storefront with local sample-data mode and optional Azure-backed products, images, and order processing. Shoppers browse products, add items to a session cart, submit checkout details, and see a confirmation; checkout delegates order confirmation to a separate VM API when configured. The graph preserves product/catalog, cart, checkout, order, and image-serving stages. Source excerpts support these calls, but database details, templates, and Azure setup beyond the shown paths were not inspected, so some storage relationships are omitted.

Main entry points: [`cozynest/app.py`](https://github.com/fenil5456/cozynest-azure-three-tier/blob/main/cozynest/app.py) (Catalog access), [`cozynest/templates`](https://github.com/fenil5456/cozynest-azure-three-tier/tree/main/cozynest/templates) (Storefront templates), [`vm-order-api/order_api.py`](https://github.com/fenil5456/cozynest-azure-three-tier/blob/main/vm-order-api/order_api.py) (Order processing API), [`cozynest/generate_images.py`](https://github.com/fenil5456/cozynest-azure-three-tier/blob/main/cozynest/generate_images.py) (Placeholder image generator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_flask["Flask storefront<br/>[app.py]"]
  node_browse["Product browsing<br/>[app.py]"]
  node_product_detail["Product detail<br/>[app.py]"]
  node_templates["Storefront templates"]
end

subgraph group_catalog["Catalog and state"]
  node_cart[("Session cart<br/>[app.py]")]
  node_cart_items["Cart totals<br/>[app.py]"]
  node_catalog_access["Catalog access<br/>[app.py]"]
  node_local_products[("Local sample products<br/>[app.py]")]
  node_azure_sql[("Azure SQL")]
  node_key_vault[("Azure Key Vault")]
end

subgraph group_orders["Order processing"]
  node_checkout["Checkout<br/>[app.py]"]
  node_order_client["Order API client<br/>[app.py]"]
  node_order_api["Order processing API<br/>[order_api.py]"]
  node_confirmation["Order confirmation<br/>[app.py]"]
end

subgraph group_media["Product media"]
  node_azure_blob[("Azure Blob Storage")]
  node_image_route["Image serving<br/>[app.py]"]
  node_image_generator["Placeholder image generator<br/>[generate_images.py]"]
end

node_shopper(("Shopper"))

node_shopper -->|"uses"| node_flask
node_flask -->|"routes to"| node_browse
node_browse -->|"loads products"| node_catalog_access
node_browse -->|"renders pages"| node_templates
node_shopper -->|"opens product"| node_product_detail
node_product_detail -->|"loads product"| node_catalog_access
node_shopper -->|"updates"| node_cart
node_cart_items -->|"reads"| node_cart
node_cart_items -->|"looks up items"| node_catalog_access
node_checkout -->|"calculates total"| node_cart_items
node_checkout -->|"submits order"| node_order_client
node_order_client -->|"posts order"| node_order_api
node_order_api -->|"returns confirmation"| node_order_client
node_checkout -->|"records result"| node_confirmation
node_confirmation -->|"renders success"| node_templates
node_catalog_access -->|"reads locally"| node_local_products
node_catalog_access -.->|"queries when configured"| node_azure_sql
node_catalog_access -.->|"gets secrets"| node_key_vault
node_image_route -->|"downloads image"| node_azure_blob
node_image_route -.->|"uses credentials"| node_key_vault
node_shopper -->|"requests image"| node_image_route
node_image_generator -.->|"creates placeholders"| node_templates

click node_flask "https://github.com/fenil5456/cozynest-azure-three-tier/blob/main/cozynest/app.py"
click node_browse "https://github.com/fenil5456/cozynest-azure-three-tier/blob/main/cozynest/app.py"
click node_product_detail "https://github.com/fenil5456/cozynest-azure-three-tier/blob/main/cozynest/app.py"
click node_cart "https://github.com/fenil5456/cozynest-azure-three-tier/blob/main/cozynest/app.py"
click node_cart_items "https://github.com/fenil5456/cozynest-azure-three-tier/blob/main/cozynest/app.py"
click node_catalog_access "https://github.com/fenil5456/cozynest-azure-three-tier/blob/main/cozynest/app.py"
click node_local_products "https://github.com/fenil5456/cozynest-azure-three-tier/blob/main/cozynest/app.py"
click node_checkout "https://github.com/fenil5456/cozynest-azure-three-tier/blob/main/cozynest/app.py"
click node_order_client "https://github.com/fenil5456/cozynest-azure-three-tier/blob/main/cozynest/app.py"
click node_order_api "https://github.com/fenil5456/cozynest-azure-three-tier/blob/main/vm-order-api/order_api.py"
click node_confirmation "https://github.com/fenil5456/cozynest-azure-three-tier/blob/main/cozynest/app.py"
click node_image_route "https://github.com/fenil5456/cozynest-azure-three-tier/blob/main/cozynest/app.py"
click node_templates "https://github.com/fenil5456/cozynest-azure-three-tier/tree/main/cozynest/templates"
click node_image_generator "https://github.com/fenil5456/cozynest-azure-three-tier/blob/main/cozynest/generate_images.py"

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_flask,node_browse,node_product_detail,node_templates toneBlue
class node_cart,node_cart_items,node_catalog_access,node_local_products,node_azure_sql,node_key_vault toneAmber
class node_checkout,node_order_client,node_order_api,node_confirmation toneMint
class node_azure_blob,node_image_route,node_image_generator toneRose
class node_shopper toneIndigo
```

## Components

### Storefront

- [Flask storefront](https://github.com/fenil5456/cozynest-azure-three-tier/blob/main/cozynest/app.py): `cozynest/app.py`
- [Product browsing](https://github.com/fenil5456/cozynest-azure-three-tier/blob/main/cozynest/app.py): `cozynest/app.py`
- [Product detail](https://github.com/fenil5456/cozynest-azure-three-tier/blob/main/cozynest/app.py): `cozynest/app.py`
- [Storefront templates](https://github.com/fenil5456/cozynest-azure-three-tier/tree/main/cozynest/templates): `cozynest/templates`

### Catalog and state

- [Session cart](https://github.com/fenil5456/cozynest-azure-three-tier/blob/main/cozynest/app.py): `cozynest/app.py`
- [Cart totals](https://github.com/fenil5456/cozynest-azure-three-tier/blob/main/cozynest/app.py): `cozynest/app.py`
- [Catalog access](https://github.com/fenil5456/cozynest-azure-three-tier/blob/main/cozynest/app.py): `cozynest/app.py`
- [Local sample products](https://github.com/fenil5456/cozynest-azure-three-tier/blob/main/cozynest/app.py): `cozynest/app.py`
- **Azure SQL**
- **Azure Key Vault**

### Order processing

- [Checkout](https://github.com/fenil5456/cozynest-azure-three-tier/blob/main/cozynest/app.py): `cozynest/app.py`
- [Order API client](https://github.com/fenil5456/cozynest-azure-three-tier/blob/main/cozynest/app.py): `cozynest/app.py`
- [Order processing API](https://github.com/fenil5456/cozynest-azure-three-tier/blob/main/vm-order-api/order_api.py): `vm-order-api/order_api.py`
- [Order confirmation](https://github.com/fenil5456/cozynest-azure-three-tier/blob/main/cozynest/app.py): `cozynest/app.py`

### Product media

- **Azure Blob Storage**
- [Image serving](https://github.com/fenil5456/cozynest-azure-three-tier/blob/main/cozynest/app.py): `cozynest/app.py`
- [Placeholder image generator](https://github.com/fenil5456/cozynest-azure-three-tier/blob/main/cozynest/generate_images.py): `cozynest/generate_images.py`

### Other components

- **Shopper**

## Connections

- Shopper → Flask storefront: uses (evidence: `cozynest/app.py`)
- Flask storefront → Product browsing: routes to (evidence: `cozynest/app.py`)
- Product browsing → Catalog access: loads products (evidence: `cozynest/app.py`)
- Product browsing → Storefront templates: renders pages (evidence: `cozynest/app.py`)
- Shopper → Product detail: opens product (evidence: `cozynest/app.py`)
- Product detail → Catalog access: loads product (evidence: `cozynest/app.py`)
- Shopper → Session cart: updates (evidence: `cozynest/app.py`)
- Cart totals → Session cart: reads (evidence: `cozynest/app.py`)
- Cart totals → Catalog access: looks up items (evidence: `cozynest/app.py`)
- Checkout → Cart totals: calculates total (evidence: `cozynest/app.py`)
- Checkout → Order API client: submits order (evidence: `cozynest/app.py`)
- Order API client → Order processing API: posts order (evidence: `cozynest/app.py`)
- Order processing API → Order API client: returns confirmation (evidence: `vm-order-api/order_api.py`)
- Checkout → Order confirmation: records result (evidence: `cozynest/app.py`)
- Order confirmation → Storefront templates: renders success (evidence: `cozynest/app.py`)
- Catalog access → Local sample products: reads locally (evidence: `cozynest/app.py`)
- Catalog access → Azure SQL: queries when configured (evidence: `cozynest/app.py`)
- Catalog access → Azure Key Vault: gets secrets (evidence: `cozynest/app.py`)
- Image serving → Azure Blob Storage: downloads image (evidence: `cozynest/app.py`)
- Image serving → Azure Key Vault: uses credentials (evidence: `cozynest/app.py`)
- Shopper → Image serving: requests image (evidence: `cozynest/app.py`)
- Placeholder image generator → Storefront templates: creates placeholders (evidence: `cozynest/generate_images.py`)
