# carlosn225/inventia-app-escritorio architecture

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

- Interactive diagram: https://gitdiagram.com/carlosn225/inventia-app-escritorio
- Repository: https://github.com/carlosn225/inventia-app-escritorio

## Overview

Inventia is a desktop inventory application for small businesses. The intended workflow is to maintain a product catalog, register stock entries, exits and corrections, then review quantities and low-stock alerts. Electron starts the local Django server and serves the React interface; the backend’s movement service updates stock and records threshold alerts. The README describes offline-first use and WhatsApp notifications, but the shown implementation has no sync mechanism and explicitly leaves Twilio sending for later, so those capabilities are not depicted as implemented. Frontend-to-backend wiring beyond the authentication API is not established by the excerpts.

Main entry points: [`frontend/src/App.jsx`](https://github.com/carlosn225/inventia-app-escritorio/blob/main/frontend/src/App.jsx) (App routes), [`backend/usuarios/views.py`](https://github.com/carlosn225/inventia-app-escritorio/blob/main/backend/usuarios/views.py) (User API), [`frontend/electron/main.cjs`](https://github.com/carlosn225/inventia-app-escritorio/blob/main/frontend/electron/main.cjs) (Electron shell), [`backend/inventario/views.py`](https://github.com/carlosn225/inventia-app-escritorio/blob/main/backend/inventario/views.py) (Inventory API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop runtime"]
  node_electron["Electron shell<br/>[main.cjs]"]
  node_static_server["UI static server<br/>[server.cjs]"]
end

subgraph group_frontend["Inventory interface"]
  node_app_routes["App routes<br/>[App.jsx]"]
  node_auth_guard["Session guard<br/>[RutaProtegida.jsx]"]
  node_login_page["Login<br/>[Login.jsx]"]
  node_auth_client["Auth client<br/>[auth.js]"]
  node_dashboard["Dashboard<br/>[Dashboard.jsx]"]
  node_catalog["Product catalog<br/>[Catalogo.jsx]"]
  node_product_form["Product editing<br/>[ProductoForm.jsx]"]
  node_movement_views["Movement history<br/>[Movimientos.jsx]"]
  node_stock_operations["Stock operations"]
  node_sales["Sales entry<br/>[RegistrarVenta.jsx]"]
  node_waste["Waste entry<br/>[RegistrarMerma.jsx]"]
  node_stock_correction["Stock correction"]
  node_alert_page["Alerts view<br/>[Alertas.jsx]"]
  node_settings_page["Configuration<br/>[Configuracion.jsx]"]
  node_user_pages["Profile and help<br/>[MiPerfil.jsx]"]
end

subgraph group_backend["Backend domain"]
  node_inventory_views["Inventory API<br/>[views.py]"]
  node_movement_service["Movement service<br/>[services.py]"]
  node_inventory_serializers["Inventory serializers<br/>[serializers.py]"]
end

subgraph group_identity["User access"]
  node_user_views["User API<br/>[views.py]"]
  node_user_permissions["Access permissions<br/>[permissions.py]"]
  node_user_routes["User routes<br/>[urls.py]"]
end

subgraph group_persistence["State and alerts"]
  node_inventory_store[("Inventory records<br/>[models.py]")]
  node_user_store[("User records<br/>[models.py]")]
end

node_business_user(("Business user"))
node_whatsapp["Twilio WhatsApp"]

node_business_user -->|"uses"| node_electron
node_electron -->|"starts"| node_static_server
node_electron -->|"loads UI"| node_app_routes
node_electron -->|"starts server"| node_inventory_views
node_static_server -->|"serves UI"| node_app_routes
node_app_routes -->|"routes to"| node_login_page
node_app_routes -->|"protects routes"| node_auth_guard
node_auth_guard -->|"checks session"| node_auth_client
node_app_routes -->|"routes to"| node_dashboard
node_app_routes -->|"routes to"| node_catalog
node_app_routes -->|"routes to"| node_product_form
node_app_routes -->|"routes to"| node_movement_views
node_app_routes -->|"routes to"| node_stock_operations
node_app_routes -->|"routes to"| node_sales
node_app_routes -->|"routes to"| node_waste
node_app_routes -->|"routes to"| node_stock_correction
node_app_routes -->|"routes to"| node_alert_page
node_app_routes -->|"routes to"| node_settings_page
node_app_routes -->|"routes to"| node_user_pages
node_login_page -->|"authenticates via"| node_auth_client
node_auth_client -.->|"calls user API"| node_user_views
node_user_routes -->|"routes requests"| node_user_views
node_user_views -->|"reads and writes"| node_user_store
node_user_views -->|"checks access"| node_user_permissions
node_user_views -->|"serializes users"| node_inventory_serializers
node_inventory_views -->|"delegates movement"| node_movement_service
node_inventory_views -->|"accesses records"| node_inventory_store
node_inventory_views -->|"validates data"| node_inventory_serializers
node_movement_service -->|"updates stock"| node_inventory_store
node_movement_service -.->|"planned notification"| node_whatsapp
node_business_user -.->|"receives low-stock alerts"| node_whatsapp

click node_electron "https://github.com/carlosn225/inventia-app-escritorio/blob/main/frontend/electron/main.cjs"
click node_static_server "https://github.com/carlosn225/inventia-app-escritorio/blob/main/frontend/electron/server.cjs"
click node_app_routes "https://github.com/carlosn225/inventia-app-escritorio/blob/main/frontend/src/App.jsx"
click node_auth_guard "https://github.com/carlosn225/inventia-app-escritorio/blob/main/frontend/src/components/RutaProtegida.jsx"
click node_login_page "https://github.com/carlosn225/inventia-app-escritorio/blob/main/frontend/src/pages/Login.jsx"
click node_auth_client "https://github.com/carlosn225/inventia-app-escritorio/blob/main/frontend/src/services/auth.js"
click node_dashboard "https://github.com/carlosn225/inventia-app-escritorio/blob/main/frontend/src/pages/Dashboard.jsx"
click node_catalog "https://github.com/carlosn225/inventia-app-escritorio/blob/main/frontend/src/pages/Catalogo.jsx"
click node_product_form "https://github.com/carlosn225/inventia-app-escritorio/blob/main/frontend/src/pages/ProductoForm.jsx"
click node_movement_views "https://github.com/carlosn225/inventia-app-escritorio/blob/main/frontend/src/pages/Movimientos.jsx"
click node_stock_operations "https://github.com/carlosn225/inventia-app-escritorio/blob/main/frontend/src/pages/RegistrarCompra.jsx"
click node_sales "https://github.com/carlosn225/inventia-app-escritorio/blob/main/frontend/src/pages/RegistrarVenta.jsx"
click node_waste "https://github.com/carlosn225/inventia-app-escritorio/blob/main/frontend/src/pages/RegistrarMerma.jsx"
click node_stock_correction "https://github.com/carlosn225/inventia-app-escritorio/blob/main/frontend/src/pages/CorreccionInventario.jsx"
click node_alert_page "https://github.com/carlosn225/inventia-app-escritorio/blob/main/frontend/src/pages/Alertas.jsx"
click node_settings_page "https://github.com/carlosn225/inventia-app-escritorio/blob/main/frontend/src/pages/Configuracion.jsx"
click node_user_pages "https://github.com/carlosn225/inventia-app-escritorio/blob/main/frontend/src/pages/MiPerfil.jsx"
click node_inventory_views "https://github.com/carlosn225/inventia-app-escritorio/blob/main/backend/inventario/views.py"
click node_movement_service "https://github.com/carlosn225/inventia-app-escritorio/blob/main/backend/inventario/services.py"
click node_inventory_serializers "https://github.com/carlosn225/inventia-app-escritorio/blob/main/backend/inventario/serializers.py"
click node_user_views "https://github.com/carlosn225/inventia-app-escritorio/blob/main/backend/usuarios/views.py"
click node_user_permissions "https://github.com/carlosn225/inventia-app-escritorio/blob/main/backend/usuarios/permissions.py"
click node_user_routes "https://github.com/carlosn225/inventia-app-escritorio/blob/main/backend/usuarios/urls.py"
click node_inventory_store "https://github.com/carlosn225/inventia-app-escritorio/blob/main/backend/inventario/models.py"
click node_user_store "https://github.com/carlosn225/inventia-app-escritorio/blob/main/backend/usuarios/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_electron,node_static_server,node_business_user toneBlue
class node_app_routes,node_auth_guard,node_login_page,node_auth_client,node_dashboard,node_catalog,node_product_form,node_movement_views,node_stock_operations,node_sales,node_waste,node_stock_correction,node_alert_page,node_settings_page,node_user_pages toneAmber
class node_inventory_views,node_movement_service,node_inventory_serializers toneMint
class node_user_views,node_user_permissions,node_user_routes toneRose
class node_inventory_store,node_user_store,node_whatsapp toneIndigo
```

## Components

### Desktop runtime

- [Electron shell](https://github.com/carlosn225/inventia-app-escritorio/blob/main/frontend/electron/main.cjs): `frontend/electron/main.cjs`
- [UI static server](https://github.com/carlosn225/inventia-app-escritorio/blob/main/frontend/electron/server.cjs): `frontend/electron/server.cjs`

### Inventory interface

- [App routes](https://github.com/carlosn225/inventia-app-escritorio/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Session guard](https://github.com/carlosn225/inventia-app-escritorio/blob/main/frontend/src/components/RutaProtegida.jsx): `frontend/src/components/RutaProtegida.jsx`
- [Login](https://github.com/carlosn225/inventia-app-escritorio/blob/main/frontend/src/pages/Login.jsx): `frontend/src/pages/Login.jsx`
- [Auth client](https://github.com/carlosn225/inventia-app-escritorio/blob/main/frontend/src/services/auth.js): `frontend/src/services/auth.js`
- [Dashboard](https://github.com/carlosn225/inventia-app-escritorio/blob/main/frontend/src/pages/Dashboard.jsx): `frontend/src/pages/Dashboard.jsx`
- [Product catalog](https://github.com/carlosn225/inventia-app-escritorio/blob/main/frontend/src/pages/Catalogo.jsx): `frontend/src/pages/Catalogo.jsx`
- [Product editing](https://github.com/carlosn225/inventia-app-escritorio/blob/main/frontend/src/pages/ProductoForm.jsx): `frontend/src/pages/ProductoForm.jsx`
- [Movement history](https://github.com/carlosn225/inventia-app-escritorio/blob/main/frontend/src/pages/Movimientos.jsx): `frontend/src/pages/Movimientos.jsx`
- [Stock operations](https://github.com/carlosn225/inventia-app-escritorio/blob/main/frontend/src/pages/RegistrarCompra.jsx): `frontend/src/pages/RegistrarCompra.jsx`
- [Sales entry](https://github.com/carlosn225/inventia-app-escritorio/blob/main/frontend/src/pages/RegistrarVenta.jsx): `frontend/src/pages/RegistrarVenta.jsx`
- [Waste entry](https://github.com/carlosn225/inventia-app-escritorio/blob/main/frontend/src/pages/RegistrarMerma.jsx): `frontend/src/pages/RegistrarMerma.jsx`
- [Stock correction](https://github.com/carlosn225/inventia-app-escritorio/blob/main/frontend/src/pages/CorreccionInventario.jsx): `frontend/src/pages/CorreccionInventario.jsx`
- [Alerts view](https://github.com/carlosn225/inventia-app-escritorio/blob/main/frontend/src/pages/Alertas.jsx): `frontend/src/pages/Alertas.jsx`
- [Configuration](https://github.com/carlosn225/inventia-app-escritorio/blob/main/frontend/src/pages/Configuracion.jsx): `frontend/src/pages/Configuracion.jsx`
- [Profile and help](https://github.com/carlosn225/inventia-app-escritorio/blob/main/frontend/src/pages/MiPerfil.jsx): `frontend/src/pages/MiPerfil.jsx`

### Backend domain

- [Inventory API](https://github.com/carlosn225/inventia-app-escritorio/blob/main/backend/inventario/views.py): `backend/inventario/views.py`
- [Movement service](https://github.com/carlosn225/inventia-app-escritorio/blob/main/backend/inventario/services.py): `backend/inventario/services.py`
- [Inventory serializers](https://github.com/carlosn225/inventia-app-escritorio/blob/main/backend/inventario/serializers.py): `backend/inventario/serializers.py`

### User access

- [User API](https://github.com/carlosn225/inventia-app-escritorio/blob/main/backend/usuarios/views.py): `backend/usuarios/views.py`
- [Access permissions](https://github.com/carlosn225/inventia-app-escritorio/blob/main/backend/usuarios/permissions.py): `backend/usuarios/permissions.py`
- [User routes](https://github.com/carlosn225/inventia-app-escritorio/blob/main/backend/usuarios/urls.py): `backend/usuarios/urls.py`

### State and alerts

- [Inventory records](https://github.com/carlosn225/inventia-app-escritorio/blob/main/backend/inventario/models.py): `backend/inventario/models.py`
- [User records](https://github.com/carlosn225/inventia-app-escritorio/blob/main/backend/usuarios/models.py): `backend/usuarios/models.py`

### Other components

- **Business user**
- **Twilio WhatsApp**

## Connections

- Business user → Electron shell: uses
- Electron shell → UI static server: starts (evidence: `frontend/electron/main.cjs`)
- Electron shell → App routes: loads UI (evidence: `frontend/electron/main.cjs`)
- Electron shell → Inventory API: starts server (evidence: `frontend/electron/main.cjs`)
- UI static server → App routes: serves UI (evidence: `frontend/electron/server.cjs`)
- App routes → Login: routes to (evidence: `frontend/src/App.jsx`)
- App routes → Session guard: protects routes (evidence: `frontend/src/App.jsx`)
- Session guard → Auth client: checks session (evidence: `frontend/src/components/RutaProtegida.jsx`)
- App routes → Dashboard: routes to (evidence: `frontend/src/App.jsx`)
- App routes → Product catalog: routes to (evidence: `frontend/src/App.jsx`)
- App routes → Product editing: routes to (evidence: `frontend/src/App.jsx`)
- App routes → Movement history: routes to (evidence: `frontend/src/App.jsx`)
- App routes → Stock operations: routes to (evidence: `frontend/src/App.jsx`)
- App routes → Sales entry: routes to (evidence: `frontend/src/App.jsx`)
- App routes → Waste entry: routes to (evidence: `frontend/src/App.jsx`)
- App routes → Stock correction: routes to (evidence: `frontend/src/App.jsx`)
- App routes → Alerts view: routes to (evidence: `frontend/src/App.jsx`)
- App routes → Configuration: routes to (evidence: `frontend/src/App.jsx`)
- App routes → Profile and help: routes to (evidence: `frontend/src/App.jsx`)
- Login → Auth client: authenticates via (evidence: `frontend/src/services/auth.js`)
- Auth client → User API: calls user API
- User routes → User API: routes requests (evidence: `backend/usuarios/urls.py`)
- User API → User records: reads and writes (evidence: `backend/usuarios/views.py`)
- User API → Access permissions: checks access (evidence: `backend/usuarios/views.py`)
- User API → Inventory serializers: serializes users (evidence: `backend/usuarios/views.py`)
- Inventory API → Movement service: delegates movement (evidence: `backend/inventario/views.py`)
- Inventory API → Inventory records: accesses records (evidence: `backend/inventario/views.py`)
- Inventory API → Inventory serializers: validates data (evidence: `backend/inventario/views.py`)
- Movement service → Inventory records: updates stock (evidence: `backend/inventario/services.py`)
- Movement service → Twilio WhatsApp: planned notification (evidence: `backend/inventario/services.py`)
- Business user → Twilio WhatsApp: receives low-stock alerts
