# pablosazycz/farmacia architecture

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

- Interactive diagram: https://gitdiagram.com/pablosazycz/farmacia
- Repository: https://github.com/pablosazycz/farmacia

## Overview

Farmacia is an ASP.NET Core pharmacy-management application. Staff use its web controllers to manage medicines, inventory, customers, promotions, and sales; the sales service handles transaction logic, while ticket generation is a separate capability. Identity pages provide login, registration, and administration. The source index and excerpts establish controller/service and service/data dependencies, but do not expose ticket behavior or the full web-view workflow, so those links are limited to documented references.

Main entry points: [`Farmacia/Data/ApplicationDbContext.cs`](https://github.com/pablosazycz/farmacia/blob/master/Farmacia/Data/ApplicationDbContext.cs) (Application database), [`Farmacia/Controllers`](https://github.com/pablosazycz/farmacia/tree/master/Farmacia/Controllers) (Management controllers), [`Farmacia/Services/VentaService.cs`](https://github.com/pablosazycz/farmacia/blob/master/Farmacia/Services/VentaService.cs) (Sales service), [`Farmacia/Services/MovimientoStockService.cs`](https://github.com/pablosazycz/farmacia/blob/master/Farmacia/Services/MovimientoStockService.cs) (Stock movements)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web and identity"]
  node_controllers["Management controllers"]
  node_identity["Identity pages"]
end

subgraph group_catalog["Catalog and inventory"]
  node_product_service["Product service<br/>[ProductoService.cs]"]
  node_drug_service["Drug service<br/>[DrogaService.cs]"]
  node_lot_service["Lot service<br/>[LoteService.cs]"]
  node_stock_service["Stock movements"]
  node_catalog_models["Products and drugs<br/>[Producto.cs]"]
  node_lot_model["Lots<br/>[Lote.cs]"]
  node_stock_model["Stock movement records<br/>[MovimientoStock.cs]"]
end

subgraph group_commerce["Sales and loyalty"]
  node_sale_service["Sales service<br/>[VentaService.cs]"]
  node_client_service["Customer service<br/>[ClienteService.cs]"]
  node_promotion_service["Promotion service"]
  node_ticket_service["Ticket service<br/>[TicketService.cs]"]
  node_sale_model["Sales and details<br/>[Venta.cs]"]
  node_customer_model["Customers and points<br/>[Cliente.cs]"]
  node_promotion_model["Promotions and use<br/>[Promocion.cs]"]
end

subgraph group_persistence["Persistence and domain"]
  node_db[("Application database")]
  node_startup["Application startup<br/>[Program.cs]"]
end

node_staff(("Pharmacy staff"))

node_staff -.->|"uses"| node_controllers
node_staff -.->|"authenticates"| node_identity
node_controllers -->|"calls"| node_product_service
node_controllers -->|"calls"| node_drug_service
node_controllers -->|"calls"| node_lot_service
node_controllers -->|"calls"| node_stock_service
node_controllers -->|"calls"| node_sale_service
node_controllers -->|"calls"| node_client_service
node_controllers -->|"calls"| node_promotion_service
node_controllers -->|"calls"| node_ticket_service
node_product_service -->|"queries"| node_db
node_drug_service -->|"queries"| node_db
node_lot_service -->|"queries"| node_db
node_stock_service -->|"updates"| node_db
node_sale_service -->|"persists"| node_db
node_client_service -->|"persists"| node_db
node_promotion_service -->|"queries"| node_db
node_lot_service -->|"uses"| node_stock_service
node_sale_service -->|"records stock"| node_stock_service
node_sale_service -->|"awards points"| node_client_service
node_startup -->|"configures"| node_db
node_startup -->|"registers"| node_sale_service
node_startup -->|"registers"| node_product_service
node_db -->|"maps"| node_catalog_models
node_db -->|"maps"| node_lot_model
node_db -->|"maps"| node_stock_model
node_db -->|"maps"| node_sale_model
node_db -->|"maps"| node_customer_model
node_db -->|"maps"| node_promotion_model

click node_controllers "https://github.com/pablosazycz/farmacia/tree/master/Farmacia/Controllers"
click node_identity "https://github.com/pablosazycz/farmacia/tree/master/Farmacia/Areas/Identity/Pages"
click node_product_service "https://github.com/pablosazycz/farmacia/blob/master/Farmacia/Services/ProductoService.cs"
click node_drug_service "https://github.com/pablosazycz/farmacia/blob/master/Farmacia/Services/DrogaService.cs"
click node_lot_service "https://github.com/pablosazycz/farmacia/blob/master/Farmacia/Services/LoteService.cs"
click node_stock_service "https://github.com/pablosazycz/farmacia/blob/master/Farmacia/Services/MovimientoStockService.cs"
click node_catalog_models "https://github.com/pablosazycz/farmacia/blob/master/Farmacia/Models/Producto.cs"
click node_lot_model "https://github.com/pablosazycz/farmacia/blob/master/Farmacia/Models/Lote.cs"
click node_stock_model "https://github.com/pablosazycz/farmacia/blob/master/Farmacia/Models/MovimientoStock.cs"
click node_sale_service "https://github.com/pablosazycz/farmacia/blob/master/Farmacia/Services/VentaService.cs"
click node_client_service "https://github.com/pablosazycz/farmacia/blob/master/Farmacia/Services/ClienteService.cs"
click node_promotion_service "https://github.com/pablosazycz/farmacia/blob/master/Farmacia/Services/PromocionService.cs"
click node_ticket_service "https://github.com/pablosazycz/farmacia/blob/master/Farmacia/Services/TicketService.cs"
click node_sale_model "https://github.com/pablosazycz/farmacia/blob/master/Farmacia/Models/Venta.cs"
click node_customer_model "https://github.com/pablosazycz/farmacia/blob/master/Farmacia/Models/Cliente.cs"
click node_promotion_model "https://github.com/pablosazycz/farmacia/blob/master/Farmacia/Models/Promocion.cs"
click node_db "https://github.com/pablosazycz/farmacia/blob/master/Farmacia/Data/ApplicationDbContext.cs"
click node_startup "https://github.com/pablosazycz/farmacia/blob/master/Farmacia/Program.cs"

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_controllers,node_identity toneBlue
class node_product_service,node_drug_service,node_lot_service,node_stock_service,node_catalog_models,node_lot_model,node_stock_model toneAmber
class node_sale_service,node_client_service,node_promotion_service,node_ticket_service,node_sale_model,node_customer_model,node_promotion_model toneMint
class node_db,node_startup toneRose
class node_staff toneIndigo
```

## Components

### Web and identity

- [Management controllers](https://github.com/pablosazycz/farmacia/tree/master/Farmacia/Controllers): `Farmacia/Controllers`
- [Identity pages](https://github.com/pablosazycz/farmacia/tree/master/Farmacia/Areas/Identity/Pages): `Farmacia/Areas/Identity/Pages`

### Catalog and inventory

- [Product service](https://github.com/pablosazycz/farmacia/blob/master/Farmacia/Services/ProductoService.cs): `Farmacia/Services/ProductoService.cs`
- [Drug service](https://github.com/pablosazycz/farmacia/blob/master/Farmacia/Services/DrogaService.cs): `Farmacia/Services/DrogaService.cs`
- [Lot service](https://github.com/pablosazycz/farmacia/blob/master/Farmacia/Services/LoteService.cs): `Farmacia/Services/LoteService.cs`
- [Stock movements](https://github.com/pablosazycz/farmacia/blob/master/Farmacia/Services/MovimientoStockService.cs): `Farmacia/Services/MovimientoStockService.cs`
- [Products and drugs](https://github.com/pablosazycz/farmacia/blob/master/Farmacia/Models/Producto.cs): `Farmacia/Models/Producto.cs`
- [Lots](https://github.com/pablosazycz/farmacia/blob/master/Farmacia/Models/Lote.cs): `Farmacia/Models/Lote.cs`
- [Stock movement records](https://github.com/pablosazycz/farmacia/blob/master/Farmacia/Models/MovimientoStock.cs): `Farmacia/Models/MovimientoStock.cs`

### Sales and loyalty

- [Sales service](https://github.com/pablosazycz/farmacia/blob/master/Farmacia/Services/VentaService.cs): `Farmacia/Services/VentaService.cs`
- [Customer service](https://github.com/pablosazycz/farmacia/blob/master/Farmacia/Services/ClienteService.cs): `Farmacia/Services/ClienteService.cs`
- [Promotion service](https://github.com/pablosazycz/farmacia/blob/master/Farmacia/Services/PromocionService.cs): `Farmacia/Services/PromocionService.cs`
- [Ticket service](https://github.com/pablosazycz/farmacia/blob/master/Farmacia/Services/TicketService.cs): `Farmacia/Services/TicketService.cs`
- [Sales and details](https://github.com/pablosazycz/farmacia/blob/master/Farmacia/Models/Venta.cs): `Farmacia/Models/Venta.cs`
- [Customers and points](https://github.com/pablosazycz/farmacia/blob/master/Farmacia/Models/Cliente.cs): `Farmacia/Models/Cliente.cs`
- [Promotions and use](https://github.com/pablosazycz/farmacia/blob/master/Farmacia/Models/Promocion.cs): `Farmacia/Models/Promocion.cs`

### Persistence and domain

- [Application database](https://github.com/pablosazycz/farmacia/blob/master/Farmacia/Data/ApplicationDbContext.cs): `Farmacia/Data/ApplicationDbContext.cs`
- [Application startup](https://github.com/pablosazycz/farmacia/blob/master/Farmacia/Program.cs): `Farmacia/Program.cs`

### Other components

- **Pharmacy staff**

## Connections

- Pharmacy staff → Management controllers: uses
- Pharmacy staff → Identity pages: authenticates
- Management controllers → Product service: calls (evidence: `Farmacia/Controllers/ProductosController.cs`)
- Management controllers → Drug service: calls (evidence: `Farmacia/Controllers/DrogasController.cs`)
- Management controllers → Lot service: calls (evidence: `Farmacia/Controllers/MovimientoStockController.cs`)
- Management controllers → Stock movements: calls (evidence: `Farmacia/Controllers/MovimientoStockController.cs`)
- Management controllers → Sales service: calls (evidence: `Farmacia/Controllers/VentasController.cs`)
- Management controllers → Customer service: calls (evidence: `Farmacia/Controllers/VentasController.cs`)
- Management controllers → Promotion service: calls (evidence: `Farmacia/Controllers/VentasController.cs`)
- Management controllers → Ticket service: calls (evidence: `Farmacia/Controllers/VentasController.cs`)
- Product service → Application database: queries (evidence: `Farmacia/Services/ProductoService.cs`)
- Drug service → Application database: queries (evidence: `Farmacia/Services/DrogaService.cs`)
- Lot service → Application database: queries (evidence: `Farmacia/Services/LoteService.cs`)
- Stock movements → Application database: updates (evidence: `Farmacia/Services/MovimientoStockService.cs`)
- Sales service → Application database: persists (evidence: `Farmacia/Services/VentaService.cs`)
- Customer service → Application database: persists (evidence: `Farmacia/Services/ClienteService.cs`)
- Promotion service → Application database: queries (evidence: `Farmacia/Services/PromocionService.cs`)
- Lot service → Stock movements: uses (evidence: `Farmacia/Services/LoteService.cs`)
- Sales service → Stock movements: records stock (evidence: `Farmacia/Services/VentaService.cs`)
- Sales service → Customer service: awards points (evidence: `Farmacia/Services/VentaService.cs`)
- Application startup → Application database: configures (evidence: `Farmacia/Program.cs`)
- Application startup → Sales service: registers (evidence: `Farmacia/Program.cs`)
- Application startup → Product service: registers (evidence: `Farmacia/Program.cs`)
- Application database → Products and drugs: maps (evidence: `Farmacia/Data/ApplicationDbContext.cs`)
- Application database → Lots: maps (evidence: `Farmacia/Data/ApplicationDbContext.cs`)
- Application database → Stock movement records: maps (evidence: `Farmacia/Data/ApplicationDbContext.cs`)
- Application database → Sales and details: maps (evidence: `Farmacia/Data/ApplicationDbContext.cs`)
- Application database → Customers and points: maps (evidence: `Farmacia/Data/ApplicationDbContext.cs`)
- Application database → Promotions and use: maps (evidence: `Farmacia/Data/ApplicationDbContext.cs`)
