# vianahub-pt/vianahub.global.gerit.api architecture

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

- Interactive diagram: https://gitdiagram.com/vianahub-pt/vianahub.global.gerit.api
- Repository: https://github.com/vianahub-pt/vianahub.global.gerit.api

## Overview

VianaHub.Global.Gerit is a multi-tenant business-management API: its surface covers identity and access, client and workforce records, visits and field resources, and tenant plans and subscriptions. A typical user workflow enters through an API endpoint, performs application/domain operations, and persists data through repositories and the EF Core context. The README’s explicit operational constraint is that database preparation is external to host startup. Some domain branches are represented from the tree; their internal calls were not sampled, so those links are omitted or marked unverified.

Main entry points: [`src/VianaHub.Global.Gerit.Api/Program.cs`](https://github.com/vianahub-pt/vianahub.global.gerit.api/blob/develop/src/VianaHub.Global.Gerit.Api/Program.cs) (API host), [`src/VianaHub.Global.Gerit.Application/Services/Identity/AuthAppService.cs`](https://github.com/vianahub-pt/vianahub.global.gerit.api/blob/develop/src/VianaHub.Global.Gerit.Application/Services/Identity/AuthAppService.cs) (Authentication service), [`src/VianaHub.Global.Gerit.Infra.Data/Context/GeritDbContext.cs`](https://github.com/vianahub-pt/vianahub.global.gerit.api/blob/develop/src/VianaHub.Global.Gerit.Infra.Data/Context/GeritDbContext.cs) (EF Core context), [`src/VianaHub.Global.Gerit.Api/Endpoints/Identity`](https://github.com/vianahub-pt/vianahub.global.gerit.api/tree/develop/src/VianaHub.Global.Gerit.Api/Endpoints/Identity) (Identity endpoints)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API surface"]
  node_host["API host<br/>[Program.cs]"]
  node_identity["Identity endpoints<br/>[Identity]"]
  node_business["Business endpoints<br/>[Business]"]
  node_billing["Billing endpoints<br/>[Billing]"]
  node_jobapi["Job endpoint<br/>[JobEndpoint.cs]"]
end

subgraph group_application["Application and domain"]
  node_auth["Authentication service<br/>[AuthAppService.cs]"]
  node_client["Client services"]
  node_subscription["Subscription domain"]
  node_clientmodel["Client model<br/>[ClientEntity.cs]"]
  node_subscriptionmodel["Subscription model"]
  node_jwtkeys["JWT key service"]
end

subgraph group_data["Persistence"]
  node_repositories["Data repositories<br/>[Repository]"]
  node_db[("EF Core context<br/>[GeritDbContext.cs]")]
end

subgraph group_operations["Background jobs"]
  node_jobs["Job services<br/>[Services]"]
end

node_user(("API consumer"))

node_user -.->|"sends requests"| node_host
node_host -.->|"routes to"| node_identity
node_host -.->|"routes to"| node_business
node_host -.->|"routes to"| node_billing
node_identity -.->|"delegates to"| node_auth
node_business -.->|"delegates to"| node_client
node_auth -->|"sets tenant context"| node_db
node_auth -->|"checks subscription"| node_subscription
node_auth -->|"loads active key"| node_jwtkeys
node_client -->|"uses repositories"| node_repositories
node_repositories -->|"queries and saves"| node_db
node_db -->|"maps entities"| node_clientmodel
node_db -->|"maps entities"| node_subscriptionmodel
node_host -.->|"routes to"| node_jobapi

click node_host "https://github.com/vianahub-pt/vianahub.global.gerit.api/blob/develop/src/VianaHub.Global.Gerit.Api/Program.cs"
click node_identity "https://github.com/vianahub-pt/vianahub.global.gerit.api/tree/develop/src/VianaHub.Global.Gerit.Api/Endpoints/Identity"
click node_business "https://github.com/vianahub-pt/vianahub.global.gerit.api/tree/develop/src/VianaHub.Global.Gerit.Api/Endpoints/Business"
click node_billing "https://github.com/vianahub-pt/vianahub.global.gerit.api/tree/develop/src/VianaHub.Global.Gerit.Api/Endpoints/Billing"
click node_auth "https://github.com/vianahub-pt/vianahub.global.gerit.api/blob/develop/src/VianaHub.Global.Gerit.Application/Services/Identity/AuthAppService.cs"
click node_client "https://github.com/vianahub-pt/vianahub.global.gerit.api/blob/develop/src/VianaHub.Global.Gerit.Application/Services/Business/ClientAddressAppService.cs"
click node_subscription "https://github.com/vianahub-pt/vianahub.global.gerit.api/blob/develop/src/VianaHub.Global.Gerit.Domain/Services/Billing/SubscriptionDomainService.cs"
click node_clientmodel "https://github.com/vianahub-pt/vianahub.global.gerit.api/blob/develop/src/VianaHub.Global.Gerit.Domain/Entities/Business/ClientEntity.cs"
click node_subscriptionmodel "https://github.com/vianahub-pt/vianahub.global.gerit.api/blob/develop/src/VianaHub.Global.Gerit.Domain/Entities/Billing/SubscriptionEntity.cs"
click node_jwtkeys "https://github.com/vianahub-pt/vianahub.global.gerit.api/blob/develop/src/VianaHub.Global.Gerit.Domain/Services/Identity/JwtKeyDomainService.cs"
click node_repositories "https://github.com/vianahub-pt/vianahub.global.gerit.api/tree/develop/src/VianaHub.Global.Gerit.Infra.Data/Repository"
click node_db "https://github.com/vianahub-pt/vianahub.global.gerit.api/blob/develop/src/VianaHub.Global.Gerit.Infra.Data/Context/GeritDbContext.cs"
click node_jobs "https://github.com/vianahub-pt/vianahub.global.gerit.api/tree/develop/src/VianaHub.Global.Gerit.Infra.Job/Services"
click node_jobapi "https://github.com/vianahub-pt/vianahub.global.gerit.api/blob/develop/src/VianaHub.Global.Gerit.Api/Endpoints/Job/JobEndpoint.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_host,node_identity,node_business,node_billing,node_jobapi toneBlue
class node_auth,node_client,node_subscription,node_clientmodel,node_subscriptionmodel,node_jwtkeys toneAmber
class node_repositories,node_db,node_user toneMint
class node_jobs toneRose
```

## Components

### API surface

- [API host](https://github.com/vianahub-pt/vianahub.global.gerit.api/blob/develop/src/VianaHub.Global.Gerit.Api/Program.cs): `src/VianaHub.Global.Gerit.Api/Program.cs`
- [Identity endpoints](https://github.com/vianahub-pt/vianahub.global.gerit.api/tree/develop/src/VianaHub.Global.Gerit.Api/Endpoints/Identity): `src/VianaHub.Global.Gerit.Api/Endpoints/Identity`
- [Business endpoints](https://github.com/vianahub-pt/vianahub.global.gerit.api/tree/develop/src/VianaHub.Global.Gerit.Api/Endpoints/Business): `src/VianaHub.Global.Gerit.Api/Endpoints/Business`
- [Billing endpoints](https://github.com/vianahub-pt/vianahub.global.gerit.api/tree/develop/src/VianaHub.Global.Gerit.Api/Endpoints/Billing): `src/VianaHub.Global.Gerit.Api/Endpoints/Billing`
- [Job endpoint](https://github.com/vianahub-pt/vianahub.global.gerit.api/blob/develop/src/VianaHub.Global.Gerit.Api/Endpoints/Job/JobEndpoint.cs): `src/VianaHub.Global.Gerit.Api/Endpoints/Job/JobEndpoint.cs`

### Application and domain

- [Authentication service](https://github.com/vianahub-pt/vianahub.global.gerit.api/blob/develop/src/VianaHub.Global.Gerit.Application/Services/Identity/AuthAppService.cs): `src/VianaHub.Global.Gerit.Application/Services/Identity/AuthAppService.cs`
- [Client services](https://github.com/vianahub-pt/vianahub.global.gerit.api/blob/develop/src/VianaHub.Global.Gerit.Application/Services/Business/ClientAddressAppService.cs): `src/VianaHub.Global.Gerit.Application/Services/Business/ClientAddressAppService.cs`
- [Subscription domain](https://github.com/vianahub-pt/vianahub.global.gerit.api/blob/develop/src/VianaHub.Global.Gerit.Domain/Services/Billing/SubscriptionDomainService.cs): `src/VianaHub.Global.Gerit.Domain/Services/Billing/SubscriptionDomainService.cs`
- [Client model](https://github.com/vianahub-pt/vianahub.global.gerit.api/blob/develop/src/VianaHub.Global.Gerit.Domain/Entities/Business/ClientEntity.cs): `src/VianaHub.Global.Gerit.Domain/Entities/Business/ClientEntity.cs`
- [Subscription model](https://github.com/vianahub-pt/vianahub.global.gerit.api/blob/develop/src/VianaHub.Global.Gerit.Domain/Entities/Billing/SubscriptionEntity.cs): `src/VianaHub.Global.Gerit.Domain/Entities/Billing/SubscriptionEntity.cs`
- [JWT key service](https://github.com/vianahub-pt/vianahub.global.gerit.api/blob/develop/src/VianaHub.Global.Gerit.Domain/Services/Identity/JwtKeyDomainService.cs): `src/VianaHub.Global.Gerit.Domain/Services/Identity/JwtKeyDomainService.cs`

### Persistence

- [Data repositories](https://github.com/vianahub-pt/vianahub.global.gerit.api/tree/develop/src/VianaHub.Global.Gerit.Infra.Data/Repository): `src/VianaHub.Global.Gerit.Infra.Data/Repository`
- [EF Core context](https://github.com/vianahub-pt/vianahub.global.gerit.api/blob/develop/src/VianaHub.Global.Gerit.Infra.Data/Context/GeritDbContext.cs): `src/VianaHub.Global.Gerit.Infra.Data/Context/GeritDbContext.cs`

### Background jobs

- [Job services](https://github.com/vianahub-pt/vianahub.global.gerit.api/tree/develop/src/VianaHub.Global.Gerit.Infra.Job/Services): `src/VianaHub.Global.Gerit.Infra.Job/Services`

### Other components

- **API consumer**

## Connections

- API consumer → API host: sends requests
- API host → Identity endpoints: routes to
- API host → Business endpoints: routes to
- API host → Billing endpoints: routes to
- Identity endpoints → Authentication service: delegates to
- Business endpoints → Client services: delegates to
- Authentication service → EF Core context: sets tenant context (evidence: `src/VianaHub.Global.Gerit.Application/Services/Identity/AuthAppService.cs`)
- Authentication service → Subscription domain: checks subscription (evidence: `src/VianaHub.Global.Gerit.Application/Services/Identity/AuthAppService.cs`)
- Authentication service → JWT key service: loads active key (evidence: `src/VianaHub.Global.Gerit.Domain/Services/Identity/JwtKeyDomainService.cs`)
- Client services → Data repositories: uses repositories (evidence: `src/VianaHub.Global.Gerit.Application/Services/Business/ClientAddressAppService.cs`)
- Data repositories → EF Core context: queries and saves (evidence: `src/VianaHub.Global.Gerit.Infra.Data/Repository/Billing/SubscriptionDataRepository.cs`)
- EF Core context → Client model: maps entities (evidence: `src/VianaHub.Global.Gerit.Infra.Data/Context/GeritDbContext.cs`)
- EF Core context → Subscription model: maps entities (evidence: `src/VianaHub.Global.Gerit.Infra.Data/Context/GeritDbContext.cs`)
- API host → Job endpoint: routes to
