# alanjoao123/barberflow architecture

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

## Overview

Barbearia is a barber-shop appointment manager: customers use the Blazor WebAssembly site to check availability and create or cancel appointments through an HTTP/JSON API, which applies scheduling rules and persists data in PostgreSQL. The API also exposes barber, client, and confirmed-appointment listings. The README documents the client/API boundary; sampled source shows API routing, service behavior, and database access. The page-level HTTP calls were not sampled, so their wiring is not expanded here.

Main entry points: [`src/Barbearia.Api/Data/BarbeariaDbContext.cs`](https://github.com/alanjoao123/barberflow/blob/main/src/Barbearia.Api/Data/BarbeariaDbContext.cs) (EF data context), [`src/Barbearia.Api/Program.cs`](https://github.com/alanjoao123/barberflow/blob/main/src/Barbearia.Api/Program.cs) (HTTP routes), [`src/Barbearia.Api/Services/AgendamentoService.cs`](https://github.com/alanjoao123/barberflow/blob/main/src/Barbearia.Api/Services/AgendamentoService.cs) (Availability rules), [`src/Barbearia.Web/Pages/Agendar.razor`](https://github.com/alanjoao123/barberflow/blob/main/src/Barbearia.Web/Pages/Agendar.razor) (Appointment page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web client"]
  node_booking_ui["Appointment page<br/>[Agendar.razor]"]
  node_web_dtos["API DTOs<br/>[Dtos.cs]"]
end

subgraph group_api["API"]
  node_api_routes["HTTP routes<br/>[Program.cs]"]
end

subgraph group_domain["Scheduling domain"]
  node_availability["Availability rules"]
  node_appointment_models["Appointment entities<br/>[Models]"]
end

subgraph group_persistence["Persistence"]
  node_db_context["EF data context"]
end

node_customer(("Customer"))
node_postgres[("PostgreSQL")]

node_customer -->|"uses"| node_booking_ui
node_booking_ui -->|"HTTP/JSON requests"| node_api_routes
node_api_routes -->|"dispatches booking operations"| node_availability
node_availability -->|"queries and saves"| node_db_context
node_api_routes -->|"queries listings"| node_db_context
node_db_context -->|"maps entities"| node_appointment_models
node_availability -->|"creates and updates"| node_appointment_models
node_db_context -->|"uses configured provider"| node_postgres

click node_booking_ui "https://github.com/alanjoao123/barberflow/blob/main/src/Barbearia.Web/Pages/Agendar.razor"
click node_web_dtos "https://github.com/alanjoao123/barberflow/blob/main/src/Barbearia.Web/Models/Dtos.cs"
click node_api_routes "https://github.com/alanjoao123/barberflow/blob/main/src/Barbearia.Api/Program.cs"
click node_availability "https://github.com/alanjoao123/barberflow/blob/main/src/Barbearia.Api/Services/AgendamentoService.cs"
click node_appointment_models "https://github.com/alanjoao123/barberflow/tree/main/src/Barbearia.Api/Models"
click node_db_context "https://github.com/alanjoao123/barberflow/blob/main/src/Barbearia.Api/Data/BarbeariaDbContext.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_booking_ui,node_web_dtos toneBlue
class node_api_routes,node_postgres toneAmber
class node_availability,node_appointment_models toneMint
class node_db_context toneRose
class node_customer toneIndigo
```

## Components

### Web client

- [Appointment page](https://github.com/alanjoao123/barberflow/blob/main/src/Barbearia.Web/Pages/Agendar.razor): `src/Barbearia.Web/Pages/Agendar.razor`
- [API DTOs](https://github.com/alanjoao123/barberflow/blob/main/src/Barbearia.Web/Models/Dtos.cs): `src/Barbearia.Web/Models/Dtos.cs`

### API

- [HTTP routes](https://github.com/alanjoao123/barberflow/blob/main/src/Barbearia.Api/Program.cs): `src/Barbearia.Api/Program.cs`

### Scheduling domain

- [Availability rules](https://github.com/alanjoao123/barberflow/blob/main/src/Barbearia.Api/Services/AgendamentoService.cs): `src/Barbearia.Api/Services/AgendamentoService.cs`
- [Appointment entities](https://github.com/alanjoao123/barberflow/tree/main/src/Barbearia.Api/Models): `src/Barbearia.Api/Models`

### Persistence

- [EF data context](https://github.com/alanjoao123/barberflow/blob/main/src/Barbearia.Api/Data/BarbeariaDbContext.cs): `src/Barbearia.Api/Data/BarbeariaDbContext.cs`

### Other components

- **Customer**
- **PostgreSQL**

## Connections

- Customer → Appointment page: uses
- Appointment page → HTTP routes: HTTP/JSON requests (evidence: `README.md`)
- HTTP routes → Availability rules: dispatches booking operations (evidence: `src/Barbearia.Api/Program.cs`)
- Availability rules → EF data context: queries and saves (evidence: `src/Barbearia.Api/Services/AgendamentoService.cs`)
- HTTP routes → EF data context: queries listings (evidence: `src/Barbearia.Api/Program.cs`)
- EF data context → Appointment entities: maps entities (evidence: `src/Barbearia.Api/Data/BarbeariaDbContext.cs`)
- Availability rules → Appointment entities: creates and updates (evidence: `src/Barbearia.Api/Services/AgendamentoService.cs`)
- EF data context → PostgreSQL: uses configured provider
