# albinondjonale/sgv architecture

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

- Interactive diagram: https://gitdiagram.com/albinondjonale/sgv
- Repository: https://github.com/albinondjonale/sgv

## Overview

SGV is a desktop sales and inventory management application. A user signs in; the application creates a configured database connection and, on successful login, presents pages according to the user’s admin status. The main product areas cover sales/home workflows, product management, sales records and reporting, and seller administration. Shared query, configuration, logging, and UI components support those workflows. The excerpts establish several module dependencies, but omit some page wiring and database path selection, so uncertain links are left unverified.

Main entry points: [`sgv/main.py`](https://github.com/albinondjonale/sgv/blob/main/sgv/main.py) (Desktop shell), [`sgv/qbuilder/__init__.py`](https://github.com/albinondjonale/sgv/blob/main/sgv/qbuilder/__init__.py) (Query builder), [`sgv/pages/produto.py`](https://github.com/albinondjonale/sgv/blob/main/sgv/pages/produto.py) (Product management), [`sgv/pages/vendas.py`](https://github.com/albinondjonale/sgv/blob/main/sgv/pages/vendas.py) (Sales records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Application entry"]
  node_desktop["Desktop shell<br/>[main.py]"]
  node_qt_app["Qt application<br/>[app.py]"]
  node_login["Login and access<br/>[main.py]"]
end

subgraph group_workflows["Business workflows"]
  node_home["Home and checkout<br/>[home.py]"]
  node_products["Product management<br/>[produto.py]"]
  node_sales["Sales records<br/>[vendas.py]"]
  node_sellers["Seller management<br/>[vendedor.py]"]
end

subgraph group_shared["Shared services"]
  node_db_config["Database settings<br/>[edit_configs.py]"]
  node_config_read["Read settings<br/>[read_configs.py]"]
  node_user_edit["Edit user<br/>[edit_user.py]"]
  node_logging["Activity logs<br/>[save_log.py]"]
  node_crypto["Config encryption<br/>[cript.py]"]
  node_table["Data table UI<br/>[table.py]"]
  node_wait["Wait indicator<br/>[wait.py]"]
  node_number["Number formatting<br/>[formatnumber.py]"]
end

subgraph group_persistence["Persistence"]
  node_query["Query builder<br/>[__init__.py]"]
  node_database[("Configured database<br/>[svg.db]")]
end

node_user(("User"))
node_mysql[("MySQL service")]

node_user -->|"uses"| node_desktop
node_desktop -->|"initializes"| node_qt_app
node_desktop -->|"hosts"| node_login
node_login -->|"reads settings"| node_config_read
node_login -->|"creates connection"| node_query
node_desktop -->|"opens settings"| node_db_config
node_desktop -->|"opens editor"| node_user_edit
node_desktop -->|"shows during login"| node_wait
node_desktop -.->|"routes after login"| node_home
node_desktop -.->|"routes after login"| node_products
node_desktop -.->|"routes after login"| node_sales
node_desktop -.->|"routes after login"| node_sellers
node_home -->|"reads and writes"| node_query
node_products -->|"reads and writes"| node_query
node_sales -->|"reads records"| node_query
node_sellers -->|"reads and writes"| node_query
node_products -->|"records changes"| node_logging
node_sales -.->|"records activity"| node_logging
node_sellers -->|"records changes"| node_logging
node_sales -->|"formats totals"| node_number
node_products -->|"formats prices"| node_number
node_home -->|"displays rows"| node_table
node_products -->|"displays rows"| node_table
node_sales -->|"displays rows"| node_table
node_sellers -->|"displays rows"| node_table
node_db_config -->|"uses settings"| node_config_read
node_db_config -->|"encrypts values"| node_crypto
node_config_read -->|"decrypts values"| node_crypto
node_logging -->|"stores log entries"| node_query
node_query -.->|"uses SQLite file"| node_database
node_query -.->|"supports MySQL"| node_mysql

click node_desktop "https://github.com/albinondjonale/sgv/blob/main/sgv/main.py"
click node_qt_app "https://github.com/albinondjonale/sgv/blob/main/sgv/app.py"
click node_login "https://github.com/albinondjonale/sgv/blob/main/sgv/main.py"
click node_home "https://github.com/albinondjonale/sgv/blob/main/sgv/pages/home.py"
click node_products "https://github.com/albinondjonale/sgv/blob/main/sgv/pages/produto.py"
click node_sales "https://github.com/albinondjonale/sgv/blob/main/sgv/pages/vendas.py"
click node_sellers "https://github.com/albinondjonale/sgv/blob/main/sgv/pages/vendedor.py"
click node_query "https://github.com/albinondjonale/sgv/blob/main/sgv/qbuilder/__init__.py"
click node_database "https://github.com/albinondjonale/sgv/blob/main/sgv/db/svg.db"
click node_db_config "https://github.com/albinondjonale/sgv/blob/main/sgv/edit_configs.py"
click node_config_read "https://github.com/albinondjonale/sgv/blob/main/sgv/read_configs.py"
click node_user_edit "https://github.com/albinondjonale/sgv/blob/main/sgv/edit_user.py"
click node_logging "https://github.com/albinondjonale/sgv/blob/main/sgv/save_log.py"
click node_crypto "https://github.com/albinondjonale/sgv/blob/main/sgv/cript.py"
click node_table "https://github.com/albinondjonale/sgv/blob/main/sgv/components/table.py"
click node_wait "https://github.com/albinondjonale/sgv/blob/main/sgv/components/wait.py"
click node_number "https://github.com/albinondjonale/sgv/blob/main/sgv/formatnumber.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_desktop,node_qt_app,node_login,node_user toneBlue
class node_home,node_products,node_sales,node_sellers,node_mysql toneAmber
class node_db_config,node_config_read,node_user_edit,node_logging,node_crypto,node_table,node_wait,node_number toneMint
class node_query,node_database toneRose
```

## Components

### Application entry

- [Desktop shell](https://github.com/albinondjonale/sgv/blob/main/sgv/main.py): `sgv/main.py`
- [Qt application](https://github.com/albinondjonale/sgv/blob/main/sgv/app.py): `sgv/app.py`
- [Login and access](https://github.com/albinondjonale/sgv/blob/main/sgv/main.py): `sgv/main.py`

### Business workflows

- [Home and checkout](https://github.com/albinondjonale/sgv/blob/main/sgv/pages/home.py): `sgv/pages/home.py`
- [Product management](https://github.com/albinondjonale/sgv/blob/main/sgv/pages/produto.py): `sgv/pages/produto.py`
- [Sales records](https://github.com/albinondjonale/sgv/blob/main/sgv/pages/vendas.py): `sgv/pages/vendas.py`
- [Seller management](https://github.com/albinondjonale/sgv/blob/main/sgv/pages/vendedor.py): `sgv/pages/vendedor.py`

### Shared services

- [Database settings](https://github.com/albinondjonale/sgv/blob/main/sgv/edit_configs.py): `sgv/edit_configs.py`
- [Read settings](https://github.com/albinondjonale/sgv/blob/main/sgv/read_configs.py): `sgv/read_configs.py`
- [Edit user](https://github.com/albinondjonale/sgv/blob/main/sgv/edit_user.py): `sgv/edit_user.py`
- [Activity logs](https://github.com/albinondjonale/sgv/blob/main/sgv/save_log.py): `sgv/save_log.py`
- [Config encryption](https://github.com/albinondjonale/sgv/blob/main/sgv/cript.py): `sgv/cript.py`
- [Data table UI](https://github.com/albinondjonale/sgv/blob/main/sgv/components/table.py): `sgv/components/table.py`
- [Wait indicator](https://github.com/albinondjonale/sgv/blob/main/sgv/components/wait.py): `sgv/components/wait.py`
- [Number formatting](https://github.com/albinondjonale/sgv/blob/main/sgv/formatnumber.py): `sgv/formatnumber.py`

### Persistence

- [Query builder](https://github.com/albinondjonale/sgv/blob/main/sgv/qbuilder/__init__.py): `sgv/qbuilder/__init__.py`
- [Configured database](https://github.com/albinondjonale/sgv/blob/main/sgv/db/svg.db): `sgv/db/svg.db`

### Other components

- **User**
- **MySQL service**

## Connections

- User → Desktop shell: uses (evidence: `README.md`)
- Desktop shell → Qt application: initializes (evidence: `sgv/main.py`)
- Desktop shell → Login and access: hosts (evidence: `sgv/main.py`)
- Login and access → Read settings: reads settings (evidence: `sgv/main.py`)
- Login and access → Query builder: creates connection (evidence: `sgv/main.py`)
- Desktop shell → Database settings: opens settings (evidence: `sgv/main.py`)
- Desktop shell → Edit user: opens editor (evidence: `sgv/main.py`)
- Desktop shell → Wait indicator: shows during login (evidence: `sgv/main.py`)
- Desktop shell → Home and checkout: routes after login
- Desktop shell → Product management: routes after login
- Desktop shell → Sales records: routes after login
- Desktop shell → Seller management: routes after login
- Home and checkout → Query builder: reads and writes (evidence: `sgv/pages/home.py`)
- Product management → Query builder: reads and writes (evidence: `sgv/pages/produto.py`)
- Sales records → Query builder: reads records (evidence: `sgv/pages/vendas.py`)
- Seller management → Query builder: reads and writes (evidence: `sgv/pages/vendedor.py`)
- Product management → Activity logs: records changes (evidence: `sgv/pages/produto.py`)
- Sales records → Activity logs: records activity
- Seller management → Activity logs: records changes (evidence: `sgv/pages/vendedor.py`)
- Sales records → Number formatting: formats totals (evidence: `sgv/pages/vendas.py`)
- Product management → Number formatting: formats prices (evidence: `sgv/pages/produto.py`)
- Home and checkout → Data table UI: displays rows (evidence: `sgv/pages/home.py`)
- Product management → Data table UI: displays rows (evidence: `sgv/pages/produto.py`)
- Sales records → Data table UI: displays rows (evidence: `sgv/pages/vendas.py`)
- Seller management → Data table UI: displays rows (evidence: `sgv/pages/vendedor.py`)
- Database settings → Read settings: uses settings (evidence: `sgv/edit_configs.py`)
- Database settings → Config encryption: encrypts values (evidence: `sgv/edit_configs.py`)
- Read settings → Config encryption: decrypts values (evidence: `sgv/read_configs.py`)
- Activity logs → Query builder: stores log entries (evidence: `sgv/save_log.py`)
- Query builder → Configured database: uses SQLite file
- Query builder → MySQL service: supports MySQL (evidence: `README.md`)
