# duonghuuthanh/cs2401saleapp architecture

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

- Interactive diagram: https://gitdiagram.com/duonghuuthanh/cs2401saleapp
- Repository: https://github.com/duonghuuthanh/cs2401saleapp

## Overview

This is a small Flask product-catalog application. A visitor requests the catalog; its route loads categories and products through the DAO, which queries the SQLAlchemy models, then renders the catalog template. The same route module serves login and registration pages, though no account-processing flow is shown. A separate Flask-Admin interface exposes category and product management. The application configures MySQL. Evidence is limited to the README and the shown source excerpts; no additional behavior is inferred.

Main entry points: [`saleapp/eapp/index.py`](https://github.com/duonghuuthanh/cs2401saleapp/blob/main/saleapp/eapp/index.py) (Web routes), [`saleapp/eapp/models.py`](https://github.com/duonghuuthanh/cs2401saleapp/blob/main/saleapp/eapp/models.py) (Category and product models), [`saleapp/eapp/dao.py`](https://github.com/duonghuuthanh/cs2401saleapp/blob/main/saleapp/eapp/dao.py) (Catalog queries), [`saleapp/eapp/admin.py`](https://github.com/duonghuuthanh/cs2401saleapp/blob/main/saleapp/eapp/admin.py) (Admin interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web interface"]
  node_routes["Web routes<br/>[index.py]"]
  node_catalog_template["Catalog page<br/>[index.html]"]
  node_login_template["Login page<br/>[login.html]"]
  node_register_template["Registration page<br/>[register.html]"]
end

subgraph group_catalog["Catalog data"]
  node_dao["Catalog queries<br/>[dao.py]"]
  node_models["Category and product models<br/>[models.py]"]
  node_database[("MySQL database")]
end

subgraph group_management["Admin management"]
  node_admin["Admin interface<br/>[admin.py]"]
  node_app_setup["Flask and database setup<br/>[__init__.py]"]
end

node_visitor(("Visitor"))

node_visitor -->|"requests pages"| node_routes
node_routes -->|"loads catalog"| node_dao
node_routes -->|"renders catalog"| node_catalog_template
node_routes -->|"renders login"| node_login_template
node_routes -->|"renders registration"| node_register_template
node_dao -->|"queries models"| node_models
node_models -->|"maps entities"| node_database
node_app_setup -->|"configures connection"| node_database
node_admin -->|"registers model views"| node_models

click node_routes "https://github.com/duonghuuthanh/cs2401saleapp/blob/main/saleapp/eapp/index.py"
click node_catalog_template "https://github.com/duonghuuthanh/cs2401saleapp/blob/main/saleapp/eapp/templates/index.html"
click node_login_template "https://github.com/duonghuuthanh/cs2401saleapp/blob/main/saleapp/eapp/templates/login.html"
click node_register_template "https://github.com/duonghuuthanh/cs2401saleapp/blob/main/saleapp/eapp/templates/register.html"
click node_dao "https://github.com/duonghuuthanh/cs2401saleapp/blob/main/saleapp/eapp/dao.py"
click node_models "https://github.com/duonghuuthanh/cs2401saleapp/blob/main/saleapp/eapp/models.py"
click node_admin "https://github.com/duonghuuthanh/cs2401saleapp/blob/main/saleapp/eapp/admin.py"
click node_app_setup "https://github.com/duonghuuthanh/cs2401saleapp/blob/main/saleapp/eapp/__init__.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_routes,node_catalog_template,node_login_template,node_register_template toneBlue
class node_dao,node_models,node_database toneAmber
class node_admin,node_app_setup toneMint
class node_visitor toneIndigo
```

## Components

### Web interface

- [Web routes](https://github.com/duonghuuthanh/cs2401saleapp/blob/main/saleapp/eapp/index.py): `saleapp/eapp/index.py`
- [Catalog page](https://github.com/duonghuuthanh/cs2401saleapp/blob/main/saleapp/eapp/templates/index.html): `saleapp/eapp/templates/index.html`
- [Login page](https://github.com/duonghuuthanh/cs2401saleapp/blob/main/saleapp/eapp/templates/login.html): `saleapp/eapp/templates/login.html`
- [Registration page](https://github.com/duonghuuthanh/cs2401saleapp/blob/main/saleapp/eapp/templates/register.html): `saleapp/eapp/templates/register.html`

### Catalog data

- [Catalog queries](https://github.com/duonghuuthanh/cs2401saleapp/blob/main/saleapp/eapp/dao.py): `saleapp/eapp/dao.py`
- [Category and product models](https://github.com/duonghuuthanh/cs2401saleapp/blob/main/saleapp/eapp/models.py): `saleapp/eapp/models.py`
- **MySQL database**

### Admin management

- [Admin interface](https://github.com/duonghuuthanh/cs2401saleapp/blob/main/saleapp/eapp/admin.py): `saleapp/eapp/admin.py`
- [Flask and database setup](https://github.com/duonghuuthanh/cs2401saleapp/blob/main/saleapp/eapp/__init__.py): `saleapp/eapp/__init__.py`

### Other components

- **Visitor**

## Connections

- Visitor → Web routes: requests pages (evidence: `saleapp/eapp/index.py`)
- Web routes → Catalog queries: loads catalog (evidence: `saleapp/eapp/index.py`)
- Web routes → Catalog page: renders catalog (evidence: `saleapp/eapp/index.py`)
- Web routes → Login page: renders login (evidence: `saleapp/eapp/index.py`)
- Web routes → Registration page: renders registration (evidence: `saleapp/eapp/index.py`)
- Catalog queries → Category and product models: queries models (evidence: `saleapp/eapp/dao.py`)
- Category and product models → MySQL database: maps entities (evidence: `saleapp/eapp/models.py`)
- Flask and database setup → MySQL database: configures connection (evidence: `saleapp/eapp/__init__.py`)
- Admin interface → Category and product models: registers model views (evidence: `saleapp/eapp/admin.py`)
