# yankibtw/online-store architecture

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

- Interactive diagram: https://gitdiagram.com/yankibtw/online-store
- Repository: https://github.com/yankibtw/online-store

## Overview

This is a Crow-based clothing storefront: shoppers browse products, authenticate, build a cart, submit an order, and revisit order history. The backend separates HTTP controllers from managers and PostgreSQL access; browser templates and JavaScript provide the storefront UI. The README also names wishlist and review functionality. Edges from main to controllers and from sampled controllers to managers are supported by source references or excerpts; browser/API wiring and several unsampled controller-to-manager calls are not shown, so those relationships are omitted rather than inferred.

Main entry points: [`src/main.cpp`](https://github.com/yankibtw/online-store/blob/main/src/main.cpp) (Crow Server), [`src/dbb.cpp`](https://github.com/yankibtw/online-store/blob/main/src/dbb.cpp) (Database Connection), [`src/user_manager.cpp`](https://github.com/yankibtw/online-store/blob/main/src/user_manager.cpp) (User and Sessions), [`src/controllers/cart_controller.cpp`](https://github.com/yankibtw/online-store/blob/main/src/controllers/cart_controller.cpp) (Cart Routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Storefront UI"]
  node_templates["Storefront Pages"]
  node_browserjs["Storefront Scripts"]
end

subgraph group_http["HTTP Controllers"]
  node_server["Crow Server<br/>[main.cpp]"]
  node_authctl["Authentication Routes"]
  node_productctl["Product Routes"]
  node_pagectl["Page Routes"]
  node_cartctl["Cart Routes"]
  node_orderctl["Order and Review Routes"]
  node_wishlistctl["Wishlist Routes"]
end

subgraph group_domain["Commerce Services"]
  node_users["User and Sessions<br/>[user_manager.cpp]"]
  node_products["Product Catalog"]
  node_cart["Cart Management<br/>[cart_manager.cpp]"]
  node_orders["Orders and Reviews<br/>[order_manager.cpp]"]
  node_wishlist["Wishlist Management"]
end

subgraph group_storage["Persistence"]
  node_database[("Database Connection<br/>[dbb.cpp]")]
end

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

node_shopper -.->|"views"| node_templates
node_templates -.->|"loads scripts"| node_browserjs
node_browserjs -.->|"requests APIs"| node_server
node_server -->|"registers routes"| node_authctl
node_server -->|"registers routes"| node_productctl
node_server -->|"registers routes"| node_cartctl
node_server -->|"registers routes"| node_wishlistctl
node_server -->|"registers routes"| node_orderctl
node_server -->|"registers routes"| node_pagectl
node_cartctl -->|"calls cart operations"| node_cart
node_orderctl -->|"creates and reads"| node_orders
node_orderctl -->|"checks sessions"| node_users
node_cartctl -->|"checks sessions"| node_users
node_authctl -.->|"handles identity"| node_users
node_productctl -.->|"serves catalog"| node_products
node_wishlistctl -.->|"manages favorites"| node_wishlist
node_cart -->|"uses connection"| node_database
node_products -->|"queries products"| node_database
node_orders -.->|"uses connection"| node_database
node_users -.->|"uses connection"| node_database
node_wishlist -->|"uses connection"| node_database
node_database -.->|"connects"| node_postgres

click node_templates "https://github.com/yankibtw/online-store/tree/main/templates"
click node_browserjs "https://github.com/yankibtw/online-store/tree/main/static/js"
click node_server "https://github.com/yankibtw/online-store/blob/main/src/main.cpp"
click node_authctl "https://github.com/yankibtw/online-store/blob/main/src/controllers/auth_controller.cpp"
click node_productctl "https://github.com/yankibtw/online-store/blob/main/src/controllers/product_controller.cpp"
click node_pagectl "https://github.com/yankibtw/online-store/blob/main/src/controllers/page_controller.cpp"
click node_cartctl "https://github.com/yankibtw/online-store/blob/main/src/controllers/cart_controller.cpp"
click node_orderctl "https://github.com/yankibtw/online-store/blob/main/src/controllers/order_controller.cpp"
click node_wishlistctl "https://github.com/yankibtw/online-store/blob/main/src/controllers/wishlist_controller.cpp"
click node_users "https://github.com/yankibtw/online-store/blob/main/src/user_manager.cpp"
click node_products "https://github.com/yankibtw/online-store/blob/main/src/product_manager.cpp"
click node_cart "https://github.com/yankibtw/online-store/blob/main/src/cart_manager.cpp"
click node_orders "https://github.com/yankibtw/online-store/blob/main/src/order_manager.cpp"
click node_wishlist "https://github.com/yankibtw/online-store/blob/main/src/wishlist_manager.cpp"
click node_database "https://github.com/yankibtw/online-store/blob/main/src/dbb.cpp"

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_templates,node_browserjs toneBlue
class node_server,node_authctl,node_productctl,node_pagectl,node_cartctl,node_orderctl,node_wishlistctl,node_postgres toneAmber
class node_users,node_products,node_cart,node_orders,node_wishlist toneMint
class node_database toneRose
class node_shopper toneIndigo
```

## Components

### Storefront UI

- [Storefront Pages](https://github.com/yankibtw/online-store/tree/main/templates): `templates`
- [Storefront Scripts](https://github.com/yankibtw/online-store/tree/main/static/js): `static/js`

### HTTP Controllers

- [Crow Server](https://github.com/yankibtw/online-store/blob/main/src/main.cpp): `src/main.cpp`
- [Authentication Routes](https://github.com/yankibtw/online-store/blob/main/src/controllers/auth_controller.cpp): `src/controllers/auth_controller.cpp`
- [Product Routes](https://github.com/yankibtw/online-store/blob/main/src/controllers/product_controller.cpp): `src/controllers/product_controller.cpp`
- [Page Routes](https://github.com/yankibtw/online-store/blob/main/src/controllers/page_controller.cpp): `src/controllers/page_controller.cpp`
- [Cart Routes](https://github.com/yankibtw/online-store/blob/main/src/controllers/cart_controller.cpp): `src/controllers/cart_controller.cpp`
- [Order and Review Routes](https://github.com/yankibtw/online-store/blob/main/src/controllers/order_controller.cpp): `src/controllers/order_controller.cpp`
- [Wishlist Routes](https://github.com/yankibtw/online-store/blob/main/src/controllers/wishlist_controller.cpp): `src/controllers/wishlist_controller.cpp`

### Commerce Services

- [User and Sessions](https://github.com/yankibtw/online-store/blob/main/src/user_manager.cpp): `src/user_manager.cpp`
- [Product Catalog](https://github.com/yankibtw/online-store/blob/main/src/product_manager.cpp): `src/product_manager.cpp`
- [Cart Management](https://github.com/yankibtw/online-store/blob/main/src/cart_manager.cpp): `src/cart_manager.cpp`
- [Orders and Reviews](https://github.com/yankibtw/online-store/blob/main/src/order_manager.cpp): `src/order_manager.cpp`
- [Wishlist Management](https://github.com/yankibtw/online-store/blob/main/src/wishlist_manager.cpp): `src/wishlist_manager.cpp`

### Persistence

- [Database Connection](https://github.com/yankibtw/online-store/blob/main/src/dbb.cpp): `src/dbb.cpp`

### Other components

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

## Connections

- Shopper → Storefront Pages: views
- Storefront Pages → Storefront Scripts: loads scripts
- Storefront Scripts → Crow Server: requests APIs
- Crow Server → Authentication Routes: registers routes (evidence: `src/main.cpp`)
- Crow Server → Product Routes: registers routes (evidence: `src/main.cpp`)
- Crow Server → Cart Routes: registers routes (evidence: `src/main.cpp`)
- Crow Server → Wishlist Routes: registers routes (evidence: `src/main.cpp`)
- Crow Server → Order and Review Routes: registers routes (evidence: `src/main.cpp`)
- Crow Server → Page Routes: registers routes (evidence: `src/main.cpp`)
- Cart Routes → Cart Management: calls cart operations (evidence: `src/controllers/cart_controller.cpp`)
- Order and Review Routes → Orders and Reviews: creates and reads (evidence: `src/controllers/order_controller.cpp`)
- Order and Review Routes → User and Sessions: checks sessions (evidence: `src/controllers/order_controller.cpp`)
- Cart Routes → User and Sessions: checks sessions (evidence: `src/controllers/cart_controller.cpp`)
- Authentication Routes → User and Sessions: handles identity
- Product Routes → Product Catalog: serves catalog
- Wishlist Routes → Wishlist Management: manages favorites
- Cart Management → Database Connection: uses connection (evidence: `src/cart_manager.cpp`)
- Product Catalog → Database Connection: queries products (evidence: `src/product_manager.cpp`)
- Orders and Reviews → Database Connection: uses connection
- User and Sessions → Database Connection: uses connection
- Wishlist Management → Database Connection: uses connection (evidence: `src/wishlist_manager.cpp`)
- Database Connection → PostgreSQL: connects
