# willydevelop/supermercado architecture

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

- Interactive diagram: https://gitdiagram.com/willydevelop/supermercado
- Repository: https://github.com/willydevelop/supermercado

## Overview

This is a Java Swing supermarket-management application. Its user workflow starts at the main window, opens product, customer, employee, or sales screens, and passes actions through controllers to a singleton service that manages in-memory catalog, customer, and employee data. Sales validate registered customers and stock, record purchases, and decrement inventory. Product subtypes implement category-specific pricing, promotions, and tax behavior; employee subtypes calculate salaries. The source index supports the main wiring, but several controller and UI bodies were not excerpted, so edges rely on indexed references or README descriptions.

Main entry points: [`modelo/service/SupermercadoService.java`](https://github.com/willydevelop/supermercado/blob/main/modelo/service/SupermercadoService.java) (Supermarket service), [`controlador/CtrlPrincipal.java`](https://github.com/willydevelop/supermercado/blob/main/controlador/CtrlPrincipal.java) (Navigation controller), [`vista/UITheme.java`](https://github.com/willydevelop/supermercado/blob/main/vista/UITheme.java) (UI theme), [`Main.java`](https://github.com/willydevelop/supermercado/blob/main/Main.java) (Application startup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Desktop interface"]
  node_home["Main window<br/>[FrmPrincipal.java]"]
  node_theme["UI theme<br/>[UITheme.java]"]
  node_customer_ui["Customer screen<br/>[FrmCliente.java]"]
  node_product_ui["Product screen<br/>[FrmProducto.java]"]
  node_employee_ui["Employee screen<br/>[FrmEmpleado.java]"]
  node_sale_ui["Sales screen<br/>[FrmVenta.java]"]
end

subgraph group_control["Application control"]
  node_main["Application startup<br/>[Main.java]"]
  node_home_ctrl["Navigation controller<br/>[CtrlPrincipal.java]"]
  node_customer_ctrl["Customer controller<br/>[CtrlCliente.java]"]
  node_product_ctrl["Product controller<br/>[CtrlProducto.java]"]
  node_employee_ctrl["Employee controller<br/>[CtrlEmpleado.java]"]
  node_sale_ctrl["Sales controller<br/>[CtrlVenta.java]"]
end

subgraph group_domain["Business domain"]
  node_customers["Customer models<br/>[Cliente.java]"]
  node_employees["Employee models<br/>[Empleado.java]"]
  node_products["Product models<br/>[Producto.java]"]
  node_product_types["Product categories"]
  node_business_rules["Pricing contracts<br/>[Promocionable.java]"]
  node_sale_errors["Sale exceptions"]
end

subgraph group_state["In-memory state"]
  node_service[("Supermarket service")]
  node_seed["Sample data loader"]
end

node_user(("Supermarket user"))

node_user -->|"uses"| node_home
node_main -->|"initializes"| node_service
node_main -->|"loads sample data"| node_seed
node_main -->|"opens"| node_home
node_home -->|"routes actions"| node_home_ctrl
node_home_ctrl -->|"opens"| node_customer_ui
node_home_ctrl -->|"opens"| node_product_ui
node_home_ctrl -->|"opens"| node_employee_ui
node_home_ctrl -->|"opens"| node_sale_ui
node_customer_ui -.->|"submits actions"| node_customer_ctrl
node_product_ui -->|"submits actions"| node_product_ctrl
node_employee_ui -->|"submits actions"| node_employee_ctrl
node_sale_ui -->|"submits actions"| node_sale_ctrl
node_customer_ctrl -->|"manages customers"| node_service
node_product_ctrl -->|"manages products"| node_service
node_employee_ctrl -->|"manages employees"| node_service
node_sale_ctrl -->|"registers purchases"| node_service
node_service -->|"records purchases"| node_customers
node_service -->|"checks stock"| node_products
node_service -->|"throws validation errors"| node_sale_errors
node_service -->|"stores employees"| node_employees
node_service -->|"stores products"| node_product_types
node_product_types -->|"extends"| node_products
node_product_types -->|"implements promotions"| node_business_rules
node_employees -.->|"specializes roles"| node_employees
node_customer_ui -->|"uses styling"| node_theme
node_employee_ui -->|"uses styling"| node_theme
node_product_ui -->|"uses styling"| node_theme
node_sale_ui -->|"uses styling"| node_theme

click node_main "https://github.com/willydevelop/supermercado/blob/main/Main.java"
click node_home "https://github.com/willydevelop/supermercado/blob/main/vista/FrmPrincipal.java"
click node_theme "https://github.com/willydevelop/supermercado/blob/main/vista/UITheme.java"
click node_customer_ui "https://github.com/willydevelop/supermercado/blob/main/vista/FrmCliente.java"
click node_product_ui "https://github.com/willydevelop/supermercado/blob/main/vista/FrmProducto.java"
click node_employee_ui "https://github.com/willydevelop/supermercado/blob/main/vista/FrmEmpleado.java"
click node_sale_ui "https://github.com/willydevelop/supermercado/blob/main/vista/FrmVenta.java"
click node_home_ctrl "https://github.com/willydevelop/supermercado/blob/main/controlador/CtrlPrincipal.java"
click node_customer_ctrl "https://github.com/willydevelop/supermercado/blob/main/controlador/CtrlCliente.java"
click node_product_ctrl "https://github.com/willydevelop/supermercado/blob/main/controlador/CtrlProducto.java"
click node_employee_ctrl "https://github.com/willydevelop/supermercado/blob/main/controlador/CtrlEmpleado.java"
click node_sale_ctrl "https://github.com/willydevelop/supermercado/blob/main/controlador/CtrlVenta.java"
click node_service "https://github.com/willydevelop/supermercado/blob/main/modelo/service/SupermercadoService.java"
click node_customers "https://github.com/willydevelop/supermercado/blob/main/modelo/clientes/Cliente.java"
click node_employees "https://github.com/willydevelop/supermercado/blob/main/modelo/empleados/Empleado.java"
click node_products "https://github.com/willydevelop/supermercado/blob/main/modelo/productos/Producto.java"
click node_product_types "https://github.com/willydevelop/supermercado/blob/main/modelo/productos/ProductoAlimenticio.java"
click node_business_rules "https://github.com/willydevelop/supermercado/blob/main/modelo/interfaces/Promocionable.java"
click node_sale_errors "https://github.com/willydevelop/supermercado/blob/main/modelo/excepciones/ClienteNoRegistradoException.java"
click node_seed "https://github.com/willydevelop/supermercado/blob/main/modelo/util/CargaDatosPrueba.java"

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_home,node_theme,node_customer_ui,node_product_ui,node_employee_ui,node_sale_ui,node_user toneBlue
class node_main,node_home_ctrl,node_customer_ctrl,node_product_ctrl,node_employee_ctrl,node_sale_ctrl toneAmber
class node_customers,node_employees,node_products,node_product_types,node_business_rules,node_sale_errors toneMint
class node_service,node_seed toneRose
```

## Components

### Desktop interface

- [Main window](https://github.com/willydevelop/supermercado/blob/main/vista/FrmPrincipal.java): `vista/FrmPrincipal.java`
- [UI theme](https://github.com/willydevelop/supermercado/blob/main/vista/UITheme.java): `vista/UITheme.java`
- [Customer screen](https://github.com/willydevelop/supermercado/blob/main/vista/FrmCliente.java): `vista/FrmCliente.java`
- [Product screen](https://github.com/willydevelop/supermercado/blob/main/vista/FrmProducto.java): `vista/FrmProducto.java`
- [Employee screen](https://github.com/willydevelop/supermercado/blob/main/vista/FrmEmpleado.java): `vista/FrmEmpleado.java`
- [Sales screen](https://github.com/willydevelop/supermercado/blob/main/vista/FrmVenta.java): `vista/FrmVenta.java`

### Application control

- [Application startup](https://github.com/willydevelop/supermercado/blob/main/Main.java): `Main.java`
- [Navigation controller](https://github.com/willydevelop/supermercado/blob/main/controlador/CtrlPrincipal.java): `controlador/CtrlPrincipal.java`
- [Customer controller](https://github.com/willydevelop/supermercado/blob/main/controlador/CtrlCliente.java): `controlador/CtrlCliente.java`
- [Product controller](https://github.com/willydevelop/supermercado/blob/main/controlador/CtrlProducto.java): `controlador/CtrlProducto.java`
- [Employee controller](https://github.com/willydevelop/supermercado/blob/main/controlador/CtrlEmpleado.java): `controlador/CtrlEmpleado.java`
- [Sales controller](https://github.com/willydevelop/supermercado/blob/main/controlador/CtrlVenta.java): `controlador/CtrlVenta.java`

### Business domain

- [Customer models](https://github.com/willydevelop/supermercado/blob/main/modelo/clientes/Cliente.java): `modelo/clientes/Cliente.java`
- [Employee models](https://github.com/willydevelop/supermercado/blob/main/modelo/empleados/Empleado.java): `modelo/empleados/Empleado.java`
- [Product models](https://github.com/willydevelop/supermercado/blob/main/modelo/productos/Producto.java): `modelo/productos/Producto.java`
- [Product categories](https://github.com/willydevelop/supermercado/blob/main/modelo/productos/ProductoAlimenticio.java): `modelo/productos/ProductoAlimenticio.java`
- [Pricing contracts](https://github.com/willydevelop/supermercado/blob/main/modelo/interfaces/Promocionable.java): `modelo/interfaces/Promocionable.java`
- [Sale exceptions](https://github.com/willydevelop/supermercado/blob/main/modelo/excepciones/ClienteNoRegistradoException.java): `modelo/excepciones/ClienteNoRegistradoException.java`

### In-memory state

- [Supermarket service](https://github.com/willydevelop/supermercado/blob/main/modelo/service/SupermercadoService.java): `modelo/service/SupermercadoService.java`
- [Sample data loader](https://github.com/willydevelop/supermercado/blob/main/modelo/util/CargaDatosPrueba.java): `modelo/util/CargaDatosPrueba.java`

### Other components

- **Supermarket user**

## Connections

- Supermarket user → Main window: uses (evidence: `Readme.md`)
- Application startup → Supermarket service: initializes (evidence: `Main.java`)
- Application startup → Sample data loader: loads sample data (evidence: `Main.java`)
- Application startup → Main window: opens (evidence: `Main.java`)
- Main window → Navigation controller: routes actions (evidence: `controlador/CtrlPrincipal.java`)
- Navigation controller → Customer screen: opens (evidence: `controlador/CtrlPrincipal.java`)
- Navigation controller → Product screen: opens (evidence: `controlador/CtrlPrincipal.java`)
- Navigation controller → Employee screen: opens (evidence: `controlador/CtrlPrincipal.java`)
- Navigation controller → Sales screen: opens (evidence: `controlador/CtrlPrincipal.java`)
- Customer screen → Customer controller: submits actions (evidence: `controlador/CtrlCliente.java`)
- Product screen → Product controller: submits actions (evidence: `vista/FrmProducto.java`)
- Employee screen → Employee controller: submits actions (evidence: `vista/FrmEmpleado.java`)
- Sales screen → Sales controller: submits actions (evidence: `vista/FrmVenta.java`)
- Customer controller → Supermarket service: manages customers (evidence: `controlador/CtrlCliente.java`)
- Product controller → Supermarket service: manages products (evidence: `controlador/CtrlProducto.java`)
- Employee controller → Supermarket service: manages employees (evidence: `controlador/CtrlEmpleado.java`)
- Sales controller → Supermarket service: registers purchases (evidence: `controlador/CtrlVenta.java`)
- Supermarket service → Customer models: records purchases (evidence: `modelo/service/SupermercadoService.java`)
- Supermarket service → Product models: checks stock (evidence: `modelo/service/SupermercadoService.java`)
- Supermarket service → Sale exceptions: throws validation errors (evidence: `modelo/service/SupermercadoService.java`)
- Supermarket service → Employee models: stores employees (evidence: `modelo/service/SupermercadoService.java`)
- Supermarket service → Product categories: stores products (evidence: `modelo/service/SupermercadoService.java`)
- Product categories → Product models: extends (evidence: `modelo/productos/ProductoAlimenticio.java`)
- Product categories → Pricing contracts: implements promotions (evidence: `modelo/productos/ProductoAlimenticio.java`)
- Employee models → Employee models: specializes roles (evidence: `modelo/empleados/Empleado.java`)
- Customer screen → UI theme: uses styling (evidence: `vista/FrmCliente.java`)
- Employee screen → UI theme: uses styling (evidence: `vista/FrmEmpleado.java`)
- Product screen → UI theme: uses styling (evidence: `vista/FrmProducto.java`)
- Sales screen → UI theme: uses styling (evidence: `vista/FrmVenta.java`)
