# itu-dasyalab/introdb-coffeeshop-python architecture

> Architecture diagram of the GitHub repository itu-dasyalab/introdb-coffeeshop-python, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/itu-dasyalab/introdb-coffeeshop-python
- Repository: https://github.com/itu-dasyalab/introdb-coffeeshop-python

## Overview

Coffee Shop is a small web app for browsing products, registering and logging in, buying drinks, and reviewing purchase history. Users interact with static pages; shared browser helpers send requests to a FastAPI backend, which reads and writes DuckDB. The documented workflow spans authentication, catalog browsing, purchasing, and history, though registration, purchase insertion, and personal-history retrieval are TODO stubs in the sampled backend. The README documents the frontend/API arrangement; backend-to-database edges below reflect only queries visible in the excerpt.

Main entry points: [`web/app.js`](https://github.com/itu-dasyalab/introdb-coffeeshop-python/blob/main/web/app.js) (Client helpers), [`init.sql`](https://github.com/itu-dasyalab/introdb-coffeeshop-python/blob/main/init.sql) (DuckDB store), [`web/index.html`](https://github.com/itu-dasyalab/introdb-coffeeshop-python/blob/main/web/index.html) (Home page), [`web/login.html`](https://github.com/itu-dasyalab/introdb-coffeeshop-python/blob/main/web/login.html) (Login page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web frontend"]
  node_home["Home page<br/>[index.html]"]
  node_login_page["Login page<br/>[login.html]"]
  node_register_page["Registration page<br/>[register.html]"]
  node_products_page["Products page<br/>[products.html]"]
  node_purchases_page["Purchase history<br/>[purchases.html]"]
  node_my_purchases_page["My purchases<br/>[mypurchases.html]"]
  node_client_helpers["Client helpers<br/>[app.js]"]
end

subgraph group_backend["API backend"]
  node_auth_api["Authentication API<br/>[app.py]"]
  node_catalog_api["Product API<br/>[app.py]"]
  node_purchase_api["Purchase API<br/>[app.py]"]
  node_history_api["History API<br/>[app.py]"]
end

subgraph group_data["Data layer"]
  node_duckdb[("DuckDB store<br/>[init.sql]")]
end

node_shopper(("Shopper"))

node_shopper -->|"uses"| node_home
node_shopper -->|"logs in"| node_login_page
node_shopper -->|"registers"| node_register_page
node_shopper -->|"browses"| node_products_page
node_shopper -->|"views history"| node_purchases_page
node_shopper -->|"views purchases"| node_my_purchases_page
node_home -->|"uses"| node_client_helpers
node_login_page -->|"uses"| node_client_helpers
node_register_page -->|"uses"| node_client_helpers
node_products_page -->|"uses"| node_client_helpers
node_purchases_page -->|"uses"| node_client_helpers
node_my_purchases_page -->|"uses"| node_client_helpers
node_client_helpers -->|"sends requests"| node_auth_api
node_client_helpers -->|"sends requests"| node_catalog_api
node_client_helpers -->|"sends requests"| node_purchase_api
node_client_helpers -->|"sends requests"| node_history_api
node_auth_api -->|"queries"| node_duckdb
node_catalog_api -->|"reads products"| node_duckdb
node_history_api -->|"reads purchases"| node_duckdb

click node_home "https://github.com/itu-dasyalab/introdb-coffeeshop-python/blob/main/web/index.html"
click node_login_page "https://github.com/itu-dasyalab/introdb-coffeeshop-python/blob/main/web/login.html"
click node_register_page "https://github.com/itu-dasyalab/introdb-coffeeshop-python/blob/main/web/register.html"
click node_products_page "https://github.com/itu-dasyalab/introdb-coffeeshop-python/blob/main/web/products.html"
click node_purchases_page "https://github.com/itu-dasyalab/introdb-coffeeshop-python/blob/main/web/purchases.html"
click node_my_purchases_page "https://github.com/itu-dasyalab/introdb-coffeeshop-python/blob/main/web/mypurchases.html"
click node_client_helpers "https://github.com/itu-dasyalab/introdb-coffeeshop-python/blob/main/web/app.js"
click node_auth_api "https://github.com/itu-dasyalab/introdb-coffeeshop-python/blob/main/app.py"
click node_catalog_api "https://github.com/itu-dasyalab/introdb-coffeeshop-python/blob/main/app.py"
click node_purchase_api "https://github.com/itu-dasyalab/introdb-coffeeshop-python/blob/main/app.py"
click node_history_api "https://github.com/itu-dasyalab/introdb-coffeeshop-python/blob/main/app.py"
click node_duckdb "https://github.com/itu-dasyalab/introdb-coffeeshop-python/blob/main/init.sql"

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_home,node_login_page,node_register_page,node_products_page,node_purchases_page,node_my_purchases_page,node_client_helpers toneBlue
class node_auth_api,node_catalog_api,node_purchase_api,node_history_api toneAmber
class node_duckdb toneMint
class node_shopper toneIndigo
```

## Components

### Web frontend

- [Home page](https://github.com/itu-dasyalab/introdb-coffeeshop-python/blob/main/web/index.html): `web/index.html`
- [Login page](https://github.com/itu-dasyalab/introdb-coffeeshop-python/blob/main/web/login.html): `web/login.html`
- [Registration page](https://github.com/itu-dasyalab/introdb-coffeeshop-python/blob/main/web/register.html): `web/register.html`
- [Products page](https://github.com/itu-dasyalab/introdb-coffeeshop-python/blob/main/web/products.html): `web/products.html`
- [Purchase history](https://github.com/itu-dasyalab/introdb-coffeeshop-python/blob/main/web/purchases.html): `web/purchases.html`
- [My purchases](https://github.com/itu-dasyalab/introdb-coffeeshop-python/blob/main/web/mypurchases.html): `web/mypurchases.html`
- [Client helpers](https://github.com/itu-dasyalab/introdb-coffeeshop-python/blob/main/web/app.js): `web/app.js`

### API backend

- [Authentication API](https://github.com/itu-dasyalab/introdb-coffeeshop-python/blob/main/app.py): `app.py`
- [Product API](https://github.com/itu-dasyalab/introdb-coffeeshop-python/blob/main/app.py): `app.py`
- [Purchase API](https://github.com/itu-dasyalab/introdb-coffeeshop-python/blob/main/app.py): `app.py`
- [History API](https://github.com/itu-dasyalab/introdb-coffeeshop-python/blob/main/app.py): `app.py`

### Data layer

- [DuckDB store](https://github.com/itu-dasyalab/introdb-coffeeshop-python/blob/main/init.sql): `init.sql`

### Other components

- **Shopper**

## Connections

- Shopper → Home page: uses (evidence: `README.md`)
- Shopper → Login page: logs in (evidence: `README.md`)
- Shopper → Registration page: registers (evidence: `README.md`)
- Shopper → Products page: browses (evidence: `README.md`)
- Shopper → Purchase history: views history (evidence: `README.md`)
- Shopper → My purchases: views purchases (evidence: `README.md`)
- Home page → Client helpers: uses (evidence: `README.md`)
- Login page → Client helpers: uses (evidence: `README.md`)
- Registration page → Client helpers: uses (evidence: `README.md`)
- Products page → Client helpers: uses (evidence: `README.md`)
- Purchase history → Client helpers: uses (evidence: `README.md`)
- My purchases → Client helpers: uses (evidence: `README.md`)
- Client helpers → Authentication API: sends requests (evidence: `web/app.js`)
- Client helpers → Product API: sends requests (evidence: `README.md`)
- Client helpers → Purchase API: sends requests (evidence: `README.md`)
- Client helpers → History API: sends requests (evidence: `README.md`)
- Authentication API → DuckDB store: queries (evidence: `app.py`)
- Product API → DuckDB store: reads products (evidence: `app.py`)
- History API → DuckDB store: reads purchases (evidence: `app.py`)
