# sebastiancardonass/monstersistem architecture

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

- Interactive diagram: https://gitdiagram.com/sebastiancardonass/monstersistem
- Repository: https://github.com/sebastiancardonass/monstersistem

## Overview

MONSTER is a multi-store Colombian technology-retail POS and administration system. Staff use its mobile-first browser app to manage catalog and stock, sell devices and products, and handle after-sale and financial operations; Flask JSON routes invoke domain services backed by PostgreSQL. The README also documents suppliers and debts, cash, reporting, loans, warranties, maintenance, alerts, device setup, configurable receipts and labels, and PWA installation. The graph preserves these capabilities, grouping unsampled services by their existing directory. Some internal links are omitted where excerpts and the source index do not establish the caller.

Main entry points: [`backend/routes`](https://github.com/sebastiancardonass/monstersistem/tree/main/backend/routes) (REST endpoints), [`backend/python/models.py`](https://github.com/sebastiancardonass/monstersistem/blob/main/backend/python/models.py) (Domain data models), [`backend/python/services/sales_service.py`](https://github.com/sebastiancardonass/monstersistem/blob/main/backend/python/services/sales_service.py) (POS and sales), [`backend/python/services/inventory_service.py`](https://github.com/sebastiancardonass/monstersistem/blob/main/backend/python/services/inventory_service.py) (Inventory and devices)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Browser experience"]
  node_webapp["POS and admin UI<br/>[app.js]"]
  node_salesui["Sales UI<br/>[sales.js]"]
  node_inventoryui["Inventory UI<br/>[inventory.js]"]
  node_debtsui["Debts UI<br/>[debts.js]"]
  node_pwa["Offline and PWA<br/>[sw.js]"]
end

subgraph group_api["API and access"]
  node_flask["Flask application<br/>[app.py]"]
  node_routes["REST endpoints"]
  node_auth["Authentication<br/>[auth_service.py]"]
  node_access["Auth and permissions<br/>[auth.py]"]
end

subgraph group_retail["Retail operations"]
  node_sales["POS and sales<br/>[sales_service.py]"]
  node_catalog["Catalog and codes<br/>[catalog_service.py]"]
  node_stock["Inventory and devices"]
  node_deviceid["Device identity<br/>[device_identity.py]"]
  node_aftercare["Service and warranty"]
  node_purchases["Purchases and suppliers"]
end

subgraph group_finance["Finance and insights"]
  node_debts["Debts and creditors<br/>[debt_service.py]"]
  node_cashcapital["Cash and capital"]
  node_loans["Loans<br/>[loan_service.py]"]
  node_insights["Dashboard and reports<br/>[report_service.py]"]
end

subgraph group_platform["Shared platform"]
  node_admin["Stores and settings<br/>[store_service.py]"]
  node_devicesetup["User devices<br/>[device_service.py]"]
  node_database["SQLAlchemy sessions<br/>[database.py]"]
  node_models["Domain data models<br/>[models.py]"]
  node_postgres[("PostgreSQL")]
end

node_staff(("Store staff"))

node_staff -->|"uses"| node_webapp
node_webapp -.->|"calls JSON API"| node_flask
node_staff -->|"runs checkout"| node_salesui
node_salesui -.->|"submits sale"| node_flask
node_staff -->|"manages stock"| node_inventoryui
node_staff -->|"manages debts"| node_debtsui
node_webapp -->|"installs offline"| node_pwa
node_flask -->|"registers"| node_routes
node_routes -->|"invokes"| node_auth
node_routes -->|"checks access"| node_access
node_routes -.->|"invokes"| node_sales
node_routes -->|"invokes"| node_stock
node_routes -->|"invokes"| node_aftercare
node_routes -->|"invokes"| node_catalog
node_routes -->|"invokes"| node_debts
node_routes -.->|"invokes"| node_purchases
node_routes -.->|"invokes"| node_cashcapital
node_routes -.->|"invokes"| node_loans
node_routes -.->|"invokes"| node_insights
node_routes -.->|"invokes"| node_admin
node_routes -.->|"invokes"| node_devicesetup
node_sales -->|"uses identity"| node_deviceid
node_stock -->|"uses identity"| node_deviceid
node_purchases -->|"uses identity"| node_deviceid
node_aftercare -->|"uses identity"| node_deviceid
node_sales -->|"uses purchase logic"| node_purchases
node_stock -->|"creates related debt"| node_debts
node_routes -->|"gets sessions"| node_database
node_database -->|"stores data"| node_postgres
node_sales -->|"reads and writes"| node_models
node_stock -->|"reads and writes"| node_models
node_debts -->|"reads and writes"| node_models
node_aftercare -->|"reads and writes"| node_models
node_catalog -->|"uses models"| node_models
node_insights -->|"queries data"| node_models
node_admin -->|"uses models"| node_models
node_loans -->|"uses models"| node_models

click node_webapp "https://github.com/sebastiancardonass/monstersistem/blob/main/frontend/js/app.js"
click node_salesui "https://github.com/sebastiancardonass/monstersistem/blob/main/frontend/js/sales.js"
click node_inventoryui "https://github.com/sebastiancardonass/monstersistem/blob/main/frontend/js/inventory.js"
click node_debtsui "https://github.com/sebastiancardonass/monstersistem/blob/main/frontend/js/debts.js"
click node_pwa "https://github.com/sebastiancardonass/monstersistem/blob/main/frontend/sw.js"
click node_flask "https://github.com/sebastiancardonass/monstersistem/blob/main/backend/python/app.py"
click node_routes "https://github.com/sebastiancardonass/monstersistem/tree/main/backend/routes"
click node_auth "https://github.com/sebastiancardonass/monstersistem/blob/main/backend/python/services/auth_service.py"
click node_access "https://github.com/sebastiancardonass/monstersistem/blob/main/backend/python/utils/auth.py"
click node_sales "https://github.com/sebastiancardonass/monstersistem/blob/main/backend/python/services/sales_service.py"
click node_catalog "https://github.com/sebastiancardonass/monstersistem/blob/main/backend/python/services/catalog_service.py"
click node_stock "https://github.com/sebastiancardonass/monstersistem/blob/main/backend/python/services/inventory_service.py"
click node_deviceid "https://github.com/sebastiancardonass/monstersistem/blob/main/backend/python/services/device_identity.py"
click node_aftercare "https://github.com/sebastiancardonass/monstersistem/tree/main/backend/python/services"
click node_purchases "https://github.com/sebastiancardonass/monstersistem/blob/main/backend/python/services/purchase_service.py"
click node_debts "https://github.com/sebastiancardonass/monstersistem/blob/main/backend/python/services/debt_service.py"
click node_cashcapital "https://github.com/sebastiancardonass/monstersistem/tree/main/backend/python/services"
click node_loans "https://github.com/sebastiancardonass/monstersistem/blob/main/backend/python/services/loan_service.py"
click node_insights "https://github.com/sebastiancardonass/monstersistem/blob/main/backend/python/services/report_service.py"
click node_admin "https://github.com/sebastiancardonass/monstersistem/blob/main/backend/python/services/store_service.py"
click node_devicesetup "https://github.com/sebastiancardonass/monstersistem/blob/main/backend/python/services/device_service.py"
click node_database "https://github.com/sebastiancardonass/monstersistem/blob/main/backend/python/database.py"
click node_models "https://github.com/sebastiancardonass/monstersistem/blob/main/backend/python/models.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_webapp,node_salesui,node_inventoryui,node_debtsui,node_pwa toneBlue
class node_flask,node_routes,node_auth,node_access toneAmber
class node_sales,node_catalog,node_stock,node_deviceid,node_aftercare,node_purchases toneMint
class node_debts,node_cashcapital,node_loans,node_insights toneRose
class node_admin,node_devicesetup,node_database,node_models,node_postgres,node_staff toneIndigo
```

## Components

### Browser experience

- [POS and admin UI](https://github.com/sebastiancardonass/monstersistem/blob/main/frontend/js/app.js): `frontend/js/app.js`
- [Sales UI](https://github.com/sebastiancardonass/monstersistem/blob/main/frontend/js/sales.js): `frontend/js/sales.js`
- [Inventory UI](https://github.com/sebastiancardonass/monstersistem/blob/main/frontend/js/inventory.js): `frontend/js/inventory.js`
- [Debts UI](https://github.com/sebastiancardonass/monstersistem/blob/main/frontend/js/debts.js): `frontend/js/debts.js`
- [Offline and PWA](https://github.com/sebastiancardonass/monstersistem/blob/main/frontend/sw.js): `frontend/sw.js`

### API and access

- [Flask application](https://github.com/sebastiancardonass/monstersistem/blob/main/backend/python/app.py): `backend/python/app.py`
- [REST endpoints](https://github.com/sebastiancardonass/monstersistem/tree/main/backend/routes): `backend/routes`
- [Authentication](https://github.com/sebastiancardonass/monstersistem/blob/main/backend/python/services/auth_service.py): `backend/python/services/auth_service.py`
- [Auth and permissions](https://github.com/sebastiancardonass/monstersistem/blob/main/backend/python/utils/auth.py): `backend/python/utils/auth.py`

### Retail operations

- [POS and sales](https://github.com/sebastiancardonass/monstersistem/blob/main/backend/python/services/sales_service.py): `backend/python/services/sales_service.py`
- [Catalog and codes](https://github.com/sebastiancardonass/monstersistem/blob/main/backend/python/services/catalog_service.py): `backend/python/services/catalog_service.py`
- [Inventory and devices](https://github.com/sebastiancardonass/monstersistem/blob/main/backend/python/services/inventory_service.py): `backend/python/services/inventory_service.py`
- [Device identity](https://github.com/sebastiancardonass/monstersistem/blob/main/backend/python/services/device_identity.py): `backend/python/services/device_identity.py`
- [Service and warranty](https://github.com/sebastiancardonass/monstersistem/tree/main/backend/python/services): `backend/python/services`
- [Purchases and suppliers](https://github.com/sebastiancardonass/monstersistem/blob/main/backend/python/services/purchase_service.py): `backend/python/services/purchase_service.py`

### Finance and insights

- [Debts and creditors](https://github.com/sebastiancardonass/monstersistem/blob/main/backend/python/services/debt_service.py): `backend/python/services/debt_service.py`
- [Cash and capital](https://github.com/sebastiancardonass/monstersistem/tree/main/backend/python/services): `backend/python/services`
- [Loans](https://github.com/sebastiancardonass/monstersistem/blob/main/backend/python/services/loan_service.py): `backend/python/services/loan_service.py`
- [Dashboard and reports](https://github.com/sebastiancardonass/monstersistem/blob/main/backend/python/services/report_service.py): `backend/python/services/report_service.py`

### Shared platform

- [Stores and settings](https://github.com/sebastiancardonass/monstersistem/blob/main/backend/python/services/store_service.py): `backend/python/services/store_service.py`
- [User devices](https://github.com/sebastiancardonass/monstersistem/blob/main/backend/python/services/device_service.py): `backend/python/services/device_service.py`
- [SQLAlchemy sessions](https://github.com/sebastiancardonass/monstersistem/blob/main/backend/python/database.py): `backend/python/database.py`
- [Domain data models](https://github.com/sebastiancardonass/monstersistem/blob/main/backend/python/models.py): `backend/python/models.py`
- **PostgreSQL**

### Other components

- **Store staff**

## Connections

- Store staff → POS and admin UI: uses
- POS and admin UI → Flask application: calls JSON API
- Store staff → Sales UI: runs checkout
- Sales UI → Flask application: submits sale
- Store staff → Inventory UI: manages stock
- Store staff → Debts UI: manages debts
- POS and admin UI → Offline and PWA: installs offline
- Flask application → REST endpoints: registers (evidence: `backend/python/app.py`)
- REST endpoints → Authentication: invokes (evidence: `backend/routes/auth.py`)
- REST endpoints → Auth and permissions: checks access (evidence: `backend/routes/catalog.py`)
- REST endpoints → POS and sales: invokes
- REST endpoints → Inventory and devices: invokes (evidence: `backend/routes/inventory.py`)
- REST endpoints → Service and warranty: invokes (evidence: `backend/routes/maintenance.py`)
- REST endpoints → Catalog and codes: invokes (evidence: `backend/routes/catalog.py`)
- REST endpoints → Debts and creditors: invokes (evidence: `backend/routes/inventory.py`)
- REST endpoints → Purchases and suppliers: invokes
- REST endpoints → Cash and capital: invokes (evidence: `backend/routes/auth.py`)
- REST endpoints → Loans: invokes
- REST endpoints → Dashboard and reports: invokes
- REST endpoints → Stores and settings: invokes
- REST endpoints → User devices: invokes
- POS and sales → Device identity: uses identity (evidence: `backend/python/services/sales_service.py`)
- Inventory and devices → Device identity: uses identity (evidence: `backend/python/services/inventory_service.py`)
- Purchases and suppliers → Device identity: uses identity (evidence: `backend/python/services/purchase_service.py`)
- Service and warranty → Device identity: uses identity (evidence: `backend/python/services/maintenance_service.py`)
- POS and sales → Purchases and suppliers: uses purchase logic (evidence: `backend/python/services/sales_service.py`)
- Inventory and devices → Debts and creditors: creates related debt (evidence: `backend/python/services/inventory_service.py`)
- REST endpoints → SQLAlchemy sessions: gets sessions (evidence: `backend/routes/inventory.py`)
- SQLAlchemy sessions → PostgreSQL: stores data (evidence: `backend/python/database.py`)
- POS and sales → Domain data models: reads and writes (evidence: `backend/python/services/sales_service.py`)
- Inventory and devices → Domain data models: reads and writes (evidence: `backend/python/services/inventory_service.py`)
- Debts and creditors → Domain data models: reads and writes (evidence: `backend/python/services/debt_service.py`)
- Service and warranty → Domain data models: reads and writes (evidence: `backend/python/services/maintenance_service.py`)
- Catalog and codes → Domain data models: uses models (evidence: `backend/python/services/catalog_service.py`)
- Dashboard and reports → Domain data models: queries data (evidence: `backend/python/services/report_service.py`)
- Stores and settings → Domain data models: uses models (evidence: `backend/python/services/store_service.py`)
- Loans → Domain data models: uses models (evidence: `backend/python/services/loan_service.py`)
