# ludwingh28/etl architecture

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

- Interactive diagram: https://gitdiagram.com/ludwingh28/etl
- Repository: https://github.com/ludwingh28/etl

## Overview

Cruz imex is a business-intelligence system: users authenticate, receive role- and permission-aware access to sales, product, route, inventory, supplier and download dashboards, while administrators manage accounts and reports. The React application routes users to dashboard pages; a Django API provides backend services, and a separate ETL package loads sales and reference data into PostgreSQL. A second Django project under References is visible in the tree but its relationship to the main application is unclear. Dashboard-to-API and ETL-to-dashboard data links are not established by the excerpts, so they are omitted or marked unverified.

Main entry points: [`frontend/src/App.tsx`](https://github.com/ludwingh28/etl/blob/main/frontend/src/App.tsx) (Route dispatcher), [`References/etl-main/etl-main/database.py`](https://github.com/ludwingh28/etl/blob/main/References/etl-main/etl-main/database.py) (PostgreSQL pool), [`References/etl-main/etl-main/etl_ventas.py`](https://github.com/ludwingh28/etl/blob/main/References/etl-main/etl-main/etl_ventas.py) (Sales ETL), [`backend/api/views.py`](https://github.com/ludwingh28/etl/blob/main/backend/api/views.py) (Business API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web application"]
  node_app["Route dispatcher<br/>[App.tsx]"]
  node_authctx["Session context<br/>[AuthContext.tsx]"]
  node_routeperm["Permission routes<br/>[routes.ts]"]
  node_layout["Dashboard shell"]
  node_salesdash["Sales dashboards"]
  node_productdash["Product dashboards"]
  node_routedash["Route dashboards"]
  node_supplierdash["Supplier dashboards"]
  node_adminui["User administration"]
end

subgraph group_backend["API and identity"]
  node_api["Business API<br/>[views.py]"]
  node_auth["Token authentication<br/>[authentication.py]"]
  node_models["User and domain models<br/>[models.py]"]
  node_db[("Application databases<br/>[settings.py]")]
end

subgraph group_etl["Data ingestion"]
  node_salesetl["Sales ETL<br/>[etl_ventas.py]"]
  node_productetl["Product loading"]
  node_selleretl["Seller loading"]
  node_etlconfig["ETL configuration<br/>[config.py]"]
  node_etldb[("PostgreSQL pool<br/>[database.py]")]
end

subgraph group_legacy["Reference service"]
  node_legacyapi["Legacy stream service<br/>[views.py]"]
  node_legacydata[("Legacy stream models<br/>[models.py]")]
end

node_user(("BI user"))
node_admin(("Administrator"))

node_user -->|"uses"| node_app
node_admin -->|"uses"| node_app
node_app -->|"provides session"| node_authctx
node_app -->|"selects landing route"| node_routeperm
node_app -->|"routes to"| node_salesdash
node_app -->|"routes to"| node_productdash
node_app -->|"routes to"| node_routedash
node_app -->|"routes to"| node_supplierdash
node_app -->|"routes to"| node_adminui
node_layout -->|"renders navigation"| node_authctx
node_authctx -.->|"requests session services"| node_api
node_auth -->|"checks user profile"| node_models
node_api -->|"uses domain models"| node_models
node_api -.->|"accesses persistence"| node_db
node_salesetl -->|"uses connections"| node_etldb
node_salesetl -->|"uses settings"| node_etlconfig
node_salesetl -.->|"loads reference data"| node_productetl
node_productetl -->|"uses connections"| node_etldb
node_productetl -->|"uses settings"| node_etlconfig
node_selleretl -.->|"uses connections"| node_etldb
node_etldb -->|"configures pool"| node_etlconfig
node_legacyapi -->|"queries models"| node_legacydata

click node_app "https://github.com/ludwingh28/etl/blob/main/frontend/src/App.tsx"
click node_authctx "https://github.com/ludwingh28/etl/blob/main/frontend/src/context/AuthContext.tsx"
click node_routeperm "https://github.com/ludwingh28/etl/blob/main/frontend/src/constants/routes.ts"
click node_layout "https://github.com/ludwingh28/etl/blob/main/frontend/src/components/DashboardLayout.tsx"
click node_salesdash "https://github.com/ludwingh28/etl/blob/main/frontend/src/pages/DashboardNewNacional.tsx"
click node_productdash "https://github.com/ludwingh28/etl/blob/main/frontend/src/pages/DashboardComportamientoProductos.tsx"
click node_routedash "https://github.com/ludwingh28/etl/blob/main/frontend/src/pages/DashboardDistribucionRutas.tsx"
click node_supplierdash "https://github.com/ludwingh28/etl/blob/main/frontend/src/pages/DashboardSoftysCanales.tsx"
click node_adminui "https://github.com/ludwingh28/etl/blob/main/frontend/src/pages/AdminGestionUsuarios.tsx"
click node_api "https://github.com/ludwingh28/etl/blob/main/backend/api/views.py"
click node_auth "https://github.com/ludwingh28/etl/blob/main/backend/api/authentication.py"
click node_models "https://github.com/ludwingh28/etl/blob/main/backend/api/models.py"
click node_db "https://github.com/ludwingh28/etl/blob/main/backend/cruzimex/settings.py"
click node_salesetl "https://github.com/ludwingh28/etl/blob/main/References/etl-main/etl-main/etl_ventas.py"
click node_productetl "https://github.com/ludwingh28/etl/blob/main/References/etl-main/etl-main/cargar_productos.py"
click node_selleretl "https://github.com/ludwingh28/etl/blob/main/References/etl-main/etl-main/cargar_vendedores.py"
click node_etlconfig "https://github.com/ludwingh28/etl/blob/main/References/etl-main/etl-main/config.py"
click node_etldb "https://github.com/ludwingh28/etl/blob/main/References/etl-main/etl-main/database.py"
click node_legacyapi "https://github.com/ludwingh28/etl/blob/main/References/back-main/back-main/stream/views.py"
click node_legacydata "https://github.com/ludwingh28/etl/blob/main/References/back-main/back-main/stream/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_app,node_authctx,node_routeperm,node_layout,node_salesdash,node_productdash,node_routedash,node_supplierdash,node_adminui,node_user toneBlue
class node_api,node_auth,node_models,node_db toneAmber
class node_salesetl,node_productetl,node_selleretl,node_etlconfig,node_etldb toneMint
class node_legacyapi,node_legacydata toneRose
class node_admin toneIndigo
```

## Components

### Web application

- [Route dispatcher](https://github.com/ludwingh28/etl/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Session context](https://github.com/ludwingh28/etl/blob/main/frontend/src/context/AuthContext.tsx): `frontend/src/context/AuthContext.tsx`
- [Permission routes](https://github.com/ludwingh28/etl/blob/main/frontend/src/constants/routes.ts): `frontend/src/constants/routes.ts`
- [Dashboard shell](https://github.com/ludwingh28/etl/blob/main/frontend/src/components/DashboardLayout.tsx): `frontend/src/components/DashboardLayout.tsx`
- [Sales dashboards](https://github.com/ludwingh28/etl/blob/main/frontend/src/pages/DashboardNewNacional.tsx): `frontend/src/pages/DashboardNewNacional.tsx`
- [Product dashboards](https://github.com/ludwingh28/etl/blob/main/frontend/src/pages/DashboardComportamientoProductos.tsx): `frontend/src/pages/DashboardComportamientoProductos.tsx`
- [Route dashboards](https://github.com/ludwingh28/etl/blob/main/frontend/src/pages/DashboardDistribucionRutas.tsx): `frontend/src/pages/DashboardDistribucionRutas.tsx`
- [Supplier dashboards](https://github.com/ludwingh28/etl/blob/main/frontend/src/pages/DashboardSoftysCanales.tsx): `frontend/src/pages/DashboardSoftysCanales.tsx`
- [User administration](https://github.com/ludwingh28/etl/blob/main/frontend/src/pages/AdminGestionUsuarios.tsx): `frontend/src/pages/AdminGestionUsuarios.tsx`

### API and identity

- [Business API](https://github.com/ludwingh28/etl/blob/main/backend/api/views.py): `backend/api/views.py`
- [Token authentication](https://github.com/ludwingh28/etl/blob/main/backend/api/authentication.py): `backend/api/authentication.py`
- [User and domain models](https://github.com/ludwingh28/etl/blob/main/backend/api/models.py): `backend/api/models.py`
- [Application databases](https://github.com/ludwingh28/etl/blob/main/backend/cruzimex/settings.py): `backend/cruzimex/settings.py`

### Data ingestion

- [Sales ETL](https://github.com/ludwingh28/etl/blob/main/References/etl-main/etl-main/etl_ventas.py): `References/etl-main/etl-main/etl_ventas.py`
- [Product loading](https://github.com/ludwingh28/etl/blob/main/References/etl-main/etl-main/cargar_productos.py): `References/etl-main/etl-main/cargar_productos.py`
- [Seller loading](https://github.com/ludwingh28/etl/blob/main/References/etl-main/etl-main/cargar_vendedores.py): `References/etl-main/etl-main/cargar_vendedores.py`
- [ETL configuration](https://github.com/ludwingh28/etl/blob/main/References/etl-main/etl-main/config.py): `References/etl-main/etl-main/config.py`
- [PostgreSQL pool](https://github.com/ludwingh28/etl/blob/main/References/etl-main/etl-main/database.py): `References/etl-main/etl-main/database.py`

### Reference service

- [Legacy stream service](https://github.com/ludwingh28/etl/blob/main/References/back-main/back-main/stream/views.py): `References/back-main/back-main/stream/views.py`
- [Legacy stream models](https://github.com/ludwingh28/etl/blob/main/References/back-main/back-main/stream/models.py): `References/back-main/back-main/stream/models.py`

### Other components

- **BI user**
- **Administrator**

## Connections

- BI user → Route dispatcher: uses
- Administrator → Route dispatcher: uses
- Route dispatcher → Session context: provides session (evidence: `frontend/src/App.tsx`)
- Route dispatcher → Permission routes: selects landing route (evidence: `frontend/src/App.tsx`)
- Route dispatcher → Sales dashboards: routes to (evidence: `frontend/src/App.tsx`)
- Route dispatcher → Product dashboards: routes to (evidence: `frontend/src/App.tsx`)
- Route dispatcher → Route dashboards: routes to (evidence: `frontend/src/App.tsx`)
- Route dispatcher → Supplier dashboards: routes to (evidence: `frontend/src/App.tsx`)
- Route dispatcher → User administration: routes to (evidence: `frontend/src/App.tsx`)
- Dashboard shell → Session context: renders navigation (evidence: `frontend/src/components/DashboardLayout.tsx`)
- Session context → Business API: requests session services
- Token authentication → User and domain models: checks user profile (evidence: `backend/api/authentication.py`)
- Business API → User and domain models: uses domain models (evidence: `backend/api/views.py`)
- Business API → Application databases: accesses persistence
- Sales ETL → PostgreSQL pool: uses connections (evidence: `References/etl-main/etl-main/etl_ventas.py`)
- Sales ETL → ETL configuration: uses settings (evidence: `References/etl-main/etl-main/etl_ventas.py`)
- Sales ETL → Product loading: loads reference data
- Product loading → PostgreSQL pool: uses connections (evidence: `References/etl-main/etl-main/cargar_productos.py`)
- Product loading → ETL configuration: uses settings (evidence: `References/etl-main/etl-main/cargar_productos.py`)
- Seller loading → PostgreSQL pool: uses connections
- PostgreSQL pool → ETL configuration: configures pool (evidence: `References/etl-main/etl-main/database.py`)
- Legacy stream service → Legacy stream models: queries models (evidence: `References/back-main/back-main/stream/views.py`)
