# ukho/s-100-permit-service architecture

> Architecture diagram of the GitHub repository ukho/s-100-permit-service, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ukho/s-100-permit-service
- Repository: https://github.com/ukho/s-100-permit-service

## Overview

##### Project type and purpose
- From the file tree and README, this is a .NET 6 (or later) Web API project (“UKHO.S100PermitGenerator.API”) packaged as a Visual Studio solution.
- Its purpose is to generate S‑100 permits (maritime charting permits) via HTTP endpoints.
- It includes an automated test project and is built and deployed via Azure Pipelines (azure-pipelines.yml).

##### File structure
- Top level:
- S100PermitGenerator.sln – the Visual Studio solution
- azure-pipelines.yml – CI/CD pipeline definition
- src/UKHO.S100PermitGenerator.API – the RESTful Web API code
- test/UKHO.S100PermitGenerator.API.Tests – unit/integration tests
- Key patterns: a single API service, with separate test suite. Standard .NET layering is implied (Controllers → Services/Business Logic → Data Access).
- No obvious “frontend” folder; this is purely a back‑end microservice.

##### README for additional insights
- Branching model: ‘develop’ for ongoing work, merged into ‘main’ for releases.
- Deploy targets: vNext IAT (integration) and E2E environments, then live from ‘main’.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External Client
    Client["External Client"]:::external

    %% Azure Services
    subgraph "Azure Cloud"
        direction TB
        AppGateway["Azure Application Gateway"]:::cloud
        Auth["Azure AD (Auth)"]:::cloud
    end

    %% API Service Layer
    subgraph "UKHO.S100PermitGenerator.API Service" 
        direction TB
        APIController["API Controller\n(HTTP Endpoints)"]:::compute
        PermitService["PermitService\n(Business Logic)"]:::compute
        DataAccess["Data Access Layer"]:::compute
    end

    %% Data Stores
    subgraph "Data Stores"
        direction TB
        SQLDB["Azure SQL Database"]:::database
        BlobStorage["Blob Storage"]:::database
    end

    %% CI/CD Pipeline
    subgraph "CI/CD Pipeline" 
        direction TB
        PipelineConfig["azure-pipelines.yml"]:::pipeline
        BuildStage["Build (Solution)"]:::pipeline
        TestStage["Test (xUnit/MSTest)"]:::pipeline
        DeployStage["Deploy to IAT → E2E → Production"]:::pipeline
    end

    %% Solution & Code Repos
    subgraph "Code Repository"
        direction TB
        Solution["S100PermitGenerator.sln"]:::code
        APIService["src/UKHO.S100PermitGenerator.API"]:::code
        APICSP["UKHO.S100PermitGenerator.API.csproj"]:::code
        TestProject["test/UKHO.S100PermitGenerator.API.Tests"]:::code
        TestCSP["UKHO.S100PermitGenerator.API.Tests.csproj"]:::code
    end

    %% Connections - API Flow
    Client -->|"HTTPS"| AppGateway
    AppGateway -->|"Routes to"| APIController
    APIController -->|"calls"| PermitService
    PermitService -->|"uses"| DataAccess
    DataAccess -->|"reads/writes"| SQLDB
    DataAccess -->|"stores files"| BlobStorage
    APIController -->|"validates via"| Auth

    %% Connections - CI/CD Flow
    Solution -->|included in| PipelineConfig
    APIService -->|included in| Solution
    APICSP -->|included in| APIService
    TestProject -->|included in| Solution
    TestCSP -->|included in| TestProject

    PipelineConfig -->|triggers| BuildStage
    BuildStage -->|publishes artifacts| TestStage
    TestStage -->|on success| DeployStage

    DeployStage -->|deploys API to| AppGateway

    %% Click Events
    click Solution "https://github.com/ukho/s-100-permit-service/blob/main/S100PermitGenerator.sln"
    click PipelineConfig "https://github.com/ukho/s-100-permit-service/blob/main/azure-pipelines.yml"
    click APIService "https://github.com/ukho/s-100-permit-service/blob/main/src/UKHO.S100PermitGenerator.API"
    click APICSP "https://github.com/ukho/s-100-permit-service/blob/main/src/UKHO.S100PermitGenerator.API/UKHO.S100PermitGenerator.API.csproj"
    click TestProject "https://github.com/ukho/s-100-permit-service/blob/main/test/UKHO.S100PermitGenerator.API.Tests"
    click TestCSP "https://github.com/ukho/s-100-permit-service/blob/main/test/UKHO.S100PermitGenerator.API.Tests/UKHO.S100PermitGenerator.API.Tests.csproj"

    %% Styles
    classDef external fill:#f9f,stroke:#333,stroke-width:2px
    classDef cloud fill:#bbf,stroke:#333,stroke-width:2px,stroke-dasharray: 5 5
    classDef compute fill:#cff,stroke:#333,stroke-width:1px
    classDef database fill:#fcf,stroke:#333,stroke-width:1px,stroke-dasharray: 2 2
    classDef pipeline fill:#ffc,stroke:#333,stroke-width:1px
    classDef code fill:#efe,stroke:#333,stroke-width:1px
```
