# jadelgad0s/smartstock-multiempresa architecture

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

- Interactive diagram: https://gitdiagram.com/jadelgad0s/smartstock-multiempresa
- Repository: https://github.com/jadelgad0s/smartstock-multiempresa

## Overview

SmartStock is a Django multi-company inventory system. The main workflow is a user signing in through the shared entry point, working in their company’s isolated operational data, and recording inventory activity that can be reviewed through reports and audit history. Major capabilities include product and warehouse management, stock movements, FIFO lots, transfers, losses, physical locations, SMS alerts, and platform support. The graph uses README statements and shown routing/import references; unsampled modules are represented only where the README establishes their capability.

Main entry points: [`apps/productos/views.py`](https://github.com/jadelgad0s/smartstock-multiempresa/blob/main/apps/productos/views.py) (Inventory API), [`config/urls.py`](https://github.com/jadelgad0s/smartstock-multiempresa/blob/main/config/urls.py) (Web entry), [`apps/usuarios/views_auth.py`](https://github.com/jadelgad0s/smartstock-multiempresa/blob/main/apps/usuarios/views_auth.py) (Authentication API), [`esquema_multiempresa/login.py`](https://github.com/jadelgad0s/smartstock-multiempresa/blob/main/esquema_multiempresa/login.py) (Shared login)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_tenant["Company access"]
  node_web_entry["Web entry<br/>[urls.py]"]
  node_shared_login["Shared login<br/>[login.py]"]
  node_company_directory[("Company directory<br/>[models.py]")]
  node_tenant_data[("Company data<br/>[empresa.py]")]
end

subgraph group_inventory["Inventory operations"]
  node_product_catalog[("Product catalog<br/>[models.py]")]
  node_warehouse_stock["Warehouse stock<br/>[stock.py]"]
  node_inventory_api["Inventory API<br/>[views.py]"]
  node_lot_fifo["Lots and FIFO<br/>[fifo.py]"]
  node_transfers["Warehouse transfers"]
  node_losses["Losses and write-offs<br/>[views_mermas.py]"]
  node_locations["Physical locations"]
  node_reports["Inventory reports<br/>[reportes.py]"]
  node_sms_alerts["SMS alerts<br/>[alertas_sms.py]"]
end

subgraph group_governance["Identity and oversight"]
  node_users_roles[("Users and roles<br/>[models.py]")]
  node_auth_api["Authentication API<br/>[views_auth.py]"]
  node_permissions["Permissions<br/>[permissions.py]"]
  node_audit_writer["Audit recording"]
  node_audit_store[("Audit history<br/>[models.py]")]
end

subgraph group_platform["Platform services"]
  node_support_authorization["Support authorization"]
  node_central_panel["Platform panel"]
  node_contact_inbox["Contact inbox<br/>[buzon_contacto.py]"]
end

node_user(("Company user"))
node_sms_provider["SMS provider"]

node_user -->|"opens"| node_web_entry
node_web_entry -->|"routes auth"| node_auth_api
node_web_entry -->|"routes inventory"| node_inventory_api
node_user -->|"signs in"| node_shared_login
node_shared_login -.->|"selects company"| node_company_directory
node_company_directory -->|"isolates data"| node_tenant_data
node_inventory_api -->|"manages products"| node_product_catalog
node_inventory_api -->|"annotates stock"| node_warehouse_stock
node_inventory_api -.->|"checks permissions"| node_users_roles
node_inventory_api -->|"supports lots"| node_lot_fifo
node_inventory_api -->|"supports transfers"| node_transfers
node_inventory_api -->|"records losses"| node_losses
node_inventory_api -->|"manages locations"| node_locations
node_inventory_api -->|"provides reports"| node_reports
node_inventory_api -->|"supports alerts"| node_sms_alerts
node_sms_alerts -.->|"sends SMS"| node_sms_provider
node_auth_api -->|"authenticates"| node_users_roles
node_auth_api -->|"records login"| node_audit_writer
node_audit_writer -->|"writes events"| node_audit_store
node_user -->|"uses platform"| node_central_panel
node_central_panel -.->|"authorizes support"| node_support_authorization
node_user -->|"contacts support"| node_contact_inbox

click node_web_entry "https://github.com/jadelgad0s/smartstock-multiempresa/blob/main/config/urls.py"
click node_shared_login "https://github.com/jadelgad0s/smartstock-multiempresa/blob/main/esquema_multiempresa/login.py"
click node_company_directory "https://github.com/jadelgad0s/smartstock-multiempresa/blob/main/esquema_multiempresa/models.py"
click node_tenant_data "https://github.com/jadelgad0s/smartstock-multiempresa/blob/main/apps/core/empresa.py"
click node_product_catalog "https://github.com/jadelgad0s/smartstock-multiempresa/blob/main/apps/productos/models.py"
click node_warehouse_stock "https://github.com/jadelgad0s/smartstock-multiempresa/blob/main/apps/productos/stock.py"
click node_inventory_api "https://github.com/jadelgad0s/smartstock-multiempresa/blob/main/apps/productos/views.py"
click node_lot_fifo "https://github.com/jadelgad0s/smartstock-multiempresa/blob/main/apps/productos/fifo.py"
click node_transfers "https://github.com/jadelgad0s/smartstock-multiempresa/blob/main/apps/productos/views_transferencias.py"
click node_losses "https://github.com/jadelgad0s/smartstock-multiempresa/blob/main/apps/productos/views_mermas.py"
click node_locations "https://github.com/jadelgad0s/smartstock-multiempresa/blob/main/apps/productos/views_ubicaciones.py"
click node_reports "https://github.com/jadelgad0s/smartstock-multiempresa/blob/main/apps/productos/reportes.py"
click node_sms_alerts "https://github.com/jadelgad0s/smartstock-multiempresa/blob/main/apps/productos/alertas_sms.py"
click node_users_roles "https://github.com/jadelgad0s/smartstock-multiempresa/blob/main/apps/usuarios/models.py"
click node_auth_api "https://github.com/jadelgad0s/smartstock-multiempresa/blob/main/apps/usuarios/views_auth.py"
click node_permissions "https://github.com/jadelgad0s/smartstock-multiempresa/blob/main/apps/usuarios/permissions.py"
click node_audit_writer "https://github.com/jadelgad0s/smartstock-multiempresa/blob/main/apps/core/registro_auditoria.py"
click node_audit_store "https://github.com/jadelgad0s/smartstock-multiempresa/blob/main/apps/core/models.py"
click node_support_authorization "https://github.com/jadelgad0s/smartstock-multiempresa/blob/main/esquema_multiempresa/autorizacion_soporte.py"
click node_central_panel "https://github.com/jadelgad0s/smartstock-multiempresa/tree/main/esquema_multiempresa"
click node_contact_inbox "https://github.com/jadelgad0s/smartstock-multiempresa/blob/main/esquema_multiempresa/buzon_contacto.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_web_entry,node_shared_login,node_company_directory,node_tenant_data,node_user toneBlue
class node_product_catalog,node_warehouse_stock,node_inventory_api,node_lot_fifo,node_transfers,node_losses,node_locations,node_reports,node_sms_alerts toneAmber
class node_users_roles,node_auth_api,node_permissions,node_audit_writer,node_audit_store toneMint
class node_support_authorization,node_central_panel,node_contact_inbox toneRose
class node_sms_provider toneIndigo
```

## Components

### Company access

- [Web entry](https://github.com/jadelgad0s/smartstock-multiempresa/blob/main/config/urls.py): `config/urls.py`
- [Shared login](https://github.com/jadelgad0s/smartstock-multiempresa/blob/main/esquema_multiempresa/login.py): `esquema_multiempresa/login.py`
- [Company directory](https://github.com/jadelgad0s/smartstock-multiempresa/blob/main/esquema_multiempresa/models.py): `esquema_multiempresa/models.py`
- [Company data](https://github.com/jadelgad0s/smartstock-multiempresa/blob/main/apps/core/empresa.py): `apps/core/empresa.py`

### Inventory operations

- [Product catalog](https://github.com/jadelgad0s/smartstock-multiempresa/blob/main/apps/productos/models.py): `apps/productos/models.py`
- [Warehouse stock](https://github.com/jadelgad0s/smartstock-multiempresa/blob/main/apps/productos/stock.py): `apps/productos/stock.py`
- [Inventory API](https://github.com/jadelgad0s/smartstock-multiempresa/blob/main/apps/productos/views.py): `apps/productos/views.py`
- [Lots and FIFO](https://github.com/jadelgad0s/smartstock-multiempresa/blob/main/apps/productos/fifo.py): `apps/productos/fifo.py`
- [Warehouse transfers](https://github.com/jadelgad0s/smartstock-multiempresa/blob/main/apps/productos/views_transferencias.py): `apps/productos/views_transferencias.py`
- [Losses and write-offs](https://github.com/jadelgad0s/smartstock-multiempresa/blob/main/apps/productos/views_mermas.py): `apps/productos/views_mermas.py`
- [Physical locations](https://github.com/jadelgad0s/smartstock-multiempresa/blob/main/apps/productos/views_ubicaciones.py): `apps/productos/views_ubicaciones.py`
- [Inventory reports](https://github.com/jadelgad0s/smartstock-multiempresa/blob/main/apps/productos/reportes.py): `apps/productos/reportes.py`
- [SMS alerts](https://github.com/jadelgad0s/smartstock-multiempresa/blob/main/apps/productos/alertas_sms.py): `apps/productos/alertas_sms.py`

### Identity and oversight

- [Users and roles](https://github.com/jadelgad0s/smartstock-multiempresa/blob/main/apps/usuarios/models.py): `apps/usuarios/models.py`
- [Authentication API](https://github.com/jadelgad0s/smartstock-multiempresa/blob/main/apps/usuarios/views_auth.py): `apps/usuarios/views_auth.py`
- [Permissions](https://github.com/jadelgad0s/smartstock-multiempresa/blob/main/apps/usuarios/permissions.py): `apps/usuarios/permissions.py`
- [Audit recording](https://github.com/jadelgad0s/smartstock-multiempresa/blob/main/apps/core/registro_auditoria.py): `apps/core/registro_auditoria.py`
- [Audit history](https://github.com/jadelgad0s/smartstock-multiempresa/blob/main/apps/core/models.py): `apps/core/models.py`

### Platform services

- [Support authorization](https://github.com/jadelgad0s/smartstock-multiempresa/blob/main/esquema_multiempresa/autorizacion_soporte.py): `esquema_multiempresa/autorizacion_soporte.py`
- [Platform panel](https://github.com/jadelgad0s/smartstock-multiempresa/tree/main/esquema_multiempresa): `esquema_multiempresa`
- [Contact inbox](https://github.com/jadelgad0s/smartstock-multiempresa/blob/main/esquema_multiempresa/buzon_contacto.py): `esquema_multiempresa/buzon_contacto.py`

### Other components

- **Company user**
- **SMS provider**

## Connections

- Company user → Web entry: opens (evidence: `README.md`)
- Web entry → Authentication API: routes auth (evidence: `config/urls.py`)
- Web entry → Inventory API: routes inventory (evidence: `config/urls.py`)
- Company user → Shared login: signs in (evidence: `README.md`)
- Shared login → Company directory: selects company
- Company directory → Company data: isolates data (evidence: `README.md`)
- Inventory API → Product catalog: manages products (evidence: `apps/productos/views.py`)
- Inventory API → Warehouse stock: annotates stock (evidence: `apps/productos/views.py`)
- Inventory API → Users and roles: checks permissions
- Inventory API → Lots and FIFO: supports lots (evidence: `README.md`)
- Inventory API → Warehouse transfers: supports transfers (evidence: `README.md`)
- Inventory API → Losses and write-offs: records losses (evidence: `README.md`)
- Inventory API → Physical locations: manages locations (evidence: `README.md`)
- Inventory API → Inventory reports: provides reports (evidence: `README.md`)
- Inventory API → SMS alerts: supports alerts (evidence: `README.md`)
- SMS alerts → SMS provider: sends SMS
- Authentication API → Users and roles: authenticates (evidence: `apps/usuarios/views_auth.py`)
- Authentication API → Audit recording: records login (evidence: `apps/usuarios/views_auth.py`)
- Audit recording → Audit history: writes events (evidence: `apps/core/registro_auditoria.py`)
- Company user → Platform panel: uses platform (evidence: `README.md`)
- Platform panel → Support authorization: authorizes support (evidence: `esquema_multiempresa/selenium_suite.py`)
- Company user → Contact inbox: contacts support (evidence: `README.md`)
