# delkatonne/hitna-gestion architecture

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

- Interactive diagram: https://gitdiagram.com/delkatonne/hitna-gestion
- Repository: https://github.com/delkatonne/hitna-gestion

## Overview

HITNA Gestion is a web-based shop and inventory management system. Its main workflow is staff recording sales or stock movements, with Flask routes applying the operation to the database; administrators then manage products, purchasing, customers, and business reporting. It also supports offline use: browser actions queue in IndexedDB and are submitted to the server when connectivity returns. The broad admin feature map is grounded in the template tree and the sampled modules; individual unsampled route relationships are not inferred.

Main entry points: [`app.py`](https://github.com/delkatonne/hitna-gestion/blob/main/app.py) (Flask routes), [`ajouts.py`](https://github.com/delkatonne/hitna-gestion/blob/main/ajouts.py) (Added features), [`static/offline-sync.js`](https://github.com/delkatonne/hitna-gestion/blob/main/static/offline-sync.js) (Offline sync), [`static/db.js`](https://github.com/delkatonne/hitna-gestion/blob/main/static/db.js) (Local action queue)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_flask["Flask routes<br/>[app.py]"]
  node_feature_routes["Added features<br/>[ajouts.py]"]
  node_templates["Pages and forms"]
  node_postgres[("Business records<br/>[app.py]")]
end

subgraph group_operations["Shop operations"]
  node_sales_stock["Sales and stock<br/>[app.py]"]
  node_purchasing["Purchasing and arrivals<br/>[ajouts.py]"]
  node_reservations["Reservations<br/>[app.py]"]
  node_customers["Customer records<br/>[app.py]"]
  node_credits["Customer credits<br/>[ajouts.py]"]
end

subgraph group_admin["Administration"]
  node_business_plan["Business planning<br/>[ajouts.py]"]
  node_admin_catalog["Product and supplier admin"]
  node_admin_finance["Finance and reporting"]
  node_staff_admin["Staff and permissions"]
end

subgraph group_offline["Offline support"]
  node_browser(("Browser"))
  node_offline_sync["Offline sync<br/>[offline-sync.js]"]
  node_indexeddb[("Local action queue<br/>[db.js]")]
  node_api_cache["API cache<br/>[offline-cache.js]"]
  node_service_worker["Page and asset cache<br/>[sw.js]"]
end

node_staff(("Shop staff"))
node_admin_user(("Administrator"))

node_staff -->|"submits actions"| node_flask
node_admin_user -->|"uses admin routes"| node_flask
node_flask -->|"renders pages"| node_templates
node_flask -->|"queries and updates"| node_postgres
node_feature_routes -->|"queries and updates"| node_postgres
node_flask -->|"handles operations"| node_sales_stock
node_flask -->|"handles reservations"| node_reservations
node_flask -->|"serves customer records"| node_customers
node_feature_routes -->|"handles arrivals"| node_purchasing
node_feature_routes -->|"records stock receipt"| node_sales_stock
node_feature_routes -->|"handles credits"| node_credits
node_feature_routes -->|"handles planning"| node_business_plan
node_admin_user -->|"manages catalog"| node_admin_catalog
node_admin_user -->|"reviews reports"| node_admin_finance
node_admin_user -->|"manages staff"| node_staff_admin
node_browser -->|"runs client code"| node_offline_sync
node_offline_sync -->|"queues and reads actions"| node_indexeddb
node_offline_sync -->|"posts queued actions"| node_flask
node_offline_sync -->|"refreshes products"| node_flask
node_offline_sync -->|"stores product cache"| node_indexeddb
node_browser -->|"intercepts API reads"| node_api_cache
node_browser -->|"intercepts GET requests"| node_service_worker

click node_flask "https://github.com/delkatonne/hitna-gestion/blob/main/app.py"
click node_feature_routes "https://github.com/delkatonne/hitna-gestion/blob/main/ajouts.py"
click node_templates "https://github.com/delkatonne/hitna-gestion/tree/main/templates"
click node_postgres "https://github.com/delkatonne/hitna-gestion/blob/main/app.py"
click node_sales_stock "https://github.com/delkatonne/hitna-gestion/blob/main/app.py"
click node_purchasing "https://github.com/delkatonne/hitna-gestion/blob/main/ajouts.py"
click node_reservations "https://github.com/delkatonne/hitna-gestion/blob/main/app.py"
click node_customers "https://github.com/delkatonne/hitna-gestion/blob/main/app.py"
click node_credits "https://github.com/delkatonne/hitna-gestion/blob/main/ajouts.py"
click node_business_plan "https://github.com/delkatonne/hitna-gestion/blob/main/ajouts.py"
click node_admin_catalog "https://github.com/delkatonne/hitna-gestion/tree/main/templates"
click node_admin_finance "https://github.com/delkatonne/hitna-gestion/tree/main/templates"
click node_staff_admin "https://github.com/delkatonne/hitna-gestion/tree/main/templates"
click node_offline_sync "https://github.com/delkatonne/hitna-gestion/blob/main/static/offline-sync.js"
click node_indexeddb "https://github.com/delkatonne/hitna-gestion/blob/main/static/db.js"
click node_api_cache "https://github.com/delkatonne/hitna-gestion/blob/main/static/offline-cache.js"
click node_service_worker "https://github.com/delkatonne/hitna-gestion/blob/main/sw.js"

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_feature_routes,node_templates,node_postgres toneBlue
class node_sales_stock,node_purchasing,node_reservations,node_customers,node_credits toneAmber
class node_business_plan,node_admin_catalog,node_admin_finance,node_staff_admin toneMint
class node_browser,node_offline_sync,node_indexeddb,node_api_cache,node_service_worker toneRose
class node_staff,node_admin_user toneIndigo
```

## Components

### Web application

- [Flask routes](https://github.com/delkatonne/hitna-gestion/blob/main/app.py): `app.py`
- [Added features](https://github.com/delkatonne/hitna-gestion/blob/main/ajouts.py): `ajouts.py`
- [Pages and forms](https://github.com/delkatonne/hitna-gestion/tree/main/templates): `templates`
- [Business records](https://github.com/delkatonne/hitna-gestion/blob/main/app.py): `app.py`

### Shop operations

- [Sales and stock](https://github.com/delkatonne/hitna-gestion/blob/main/app.py): `app.py`
- [Purchasing and arrivals](https://github.com/delkatonne/hitna-gestion/blob/main/ajouts.py): `ajouts.py`
- [Reservations](https://github.com/delkatonne/hitna-gestion/blob/main/app.py): `app.py`
- [Customer records](https://github.com/delkatonne/hitna-gestion/blob/main/app.py): `app.py`
- [Customer credits](https://github.com/delkatonne/hitna-gestion/blob/main/ajouts.py): `ajouts.py`

### Administration

- [Business planning](https://github.com/delkatonne/hitna-gestion/blob/main/ajouts.py): `ajouts.py`
- [Product and supplier admin](https://github.com/delkatonne/hitna-gestion/tree/main/templates): `templates`
- [Finance and reporting](https://github.com/delkatonne/hitna-gestion/tree/main/templates): `templates`
- [Staff and permissions](https://github.com/delkatonne/hitna-gestion/tree/main/templates): `templates`

### Offline support

- **Browser**
- [Offline sync](https://github.com/delkatonne/hitna-gestion/blob/main/static/offline-sync.js): `static/offline-sync.js`
- [Local action queue](https://github.com/delkatonne/hitna-gestion/blob/main/static/db.js): `static/db.js`
- [API cache](https://github.com/delkatonne/hitna-gestion/blob/main/static/offline-cache.js): `static/offline-cache.js`
- [Page and asset cache](https://github.com/delkatonne/hitna-gestion/blob/main/sw.js): `sw.js`

### Other components

- **Shop staff**
- **Administrator**

## Connections

- Shop staff → Flask routes: submits actions (evidence: `app.py`)
- Administrator → Flask routes: uses admin routes (evidence: `app.py`)
- Flask routes → Pages and forms: renders pages (evidence: `app.py`)
- Flask routes → Business records: queries and updates (evidence: `app.py`)
- Added features → Business records: queries and updates (evidence: `ajouts.py`)
- Flask routes → Sales and stock: handles operations (evidence: `app.py`)
- Flask routes → Reservations: handles reservations (evidence: `app.py`)
- Flask routes → Customer records: serves customer records (evidence: `app.py`)
- Added features → Purchasing and arrivals: handles arrivals (evidence: `ajouts.py`)
- Added features → Sales and stock: records stock receipt (evidence: `ajouts.py`)
- Added features → Customer credits: handles credits (evidence: `ajouts.py`)
- Added features → Business planning: handles planning (evidence: `ajouts.py`)
- Administrator → Product and supplier admin: manages catalog
- Administrator → Finance and reporting: reviews reports
- Administrator → Staff and permissions: manages staff
- Browser → Offline sync: runs client code (evidence: `static/offline-sync.js`)
- Offline sync → Local action queue: queues and reads actions (evidence: `static/offline-sync.js`)
- Offline sync → Flask routes: posts queued actions (evidence: `static/offline-sync.js`)
- Offline sync → Flask routes: refreshes products (evidence: `static/offline-sync.js`)
- Offline sync → Local action queue: stores product cache (evidence: `static/offline-sync.js`)
- Browser → API cache: intercepts API reads (evidence: `static/offline-cache.js`)
- Browser → Page and asset cache: intercepts GET requests (evidence: `sw.js`)
