# brunoleandro90/mend-sync-api architecture

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

- Interactive diagram: https://gitdiagram.com/brunoleandro90/mend-sync-api
- Repository: https://github.com/brunoleandro90/mend-sync-api

## Overview

MendSync API exposes Mend security-management data and synchronizes organization metadata into an Oracle-backed local store. The user-facing flow is API request → domain controller → service → Mend API; the sync operation additionally maps fetched applications, projects, labels, users, and groups into local entities and records sync status. The supplied excerpts show authentication, the shared Mend client, database context, and base-data sync. Other domain endpoints are present in the tree, but their internal behavior is not sampled, so their links are omitted.

Main entry points: [`src/MendSync.Infrastructure/Services/SyncService.cs`](https://github.com/brunoleandro90/mend-sync-api/blob/main/src/MendSync.Infrastructure/Services/SyncService.cs) (Base-data sync), [`src/MendSync.Infrastructure/HttpClients/MendApiClient.cs`](https://github.com/brunoleandro90/mend-sync-api/blob/main/src/MendSync.Infrastructure/HttpClients/MendApiClient.cs) (Mend HTTP client), [`src/MendSync.Infrastructure/Services/AuthService.cs`](https://github.com/brunoleandro90/mend-sync-api/blob/main/src/MendSync.Infrastructure/Services/AuthService.cs) (Authentication service), [`src/MendSync.Infrastructure/Token/TokenStore.cs`](https://github.com/brunoleandro90/mend-sync-api/blob/main/src/MendSync.Infrastructure/Token/TokenStore.cs) (Token store)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API surface"]
  node_authapi["Authentication API<br/>[AuthController.cs]"]
  node_catalogapi["Catalog APIs<br/>[Controllers]"]
  node_findingsapi["Findings API"]
  node_scansapi["Scans API<br/>[ScansController.cs]"]
  node_reportsapi["Reports API"]
  node_syncapi["Sync API<br/>[SyncController.cs]"]
end

subgraph group_domain["Domain services"]
  node_authsvc["Authentication service<br/>[AuthService.cs]"]
  node_catalogsvc["Catalog services<br/>[Services]"]
  node_findingssvc["Findings service<br/>[FindingsService.cs]"]
  node_scanssvc["Scans service<br/>[ScansService.cs]"]
  node_reportssvc["Reports service<br/>[ReportsService.cs]"]
  node_syncsvc["Base-data sync<br/>[SyncService.cs]"]
  node_dtos["API and sync DTOs<br/>[DTOs]"]
end

subgraph group_integration["Mend integration"]
  node_mend["Mend API"]
  node_client["Mend HTTP client<br/>[MendApiClient.cs]"]
  node_tokens[("Token store<br/>[TokenStore.cs]")]
end

subgraph group_state["Local state"]
  node_dbcontext["Oracle data context"]
  node_oracle[("Oracle database")]
end

node_caller(("API consumer"))

node_caller -->|"requests"| node_authapi
node_caller -->|"requests"| node_catalogapi
node_caller -->|"requests"| node_findingsapi
node_caller -->|"requests"| node_scansapi
node_caller -->|"requests"| node_reportsapi
node_caller -->|"requests"| node_syncapi
node_authapi -.->|"delegates to"| node_authsvc
node_catalogapi -.->|"delegates to"| node_catalogsvc
node_findingsapi -->|"delegates to"| node_findingssvc
node_scansapi -->|"delegates to"| node_scanssvc
node_reportsapi -->|"delegates to"| node_reportssvc
node_syncapi -.->|"delegates to"| node_syncsvc
node_authsvc -->|"uses raw HTTP"| node_client
node_authsvc -->|"stores tokens"| node_tokens
node_client -->|"sends requests"| node_mend
node_client -->|"checks token"| node_tokens
node_syncsvc -->|"fetches records"| node_client
node_syncsvc -->|"writes entities"| node_dbcontext
node_dbcontext -.->|"persists data"| node_oracle
node_syncsvc -->|"reads organization"| node_tokens
node_syncsvc -->|"maps records"| node_dtos

click node_authapi "https://github.com/brunoleandro90/mend-sync-api/blob/main/src/MendSync.API/Controllers/AuthController.cs"
click node_catalogapi "https://github.com/brunoleandro90/mend-sync-api/tree/main/src/MendSync.API/Controllers"
click node_findingsapi "https://github.com/brunoleandro90/mend-sync-api/blob/main/src/MendSync.API/Controllers/FindingsController.cs"
click node_scansapi "https://github.com/brunoleandro90/mend-sync-api/blob/main/src/MendSync.API/Controllers/ScansController.cs"
click node_reportsapi "https://github.com/brunoleandro90/mend-sync-api/blob/main/src/MendSync.API/Controllers/ReportsController.cs"
click node_syncapi "https://github.com/brunoleandro90/mend-sync-api/blob/main/src/MendSync.API/Controllers/SyncController.cs"
click node_authsvc "https://github.com/brunoleandro90/mend-sync-api/blob/main/src/MendSync.Infrastructure/Services/AuthService.cs"
click node_catalogsvc "https://github.com/brunoleandro90/mend-sync-api/tree/main/src/MendSync.Infrastructure/Services"
click node_findingssvc "https://github.com/brunoleandro90/mend-sync-api/blob/main/src/MendSync.Infrastructure/Services/FindingsService.cs"
click node_scanssvc "https://github.com/brunoleandro90/mend-sync-api/blob/main/src/MendSync.Infrastructure/Services/ScansService.cs"
click node_reportssvc "https://github.com/brunoleandro90/mend-sync-api/blob/main/src/MendSync.Infrastructure/Services/ReportsService.cs"
click node_syncsvc "https://github.com/brunoleandro90/mend-sync-api/blob/main/src/MendSync.Infrastructure/Services/SyncService.cs"
click node_client "https://github.com/brunoleandro90/mend-sync-api/blob/main/src/MendSync.Infrastructure/HttpClients/MendApiClient.cs"
click node_tokens "https://github.com/brunoleandro90/mend-sync-api/blob/main/src/MendSync.Infrastructure/Token/TokenStore.cs"
click node_dbcontext "https://github.com/brunoleandro90/mend-sync-api/blob/main/src/MendSync.Infrastructure/Data/MendSyncDbContext.cs"
click node_dtos "https://github.com/brunoleandro90/mend-sync-api/tree/main/src/MendSync.Application/DTOs"

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_authapi,node_catalogapi,node_findingsapi,node_scansapi,node_reportsapi,node_syncapi toneBlue
class node_authsvc,node_catalogsvc,node_findingssvc,node_scanssvc,node_reportssvc,node_syncsvc,node_dtos toneAmber
class node_mend,node_client,node_tokens,node_caller toneMint
class node_dbcontext,node_oracle toneRose
```

## Components

### API surface

- [Authentication API](https://github.com/brunoleandro90/mend-sync-api/blob/main/src/MendSync.API/Controllers/AuthController.cs): `src/MendSync.API/Controllers/AuthController.cs`
- [Catalog APIs](https://github.com/brunoleandro90/mend-sync-api/tree/main/src/MendSync.API/Controllers): `src/MendSync.API/Controllers`
- [Findings API](https://github.com/brunoleandro90/mend-sync-api/blob/main/src/MendSync.API/Controllers/FindingsController.cs): `src/MendSync.API/Controllers/FindingsController.cs`
- [Scans API](https://github.com/brunoleandro90/mend-sync-api/blob/main/src/MendSync.API/Controllers/ScansController.cs): `src/MendSync.API/Controllers/ScansController.cs`
- [Reports API](https://github.com/brunoleandro90/mend-sync-api/blob/main/src/MendSync.API/Controllers/ReportsController.cs): `src/MendSync.API/Controllers/ReportsController.cs`
- [Sync API](https://github.com/brunoleandro90/mend-sync-api/blob/main/src/MendSync.API/Controllers/SyncController.cs): `src/MendSync.API/Controllers/SyncController.cs`

### Domain services

- [Authentication service](https://github.com/brunoleandro90/mend-sync-api/blob/main/src/MendSync.Infrastructure/Services/AuthService.cs): `src/MendSync.Infrastructure/Services/AuthService.cs`
- [Catalog services](https://github.com/brunoleandro90/mend-sync-api/tree/main/src/MendSync.Infrastructure/Services): `src/MendSync.Infrastructure/Services`
- [Findings service](https://github.com/brunoleandro90/mend-sync-api/blob/main/src/MendSync.Infrastructure/Services/FindingsService.cs): `src/MendSync.Infrastructure/Services/FindingsService.cs`
- [Scans service](https://github.com/brunoleandro90/mend-sync-api/blob/main/src/MendSync.Infrastructure/Services/ScansService.cs): `src/MendSync.Infrastructure/Services/ScansService.cs`
- [Reports service](https://github.com/brunoleandro90/mend-sync-api/blob/main/src/MendSync.Infrastructure/Services/ReportsService.cs): `src/MendSync.Infrastructure/Services/ReportsService.cs`
- [Base-data sync](https://github.com/brunoleandro90/mend-sync-api/blob/main/src/MendSync.Infrastructure/Services/SyncService.cs): `src/MendSync.Infrastructure/Services/SyncService.cs`
- [API and sync DTOs](https://github.com/brunoleandro90/mend-sync-api/tree/main/src/MendSync.Application/DTOs): `src/MendSync.Application/DTOs`

### Mend integration

- **Mend API**
- [Mend HTTP client](https://github.com/brunoleandro90/mend-sync-api/blob/main/src/MendSync.Infrastructure/HttpClients/MendApiClient.cs): `src/MendSync.Infrastructure/HttpClients/MendApiClient.cs`
- [Token store](https://github.com/brunoleandro90/mend-sync-api/blob/main/src/MendSync.Infrastructure/Token/TokenStore.cs): `src/MendSync.Infrastructure/Token/TokenStore.cs`

### Local state

- [Oracle data context](https://github.com/brunoleandro90/mend-sync-api/blob/main/src/MendSync.Infrastructure/Data/MendSyncDbContext.cs): `src/MendSync.Infrastructure/Data/MendSyncDbContext.cs`
- **Oracle database**

### Other components

- **API consumer**

## Connections

- API consumer → Authentication API: requests
- API consumer → Catalog APIs: requests
- API consumer → Findings API: requests
- API consumer → Scans API: requests
- API consumer → Reports API: requests
- API consumer → Sync API: requests
- Authentication API → Authentication service: delegates to
- Catalog APIs → Catalog services: delegates to
- Findings API → Findings service: delegates to (evidence: `src/MendSync.API/Controllers/FindingsController.cs`)
- Scans API → Scans service: delegates to (evidence: `src/MendSync.API/Controllers/ScansController.cs`)
- Reports API → Reports service: delegates to (evidence: `src/MendSync.API/Controllers/ReportsController.cs`)
- Sync API → Base-data sync: delegates to
- Authentication service → Mend HTTP client: uses raw HTTP (evidence: `src/MendSync.Infrastructure/Services/AuthService.cs`)
- Authentication service → Token store: stores tokens (evidence: `src/MendSync.Infrastructure/Services/AuthService.cs`)
- Mend HTTP client → Mend API: sends requests (evidence: `src/MendSync.Infrastructure/HttpClients/MendApiClient.cs`)
- Mend HTTP client → Token store: checks token (evidence: `src/MendSync.Infrastructure/HttpClients/MendApiClient.cs`)
- Base-data sync → Mend HTTP client: fetches records (evidence: `src/MendSync.Infrastructure/Services/SyncService.cs`)
- Base-data sync → Oracle data context: writes entities (evidence: `src/MendSync.Infrastructure/Services/SyncService.cs`)
- Oracle data context → Oracle database: persists data
- Base-data sync → Token store: reads organization (evidence: `src/MendSync.Infrastructure/Services/SyncService.cs`)
- Base-data sync → API and sync DTOs: maps records (evidence: `src/MendSync.Infrastructure/Services/SyncService.cs`)
