# zakabouj/addressvalidator architecture

> Architecture diagram of the GitHub repository zakabouj/addressvalidator, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/zakabouj/addressvalidator
- Repository: https://github.com/zakabouj/addressvalidator

## Overview

##### Project type and purpose
- AddressValidator is a .NET 9.0 console application demonstrating address validation via Azure Maps and Entra ID.
- It follows a clean, modular, layered architecture with clear separation between UI, Service, and Data layers.

##### File structure
- Top-level project: AddressValidator.Console (main app) and AddressValidator.Test (test suite).
- Subfolders under AddressValidator.Console:
- Config (AzureMapsConfig)
- Models (AddressInput, AddressSearchResponse, etc.)
- Services (AddressValidationService, AzureMapsService, AzureMapsTokenService)
- Repositories (IAddressValidationRepository, JsonAddressValidationRepository)
- UI (AddressFormUI, ConsoleUIService, ValidationHistoryUI)
- Program.cs as the entry point
- Configuration: appsettings.json for Azure credentials (excluded from source control).
- CI/CD via GitHub Actions in .github/workflows.

##### README insights
- Emphasis on layered design, TDD, Spectre.Console UI, JSON persistence, Azure Maps API, and Entra ID.

##### Detailed capture of essential elements
- Test project (AddressValidator.Test) off to the side if desired, showing its unit and integration test suites targeting each layer.
- Confidence threshold configuration (80%) as part of service logic.
- Sample JSON storage file path under the repository component.

## Diagram (Mermaid)

```mermaid
flowchart TD
    Program["Program.cs"]:::entry

    subgraph "UI Layer"
        AFUI["AddressFormUI"]:::ui
        VHUI["ValidationHistoryUI"]:::ui
        CUIS["ConsoleUIService"]:::ui
    end

    subgraph "Service Layer"
        AVS["AddressValidationService"]:::service
        AMS["AzureMapsService"]:::service
        AMTS["AzureMapsTokenService"]:::service
        IAVS["IAddressValidationService"]:::service
        IAMS["IAzureMapsService"]:::service
        IAMTS["IAzureMapsTokenService"]:::service
    end

    subgraph "Data Layer"
        JAR["JsonAddressValidationRepository"]:::data
        IAR["IAddressValidationRepository"]:::data
        SD["sample-validation-history.json"]:::data
    end

    subgraph "Configuration"
        AMC["AzureMapsConfig"]:::config
        ASE["appsettings.example.json"]:::config
    end

    subgraph "External Services"
        EMAPT["Azure Maps REST API"]:::external
        ENTRA["Azure Entra ID OAuth"]:::external
    end

    subgraph "Models"
        MI["AddressInput"]:::model
        MSR["AddressSearchResponse"]:::model
        MSRes["AddressSearchResult"]:::model
        MVal["AddressValidationResult"]:::model
    end

    subgraph "CI/CD & Testing"
        WT1["build-test.yml"]:::ci
        WT2["dotnet.yml"]:::ci
        TP["AddressValidator.Test"]:::test
    end

    Program --> AFUI
    Program --> VHUI
    Program --> CUIS
    Program --> AVS
    Program --> JAR

    AFUI --> CUIS
    VHUI --> CUIS
    CUIS --> AVS

    AVS --> AMS
    AVS --> JAR

    AMS --> AMTS
    AMTS --> ENTRA
    AMS --> EMAPT

    AVS --> IAVS
    AMS --> IAMS
    AMTS --> IAMTS
    JAR --> IAR

    AMC --> AMS
    AMC --> AMTS
    ASE --> AMC

    Program --> MI
    Program --> MSR
    Program --> MSRes
    Program --> MVal

    TP --> AFUI
    TP --> AVS
    TP --> JAR

    WT1 --> Program
    WT2 --> Program

    click Program "https://github.com/zakabouj/addressvalidator/blob/main/AddressValidator.Console/Program.cs"
    click AFUI "https://github.com/zakabouj/addressvalidator/blob/main/AddressValidator.Console/UI/AddressFormUI.cs"
    click VHUI "https://github.com/zakabouj/addressvalidator/blob/main/AddressValidator.Console/UI/ValidationHistoryUI.cs"
    click CUIS "https://github.com/zakabouj/addressvalidator/blob/main/AddressValidator.Console/UI/ConsoleUIService.cs"
    click AVS "https://github.com/zakabouj/addressvalidator/blob/main/AddressValidator.Console/Services/AddressValidationService.cs"
    click AMS "https://github.com/zakabouj/addressvalidator/blob/main/AddressValidator.Console/Services/AzureMapsService.cs"
    click AMTS "https://github.com/zakabouj/addressvalidator/blob/main/AddressValidator.Console/Services/AzureMapsTokenService.cs"
    click IAVS "https://github.com/zakabouj/addressvalidator/blob/main/AddressValidator.Console/Services/IAddressValidationService.cs"
    click IAMS "https://github.com/zakabouj/addressvalidator/blob/main/AddressValidator.Console/Services/IAzureMapsService.cs"
    click IAMTS "https://github.com/zakabouj/addressvalidator/blob/main/AddressValidator.Console/Services/IAzureMapsTokenService.cs"
    click JAR "https://github.com/zakabouj/addressvalidator/blob/main/AddressValidator.Console/Repositories/JsonAddressValidationRepository.cs"
    click IAR "https://github.com/zakabouj/addressvalidator/blob/main/AddressValidator.Console/Repositories/IAddressValidationRepository.cs"
    click AMC "https://github.com/zakabouj/addressvalidator/blob/main/AddressValidator.Console/Config/AzureMapsConfig.cs"
    click ASE "https://github.com/zakabouj/addressvalidator/blob/main/AddressValidator.Console/appsettings.example.json"
    click MI "https://github.com/zakabouj/addressvalidator/blob/main/AddressValidator.Console/Models/AddressInput.cs"
    click MSR "https://github.com/zakabouj/addressvalidator/blob/main/AddressValidator.Console/Models/AddressSearchResponse.cs"
    click MSRes "https://github.com/zakabouj/addressvalidator/blob/main/AddressValidator.Console/Models/AddressSearchResult.cs"
    click MVal "https://github.com/zakabouj/addressvalidator/blob/main/AddressValidator.Console/Models/AddressValidationResult.cs"
    click SD "https://github.com/zakabouj/addressvalidator/blob/main/AddressValidator.Console/Data/sample-validation-history.json"
    click WT1 "https://github.com/zakabouj/addressvalidator/blob/main/.github/workflows/build-test.yml"
    click WT2 "https://github.com/zakabouj/addressvalidator/blob/main/.github/workflows/dotnet.yml"
    click TP "https://github.com/zakabouj/addressvalidator/tree/main/AddressValidator.Test/"

    classDef entry fill:#f9f,stroke:#333,stroke-width:1px
    classDef ui fill:#bbf,stroke:#333,stroke-width:1px
    classDef service fill:#bfb,stroke:#333,stroke-width:1px
    classDef data fill:#fbf5c0,stroke:#333,stroke-width:1px
    classDef config fill:#ffd,stroke:#333,stroke-width:1px
    classDef external fill:#def,stroke:#333,stroke-width:1px,stroke-dasharray: 5 5
    classDef model fill:#eee,stroke:#333,stroke-width:1px,stroke-dasharray: 2 2
    classDef ci fill:#cfc,stroke:#333,stroke-width:1px
    classDef test fill:#fcf,stroke:#333,stroke-width:1px
```
