# alexolimpio/canecas-shop architecture

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

- Interactive diagram: https://gitdiagram.com/alexolimpio/canecas-shop
- Repository: https://github.com/alexolimpio/canecas-shop

## Overview

Canecas Shop is a Flask storefront for personalized mugs. A shopper browses the catalog, selects an in-stock variant, manages a session-backed cart, submits delivery details at checkout, and views a session-protected order confirmation. The main layers are Flask routes and Jinja pages, business services, and PostgreSQL data access. The README documents catalog, cart, and checkout capabilities; source excerpts show the route/service calls and persistence operations. Template-to-route form submissions are documented by the README’s route table; other unsampled template behavior is not inferred.

Main entry points: [`app.py`](https://github.com/alexolimpio/canecas-shop/blob/main/app.py) (Flask routes), [`database/db.py`](https://github.com/alexolimpio/canecas-shop/blob/main/database/db.py) (Database access), [`services/produto_service.py`](https://github.com/alexolimpio/canecas-shop/blob/main/services/produto_service.py) (Product catalog), [`services/carrinho_service.py`](https://github.com/alexolimpio/canecas-shop/blob/main/services/carrinho_service.py) (Cart rules)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_presentation["Storefront presentation"]
  node_flask["Flask routes<br/>[app.py]"]
  node_catalog_page["Catalog page<br/>[index.html]"]
  node_product_page["Product detail<br/>[produto.html]"]
  node_cart_page["Cart page<br/>[carrinho.html]"]
  node_checkout_page["Checkout page<br/>[checkout.html]"]
  node_confirmation_page["Confirmation page<br/>[confirmacao.html]"]
end

subgraph group_business["Business services"]
  node_product_service["Product catalog<br/>[produto_service.py]"]
  node_cart_service["Cart rules"]
  node_order_service["Order checkout<br/>[pedido_service.py]"]
end

subgraph group_data["Data access"]
  node_data_access["Database access<br/>[db.py]"]
end

node_shopper(("Shopper"))
node_postgres[("PostgreSQL")]

node_shopper -->|"sends requests"| node_flask
node_flask -->|"renders"| node_catalog_page
node_flask -->|"renders"| node_product_page
node_flask -->|"renders"| node_cart_page
node_flask -->|"renders"| node_checkout_page
node_flask -->|"renders"| node_confirmation_page
node_flask -->|"requests catalog"| node_product_service
node_flask -->|"manages cart"| node_cart_service
node_flask -->|"processes checkout"| node_order_service
node_flask -->|"initializes schema"| node_data_access
node_product_service -->|"queries products"| node_data_access
node_cart_service -->|"checks variants"| node_data_access
node_order_service -->|"creates and reads orders"| node_data_access
node_data_access -->|"reads and writes"| node_postgres

click node_flask "https://github.com/alexolimpio/canecas-shop/blob/main/app.py"
click node_catalog_page "https://github.com/alexolimpio/canecas-shop/blob/main/templates/index.html"
click node_product_page "https://github.com/alexolimpio/canecas-shop/blob/main/templates/produto.html"
click node_cart_page "https://github.com/alexolimpio/canecas-shop/blob/main/templates/carrinho.html"
click node_checkout_page "https://github.com/alexolimpio/canecas-shop/blob/main/templates/checkout.html"
click node_confirmation_page "https://github.com/alexolimpio/canecas-shop/blob/main/templates/confirmacao.html"
click node_product_service "https://github.com/alexolimpio/canecas-shop/blob/main/services/produto_service.py"
click node_cart_service "https://github.com/alexolimpio/canecas-shop/blob/main/services/carrinho_service.py"
click node_order_service "https://github.com/alexolimpio/canecas-shop/blob/main/services/pedido_service.py"
click node_data_access "https://github.com/alexolimpio/canecas-shop/blob/main/database/db.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_catalog_page,node_product_page,node_cart_page,node_checkout_page,node_confirmation_page toneBlue
class node_product_service,node_cart_service,node_order_service,node_postgres toneAmber
class node_data_access toneMint
class node_shopper toneIndigo
```

## Components

### Storefront presentation

- [Flask routes](https://github.com/alexolimpio/canecas-shop/blob/main/app.py): `app.py`
- [Catalog page](https://github.com/alexolimpio/canecas-shop/blob/main/templates/index.html): `templates/index.html`
- [Product detail](https://github.com/alexolimpio/canecas-shop/blob/main/templates/produto.html): `templates/produto.html`
- [Cart page](https://github.com/alexolimpio/canecas-shop/blob/main/templates/carrinho.html): `templates/carrinho.html`
- [Checkout page](https://github.com/alexolimpio/canecas-shop/blob/main/templates/checkout.html): `templates/checkout.html`
- [Confirmation page](https://github.com/alexolimpio/canecas-shop/blob/main/templates/confirmacao.html): `templates/confirmacao.html`

### Business services

- [Product catalog](https://github.com/alexolimpio/canecas-shop/blob/main/services/produto_service.py): `services/produto_service.py`
- [Cart rules](https://github.com/alexolimpio/canecas-shop/blob/main/services/carrinho_service.py): `services/carrinho_service.py`
- [Order checkout](https://github.com/alexolimpio/canecas-shop/blob/main/services/pedido_service.py): `services/pedido_service.py`

### Data access

- [Database access](https://github.com/alexolimpio/canecas-shop/blob/main/database/db.py): `database/db.py`

### Other components

- **Shopper**
- **PostgreSQL**

## Connections

- Shopper → Flask routes: sends requests (evidence: `README.md`)
- Flask routes → Catalog page: renders (evidence: `app.py`)
- Flask routes → Product detail: renders (evidence: `app.py`)
- Flask routes → Cart page: renders (evidence: `app.py`)
- Flask routes → Checkout page: renders (evidence: `app.py`)
- Flask routes → Confirmation page: renders (evidence: `app.py`)
- Flask routes → Product catalog: requests catalog (evidence: `app.py`)
- Flask routes → Cart rules: manages cart (evidence: `app.py`)
- Flask routes → Order checkout: processes checkout (evidence: `app.py`)
- Flask routes → Database access: initializes schema (evidence: `app.py`)
- Product catalog → Database access: queries products (evidence: `services/produto_service.py`)
- Cart rules → Database access: checks variants (evidence: `services/carrinho_service.py`)
- Order checkout → Database access: creates and reads orders (evidence: `services/pedido_service.py`)
- Database access → PostgreSQL: reads and writes (evidence: `README.md`)
