# ronaldotavcano/vendinha architecture

> Architecture diagram of the GitHub repository ronaldotavcano/vendinha, 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/ronaldotavcano/vendinha
- Repository: https://github.com/ronaldotavcano/vendinha

## Overview

Vendinha is a customer and debt-management application with a Windows Forms desktop interface and a separate console entry point. The main desktop workflow starts at the home form, opens customer or debt forms, and delegates operations to services that apply validation and persistence rules through the EF Core context to PostgreSQL. Customer listing also supports search, paging, debt totals, payment, and guarded deletion. The README documents these capabilities; the graph follows shown calls and documented database use, without assuming unshown implementation details.

Main entry points: [`Vendinha.Core/Contexts/VendinhaDbContext.cs`](https://github.com/ronaldotavcano/vendinha/blob/main/Vendinha.Core/Contexts/VendinhaDbContext.cs) (EF database context), [`Vendinha.Core/Services/ClienteService.cs`](https://github.com/ronaldotavcano/vendinha/blob/main/Vendinha.Core/Services/ClienteService.cs) (Customer operations), [`Vendinha.Core/Services/DividaService.cs`](https://github.com/ronaldotavcano/vendinha/blob/main/Vendinha.Core/Services/DividaService.cs) (Debt operations), [`Vendinha.Desktop/Form1.cs`](https://github.com/ronaldotavcano/vendinha/blob/main/Vendinha.Desktop/Form1.cs) (Home form)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_presentation["User interfaces"]
  node_desktop_entry["Desktop startup<br/>[Program.cs]"]
  node_home["Home form<br/>[Form1.cs]"]
  node_customer_form["Create customer"]
  node_debt_form["Create debt<br/>[FormCriarDivida.cs]"]
  node_listing["Customer listing"]
  node_console_entry["Console interface<br/>[Program.cs]"]
end

subgraph group_business["Business services"]
  node_customer_service["Customer operations<br/>[ClienteService.cs]"]
  node_debt_service["Debt operations<br/>[DividaService.cs]"]
end

subgraph group_domain["Domain model"]
  node_customer["Customer entity<br/>[Cliente.cs]"]
  node_debt["Debt entity<br/>[Divida.cs]"]
end

subgraph group_data["Persistence"]
  node_db_context["EF database context"]
end

node_postgres[("PostgreSQL")]

node_desktop_entry -->|"launches"| node_home
node_home -->|"opens"| node_listing
node_home -->|"opens"| node_customer_form
node_home -->|"opens"| node_debt_form
node_customer_form -->|"creates via"| node_customer_service
node_debt_form -->|"creates via"| node_debt_service
node_listing -->|"lists, searches"| node_customer_service
node_listing -->|"pays, totals"| node_debt_service
node_console_entry -->|"invokes"| node_customer_service
node_console_entry -->|"invokes"| node_debt_service
node_customer_service -->|"queries, saves"| node_db_context
node_debt_service -->|"queries, saves"| node_db_context
node_customer_service -->|"validates, manages"| node_customer
node_debt_service -->|"validates, manages"| node_debt
node_db_context -->|"maps"| node_customer
node_db_context -->|"maps"| node_debt
node_db_context -->|"connects"| node_postgres

click node_desktop_entry "https://github.com/ronaldotavcano/vendinha/blob/main/Vendinha.Desktop/Program.cs"
click node_home "https://github.com/ronaldotavcano/vendinha/blob/main/Vendinha.Desktop/Form1.cs"
click node_customer_form "https://github.com/ronaldotavcano/vendinha/blob/main/Vendinha.Desktop/screens/FormCriarCliente.cs"
click node_debt_form "https://github.com/ronaldotavcano/vendinha/blob/main/Vendinha.Desktop/screens/FormCriarDivida.cs"
click node_listing "https://github.com/ronaldotavcano/vendinha/blob/main/Vendinha.Desktop/screens/FormListagemClientes.cs"
click node_console_entry "https://github.com/ronaldotavcano/vendinha/blob/main/Vendinha.Core/Program.cs"
click node_customer_service "https://github.com/ronaldotavcano/vendinha/blob/main/Vendinha.Core/Services/ClienteService.cs"
click node_debt_service "https://github.com/ronaldotavcano/vendinha/blob/main/Vendinha.Core/Services/DividaService.cs"
click node_customer "https://github.com/ronaldotavcano/vendinha/blob/main/Vendinha.Core/Models/Cliente.cs"
click node_debt "https://github.com/ronaldotavcano/vendinha/blob/main/Vendinha.Core/Models/Divida.cs"
click node_db_context "https://github.com/ronaldotavcano/vendinha/blob/main/Vendinha.Core/Contexts/VendinhaDbContext.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_desktop_entry,node_home,node_customer_form,node_debt_form,node_listing,node_console_entry toneBlue
class node_customer_service,node_debt_service,node_postgres toneAmber
class node_customer,node_debt toneMint
class node_db_context toneRose
```

## Components

### User interfaces

- [Desktop startup](https://github.com/ronaldotavcano/vendinha/blob/main/Vendinha.Desktop/Program.cs): `Vendinha.Desktop/Program.cs`
- [Home form](https://github.com/ronaldotavcano/vendinha/blob/main/Vendinha.Desktop/Form1.cs): `Vendinha.Desktop/Form1.cs`
- [Create customer](https://github.com/ronaldotavcano/vendinha/blob/main/Vendinha.Desktop/screens/FormCriarCliente.cs): `Vendinha.Desktop/screens/FormCriarCliente.cs`
- [Create debt](https://github.com/ronaldotavcano/vendinha/blob/main/Vendinha.Desktop/screens/FormCriarDivida.cs): `Vendinha.Desktop/screens/FormCriarDivida.cs`
- [Customer listing](https://github.com/ronaldotavcano/vendinha/blob/main/Vendinha.Desktop/screens/FormListagemClientes.cs): `Vendinha.Desktop/screens/FormListagemClientes.cs`
- [Console interface](https://github.com/ronaldotavcano/vendinha/blob/main/Vendinha.Core/Program.cs): `Vendinha.Core/Program.cs`

### Business services

- [Customer operations](https://github.com/ronaldotavcano/vendinha/blob/main/Vendinha.Core/Services/ClienteService.cs): `Vendinha.Core/Services/ClienteService.cs`
- [Debt operations](https://github.com/ronaldotavcano/vendinha/blob/main/Vendinha.Core/Services/DividaService.cs): `Vendinha.Core/Services/DividaService.cs`

### Domain model

- [Customer entity](https://github.com/ronaldotavcano/vendinha/blob/main/Vendinha.Core/Models/Cliente.cs): `Vendinha.Core/Models/Cliente.cs`
- [Debt entity](https://github.com/ronaldotavcano/vendinha/blob/main/Vendinha.Core/Models/Divida.cs): `Vendinha.Core/Models/Divida.cs`

### Persistence

- [EF database context](https://github.com/ronaldotavcano/vendinha/blob/main/Vendinha.Core/Contexts/VendinhaDbContext.cs): `Vendinha.Core/Contexts/VendinhaDbContext.cs`

### Other components

- **PostgreSQL**

## Connections

- Desktop startup → Home form: launches (evidence: `Vendinha.Desktop/Program.cs`)
- Home form → Customer listing: opens (evidence: `Vendinha.Desktop/Form1.cs`)
- Home form → Create customer: opens (evidence: `Vendinha.Desktop/Form1.cs`)
- Home form → Create debt: opens (evidence: `Vendinha.Desktop/Form1.cs`)
- Create customer → Customer operations: creates via (evidence: `Vendinha.Desktop/screens/FormCriarCliente.cs`)
- Create debt → Debt operations: creates via (evidence: `Vendinha.Desktop/screens/FormCriarDivida.cs`)
- Customer listing → Customer operations: lists, searches (evidence: `Vendinha.Desktop/screens/FormListagemClientes.cs`)
- Customer listing → Debt operations: pays, totals (evidence: `Vendinha.Desktop/screens/FormListagemClientes.cs`)
- Console interface → Customer operations: invokes (evidence: `Vendinha.Core/Program.cs`)
- Console interface → Debt operations: invokes (evidence: `Vendinha.Core/Program.cs`)
- Customer operations → EF database context: queries, saves (evidence: `Vendinha.Core/Services/ClienteService.cs`)
- Debt operations → EF database context: queries, saves (evidence: `Vendinha.Core/Services/DividaService.cs`)
- Customer operations → Customer entity: validates, manages (evidence: `Vendinha.Core/Services/ClienteService.cs`)
- Debt operations → Debt entity: validates, manages (evidence: `Vendinha.Core/Services/DividaService.cs`)
- EF database context → Customer entity: maps (evidence: `Vendinha.Core/Contexts/VendinhaDbContext.cs`)
- EF database context → Debt entity: maps (evidence: `Vendinha.Core/Contexts/VendinhaDbContext.cs`)
- EF database context → PostgreSQL: connects (evidence: `Vendinha.Core/Contexts/VendinhaDbContext.cs`)
