# rocioglopez/socios_ventas architecture

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

- Interactive diagram: https://gitdiagram.com/rocioglopez/socios_ventas
- Repository: https://github.com/rocioglopez/socios_ventas

## Overview

This repository contains two related implementations of the same purchasing-management domain, plus some shared data artifacts. The main architectural split is between a .NET MVC application in `Sprint-1/Sprint 1` and a smaller Flask/Vue application in `ERPCompras`.

The `Sprint-1/Sprint 1` project is the most complete backend-centric system. It is an ASP.NET Core 8 MVC app with server-rendered Razor views, controller-driven routing, EF Core data access, and a relational database schema managed through migrations. `Program.cs`, `AppDbContext.cs`, and the migration history show the classic layered MVC structure: controllers orchestrate use cases, models/view models shape data, and views render HTML responses.

Its core business modules are separated by controller and view area: `Account` for authentication and profile flows, `Solicitudes` for purchase requests and approval workflows, `Ordenes` for purchase orders, `Inventario` for stock control, `Proveedores` for supplier evaluation/history, `Reportes` for cost analytics, `Historial` for purchase history, `Contratos` for contract tracking, and `Bitacora` for audit logging. This is the main functional boundary map for the application.

The persistence layer in Sprint-1 is relational and migration-based. The `Models` folder defines the domain entities and view models such as `SolicitudCompra`, `OrdenCompra`, `InventarioProducto`, `Proveedor`, `EvaluacionProveedor`, `NotificacionCompra`, `AlertaInventario`, and `Bitacora`. EF Core migrations indicate schema evolution for inventory history, received orders, cost analysis, inventory replenishment seed data, and audit trail support.

There is a small service layer in Sprint-1, centered on `BitacoraService`. That suggests cross-cutting logging/audit behavior is abstracted away from controllers, while most other business logic still appears to live close to the MVC boundary. `Views/Shared/_Layout.cshtml` and the static assets under `wwwroot` provide the UI shell, Bootstrap styling, jQuery validation, and client-side scripts.

The `ERPCompras` folder is a separate Flask-based implementation with a different architectural style. `Backend/app.py` is the backend entry point, `templates/` contains Jinja-rendered pages for login, dashboard, register, password recovery, and profile, and `static/js/mensajes.js` holds browser-side behavior. This side of the repo is much more file-backed and lightweight than the .NET app.

In `ERPCompras`, application state is stored in JSON files under `data/` rather than in a relational database. The named files map directly to business entities: `users.json`, `solicitudes_compra.json`, `inventario.json`, `alertas_inventario.json`, and `notificaciones.json`. That means the backend likely reads and writes these files directly to persist users, requests, inventory, alerts, and notifications.

`ERPCompras/frontend` is a separate Vue 3 + Vite client. Its `src/App.vue`, `main.js`, and components like `Inventario.vue` and `Historial.vue` show a component-based frontend for selected modules rather than the whole system. This frontend likely consumes the Flask backend or shared JSON-driven endpoints and complements the server-rendered Flask templates.

Session handling is explicit in the Flask side: the `flask_session` directory indicates server-side session storage rather than purely cookie-based state. That matters architecturally because authentication and login state are persisted on the server filesystem, not just in the browser.

The most important data flow in both implementations is the same business pipeline: users authenticate, create purchase requests, approvals generate purchase orders, received orders update inventory, and low stock produces alerts/notifications. Supplier evaluation and historical reporting sit alongside that pipeline as analytical and audit-oriented subsystems.

The repo also includes repository-level artifacts for runtime and scaffolding: Bootstrap/jQuery assets in the .NET app, Vue/Vite tooling in the Flask frontend, and multiple technology stacks overall. For an architecture diagram, the cleanest representation is two parallel application stacks sharing the same purchasing domain but using different persistence and UI strategies: MVC + EF Core + relational DB on one side, Flask + JSON storage + Vue components on the other.

Main entry points: [`Sprint-1/Sprint 1/Program.cs`](https://github.com/rocioglopez/socios_ventas/blob/HEAD/Sprint-1/Sprint%201/Program.cs) (Program), [`ERPCompras/Backend/app.py`](https://github.com/rocioglopez/socios_ventas/blob/main/ERPCompras/Backend/app.py) (Flask App), [`Sprint-1/Sprint 1/Controllers/OrdenesController.cs`](https://github.com/rocioglopez/socios_ventas/blob/HEAD/Sprint-1/Sprint%201/Controllers/OrdenesController.cs) (Ordenes), [`Sprint-1/Sprint 1/Controllers/InventarioController.cs`](https://github.com/rocioglopez/socios_ventas/blob/HEAD/Sprint-1/Sprint%201/Controllers/InventarioController.cs) (Inventario)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dotnet_mvc[".NET MVC app"]
  node_sprint_program["Program<br/>startup<br/>[Program.cs]"]
  node_sprint_db["Db Context<br/>EF Core<br/>[AppDbContext.cs]"]
  node_ctrl_account["Account<br/>mvc controller"]
  node_ctrl_solicitudes["Solicitudes<br/>mvc controller"]
  node_ctrl_ordenes["Ordenes<br/>mvc controller"]
  node_ctrl_inventario["Inventario<br/>mvc controller"]
  node_ctrl_proveedores["Proveedores<br/>mvc controller"]
  node_ctrl_reportes["Reportes<br/>mvc controller"]
  node_ctrl_bitacora["Bitacora<br/>mvc controller"]
  node_svc_bitacora["Bitacora Service<br/>cross-cutting service<br/>[BitacoraService.cs]"]
  node_model_solicitud["Solicitud<br/>domain model<br/>[SolicitudCompra.cs]"]
  node_model_orden["Orden<br/>domain model<br/>[OrdenCompra.cs]"]
  node_model_inventario["Inventario<br/>domain model"]
  node_model_proveedor["Proveedor<br/>domain model<br/>[Proveedor.cs]"]
  node_layout["Shared Layout<br/>razor shell<br/>[_Layout.cshtml]"]
end

subgraph group_flask_vue["Flask + Vue app"]
  node_flask_app["Flask App<br/>backend entry<br/>[app.py]"]
  node_json_data["JSON Data<br/>file storage"]
  node_flask_templates["Templates<br/>jinja views"]
  node_session_store["Session Store<br/>server session"]
  node_vue_main["Vue Entry<br/>spa bootstrap<br/>[main.js]"]
  node_vue_inventario["Inventario UI<br/>vue component<br/>[Inventario.vue]"]
  node_vue_historial["Historial UI<br/>vue component<br/>[Historial.vue]"]
  node_mensajes_js["Mensajes JS<br/>browser script<br/>[mensajes.js]"]
end

node_sprint_program -->|"configures"| node_sprint_db
node_sprint_program -->|"hosts"| node_ctrl_account
node_sprint_program -->|"serves"| node_layout
node_ctrl_solicitudes -->|"reads/writes"| node_model_solicitud
node_ctrl_solicitudes -->|"leads to"| node_ctrl_ordenes
node_ctrl_ordenes -->|"manages"| node_model_orden
node_ctrl_ordenes -->|"updates"| node_ctrl_inventario
node_ctrl_inventario -->|"manages"| node_model_inventario
node_ctrl_proveedores -->|"manages"| node_model_proveedor
node_ctrl_reportes -->|"queries"| node_sprint_db
node_ctrl_bitacora -->|"uses"| node_svc_bitacora
node_svc_bitacora -->|"persists"| node_sprint_db
node_flask_app -->|"reads/writes"| node_json_data
node_flask_app -->|"renders"| node_flask_templates
node_flask_app -->|"stores"| node_session_store
node_vue_main -->|"imports"| node_vue_inventario
node_vue_main -->|"imports"| node_vue_historial
node_mensajes_js -->|"enhances"| node_flask_templates
node_flask_templates -->|"backed by"| node_json_data
node_ctrl_inventario -->|"audits"| node_ctrl_bitacora

click node_sprint_program "https://github.com/rocioglopez/socios_ventas/blob/main/Sprint-1/Sprint 1/Program.cs"
click node_sprint_db "https://github.com/rocioglopez/socios_ventas/blob/main/Sprint-1/Sprint 1/Data/AppDbContext.cs"
click node_ctrl_account "https://github.com/rocioglopez/socios_ventas/blob/main/Sprint-1/Sprint 1/Controllers/AccountController.cs"
click node_ctrl_solicitudes "https://github.com/rocioglopez/socios_ventas/blob/main/Sprint-1/Sprint 1/Controllers/SolicitudesController.cs"
click node_ctrl_ordenes "https://github.com/rocioglopez/socios_ventas/blob/main/Sprint-1/Sprint 1/Controllers/OrdenesController.cs"
click node_ctrl_inventario "https://github.com/rocioglopez/socios_ventas/blob/main/Sprint-1/Sprint 1/Controllers/InventarioController.cs"
click node_ctrl_proveedores "https://github.com/rocioglopez/socios_ventas/blob/main/Sprint-1/Sprint 1/Controllers/ProveedoresController.cs"
click node_ctrl_reportes "https://github.com/rocioglopez/socios_ventas/blob/main/Sprint-1/Sprint 1/Controllers/ReportesController.cs"
click node_ctrl_bitacora "https://github.com/rocioglopez/socios_ventas/blob/main/Sprint-1/Sprint 1/Controllers/BitacoraController.cs"
click node_svc_bitacora "https://github.com/rocioglopez/socios_ventas/blob/main/Sprint-1/Sprint 1/Services/BitacoraService.cs"
click node_model_solicitud "https://github.com/rocioglopez/socios_ventas/blob/main/Sprint-1/Sprint 1/Models/SolicitudCompra.cs"
click node_model_orden "https://github.com/rocioglopez/socios_ventas/blob/main/Sprint-1/Sprint 1/Models/OrdenCompra.cs"
click node_model_inventario "https://github.com/rocioglopez/socios_ventas/blob/main/Sprint-1/Sprint 1/Models/InventarioProducto.cs"
click node_model_proveedor "https://github.com/rocioglopez/socios_ventas/blob/main/Sprint-1/Sprint 1/Models/Proveedor.cs"
click node_layout "https://github.com/rocioglopez/socios_ventas/blob/main/Sprint-1/Sprint 1/Views/Shared/_Layout.cshtml"
click node_flask_app "https://github.com/rocioglopez/socios_ventas/blob/main/ERPCompras/Backend/app.py"
click node_json_data "https://github.com/rocioglopez/socios_ventas/tree/main/ERPCompras/data"
click node_flask_templates "https://github.com/rocioglopez/socios_ventas/tree/main/ERPCompras/templates"
click node_session_store "https://github.com/rocioglopez/socios_ventas/tree/main/ERPCompras/flask_session"
click node_vue_main "https://github.com/rocioglopez/socios_ventas/blob/main/ERPCompras/frontend/src/main.js"
click node_vue_inventario "https://github.com/rocioglopez/socios_ventas/blob/main/ERPCompras/frontend/src/components/Inventario.vue"
click node_vue_historial "https://github.com/rocioglopez/socios_ventas/blob/main/ERPCompras/frontend/src/components/Historial.vue"
click node_mensajes_js "https://github.com/rocioglopez/socios_ventas/blob/main/ERPCompras/static/js/mensajes.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_sprint_program,node_sprint_db,node_ctrl_account,node_ctrl_solicitudes,node_ctrl_ordenes,node_ctrl_inventario,node_ctrl_proveedores,node_ctrl_reportes,node_ctrl_bitacora,node_svc_bitacora,node_model_solicitud,node_model_orden,node_model_inventario,node_model_proveedor,node_layout toneBlue
class node_flask_app,node_json_data,node_flask_templates,node_session_store,node_vue_main,node_vue_inventario,node_vue_historial,node_mensajes_js toneAmber
```

## Components

### .NET MVC app

ASP.NET Core 8 application with Razor views, controllers, EF Core, and migrations.

- [Program](https://github.com/rocioglopez/socios_ventas/blob/HEAD/Sprint-1/Sprint%201/Program.cs): startup · ASP.NET Core host and composition root. · `Sprint-1/Sprint 1/Program.cs`
- [Db Context](https://github.com/rocioglopez/socios_ventas/blob/HEAD/Sprint-1/Sprint%201/Data/AppDbContext.cs): EF Core · Relational persistence and model mapping. · `Sprint-1/Sprint 1/Data/AppDbContext.cs`
- [Account](https://github.com/rocioglopez/socios_ventas/blob/HEAD/Sprint-1/Sprint%201/Controllers/AccountController.cs): mvc controller · Authentication and profile flows. · `Sprint-1/Sprint 1/Controllers/AccountController.cs`
- [Solicitudes](https://github.com/rocioglopez/socios_ventas/blob/HEAD/Sprint-1/Sprint%201/Controllers/SolicitudesController.cs): mvc controller · Purchase request workflow and approvals. · `Sprint-1/Sprint 1/Controllers/SolicitudesController.cs`
- [Ordenes](https://github.com/rocioglopez/socios_ventas/blob/HEAD/Sprint-1/Sprint%201/Controllers/OrdenesController.cs): mvc controller · Purchase order handling. · `Sprint-1/Sprint 1/Controllers/OrdenesController.cs`
- [Inventario](https://github.com/rocioglopez/socios_ventas/blob/HEAD/Sprint-1/Sprint%201/Controllers/InventarioController.cs): mvc controller · Stock management and replenishment views. · `Sprint-1/Sprint 1/Controllers/InventarioController.cs`
- [Proveedores](https://github.com/rocioglopez/socios_ventas/blob/HEAD/Sprint-1/Sprint%201/Controllers/ProveedoresController.cs): mvc controller · Supplier history and evaluation. · `Sprint-1/Sprint 1/Controllers/ProveedoresController.cs`
- [Reportes](https://github.com/rocioglopez/socios_ventas/blob/HEAD/Sprint-1/Sprint%201/Controllers/ReportesController.cs): mvc controller · Cost analytics dashboard. · `Sprint-1/Sprint 1/Controllers/ReportesController.cs`
- [Bitacora](https://github.com/rocioglopez/socios_ventas/blob/HEAD/Sprint-1/Sprint%201/Controllers/BitacoraController.cs): mvc controller · Audit trail access. · `Sprint-1/Sprint 1/Controllers/BitacoraController.cs`
- [Bitacora Service](https://github.com/rocioglopez/socios_ventas/blob/HEAD/Sprint-1/Sprint%201/Services/BitacoraService.cs): cross-cutting service · Shared audit/logging behavior. · `Sprint-1/Sprint 1/Services/BitacoraService.cs`
- [Solicitud](https://github.com/rocioglopez/socios_ventas/blob/HEAD/Sprint-1/Sprint%201/Models/SolicitudCompra.cs): domain model · Purchase request entity. · `Sprint-1/Sprint 1/Models/SolicitudCompra.cs`
- [Orden](https://github.com/rocioglopez/socios_ventas/blob/HEAD/Sprint-1/Sprint%201/Models/OrdenCompra.cs): domain model · Purchase order entity. · `Sprint-1/Sprint 1/Models/OrdenCompra.cs`
- [Inventario](https://github.com/rocioglopez/socios_ventas/blob/HEAD/Sprint-1/Sprint%201/Models/InventarioProducto.cs): domain model · Inventory product entity. · `Sprint-1/Sprint 1/Models/InventarioProducto.cs`
- [Proveedor](https://github.com/rocioglopez/socios_ventas/blob/HEAD/Sprint-1/Sprint%201/Models/Proveedor.cs): domain model · Supplier entity and evaluation subject. · `Sprint-1/Sprint 1/Models/Proveedor.cs`
- [Shared Layout](https://github.com/rocioglopez/socios_ventas/blob/HEAD/Sprint-1/Sprint%201/Views/Shared/_Layout.cshtml): razor shell · Common UI shell for server-rendered pages. · `Sprint-1/Sprint 1/Views/Shared/_Layout.cshtml`

### Flask + Vue app

Flask backend with JSON persistence, server-rendered templates, and a Vue frontend.

- [Flask App](https://github.com/rocioglopez/socios_ventas/blob/main/ERPCompras/Backend/app.py): backend entry · Flask application entry point and routing layer. · `ERPCompras/Backend/app.py`
- [JSON Data](https://github.com/rocioglopez/socios_ventas/tree/main/ERPCompras/data): file storage · File-backed persistence for users, requests, inventory, alerts, and notifications. · `ERPCompras/data`
- [Templates](https://github.com/rocioglopez/socios_ventas/tree/main/ERPCompras/templates): jinja views · Server-rendered pages for login, dashboard, profile, and recovery. · `ERPCompras/templates`
- [Session Store](https://github.com/rocioglopez/socios_ventas/tree/main/ERPCompras/flask_session): server session · Filesystem-backed Flask session state. · `ERPCompras/flask_session`
- [Vue Entry](https://github.com/rocioglopez/socios_ventas/blob/main/ERPCompras/frontend/src/main.js): spa bootstrap · Vue 3 and Vite application entry. · `ERPCompras/frontend/src/main.js`
- [Inventario UI](https://github.com/rocioglopez/socios_ventas/blob/main/ERPCompras/frontend/src/components/Inventario.vue): vue component · Frontend inventory view. · `ERPCompras/frontend/src/components/Inventario.vue`
- [Historial UI](https://github.com/rocioglopez/socios_ventas/blob/main/ERPCompras/frontend/src/components/Historial.vue): vue component · Frontend history view. · `ERPCompras/frontend/src/components/Historial.vue`
- [Mensajes JS](https://github.com/rocioglopez/socios_ventas/blob/main/ERPCompras/static/js/mensajes.js): browser script · Client-side message and interaction helper. · `ERPCompras/static/js/mensajes.js`

## Connections

- Program → Db Context: configures · Bootstraps EF Core persistence and application services.
- Program → Account: hosts · Registers MVC routing and controller execution.
- Program → Shared Layout: serves · Uses the shared Razor shell for rendered pages.
- Solicitudes → Solicitud: reads/writes · Handles purchase request data.
- Solicitudes → Ordenes: leads to · Approved requests become purchase orders.
- Ordenes → Orden: manages · Creates and tracks purchase orders.
- Ordenes → Inventario: updates · Received orders flow into inventory changes.
- Inventario → Inventario: manages · Reads and updates stock records.
- Proveedores → Proveedor: manages · Maintains supplier data and evaluations.
- Reportes → Db Context: queries · Builds analytics from persisted purchasing data.
- Bitacora → Bitacora Service: uses · Delegates audit behavior to the service layer.
- Bitacora Service → Db Context: persists · Stores audit entries in the relational database.
- Flask App → JSON Data: reads/writes · Uses JSON files as the main persistence layer.
- Flask App → Templates: renders · Serves Jinja pages for core user flows.
- Flask App → Session Store: stores · Keeps server-side session state on disk.
- Vue Entry → Inventario UI: imports · Bootstraps the inventory component.
- Vue Entry → Historial UI: imports · Bootstraps the history component.
- Mensajes JS → Templates: enhances · Adds browser-side behavior to template-driven pages.
- Templates → JSON Data: backed by · Template flows align with file-backed business state.
- Inventario → Bitacora: audits · Inventory changes can be logged to the audit trail.
