# spicycoder/cicdtemplate architecture

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

- Interactive diagram: https://gitdiagram.com/spicycoder/cicdtemplate
- Repository: https://github.com/spicycoder/cicdtemplate

## Overview

##### Main Components

a. Application Layers (Clean Architecture):
- API Layer (Presentation)
- Application Layer (Use Cases)
- Domain Layer (Business Logic)
- Infrastructure Layer (Data & External Services)

b. Cloud Native Components:
- DAPR Building Blocks
- .NET Aspire Dashboard
- Kubernetes Resources
- Docker Containers

**┌─ Client Layer ─────────────────────────────────┐**
- API Endpoints                  │
- Presentation Layer ──────────────────────────┐ │
- CICDTemplate.Api                 │ │
- Application Layer ──────────────────────────┐ │ │
- CQRS (Commands/Queries)            │ │ │
- Validation Behaviors              │ │ │
- Domain Layer ─────────────────────────────┐ │ │ │
- Entities, Repositories             │ │ │ │
- Infrastructure Layer ────────────────────┐ │ │ │ │
- Database, Cache, External Services    │ │ │ │ │

- ┴─┴─┴─┘

##### DAPR Sidecars and Building Blocks
- DAPR building blocks:
- State Store
- Pub/Sub
- Secret Store
- Configuration Store

##### Key Relationships

a. Internal Flow:
- API Controllers → Application Commands/Queries
- Application Layer → Domain Layer
- Domain Layer → Infrastructure Layer

b. External Interactions:
- API → DAPR Sidecar
- DAPR Sidecar → Building Blocks
- Infrastructure → External Services

##### Additional Elements

a. DevOps Components:
- GitHub Actions Workflows
- Docker Containers
- Kubernetes Deployments

b. Testing Components:
- Unit Tests
- Functional Tests
- Architecture Tests

##### Specific Implementation Details

Key architectural patterns:
- CQRS pattern (Commands/Queries folders)
- Mediator pattern (MediatR usage)
- Repository pattern
- Clean Architecture layers

##### Notes

- Clean architecture boundaries
- Clear separation of concerns
- Cloud-native aspects
- Deployment topology
- Testing boundaries

Remember to include version information for key components:
- ASP.NET 9
- .NET Aspire
- DAPR
- Docker
- Kubernetes

This will provide a comprehensive view of the system while maintaining the clean architecture principles and cloud-native capabilities that are central to this template.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        Client[Client Applications]
    end

    subgraph API["API Layer"]
        APIEndpoints["API Endpoints"]:::api
        APIContainer["API Container"]:::container
    end

    subgraph Application["Application Layer"]
        Commands["Commands"]:::application
        Queries["Queries"]:::application
        Behaviors["Validation Behaviors"]:::application
    end

    subgraph Domain["Domain Layer"]
        Entities["Entities"]:::domain
        Repositories["Repositories"]:::domain
    end

    subgraph Infrastructure["Infrastructure Layer"]
        Database[(Database)]:::infra
        Cache[(Cache)]:::infra
        ExternalServices["External Services"]:::infra
    end

    subgraph DAPR["DAPR Components"]
        DaprSidecar["DAPR Sidecar"]:::dapr
        StateStore["State Store"]:::dapr
        PubSub["Pub/Sub"]:::dapr
        SecretStore["Secret Store"]:::dapr
        ConfigStore["Config Store"]:::dapr
    end

    subgraph Testing["Testing Components"]
        UnitTests["Unit Tests"]:::test
        FunctionalTests["Functional Tests"]:::test
        ArchTests["Architecture Tests"]:::test
    end

    subgraph DevOps["DevOps Components"]
        GithubActions["GitHub Actions"]:::devops
        Docker["Docker Container"]:::devops
        K8s["Kubernetes Deployments"]:::devops
        AppHost["Application Host"]:::devops
    end

    %% Relationships
    Client --> APIEndpoints
    APIEndpoints --> Commands
    APIEndpoints --> Queries
    Commands --> Entities
    Queries --> Entities
    Entities --> Repositories
    Repositories --> Database
    APIContainer --> DaprSidecar
    DaprSidecar --> StateStore
    DaprSidecar --> PubSub
    DaprSidecar --> SecretStore
    DaprSidecar --> ConfigStore
    Infrastructure --> ExternalServices

    %% Testing Relationships
    UnitTests -.-> Application
    FunctionalTests -.-> API
    ArchTests -.-> Domain

    %% DevOps Relationships
    GithubActions --> Docker
    Docker --> K8s
    AppHost --> K8s

    %% Click Events
    click APIEndpoints "https://github.com/spicycoder/CICDTemplate/tree/main/src/CICDTemplate.Api/"
    click Commands "https://github.com/spicycoder/CICDTemplate/tree/main/src/CICDTemplate.Application/Products/Commands/"
    click Queries "https://github.com/spicycoder/CICDTemplate/tree/main/src/CICDTemplate.Application/Products/Queries/"
    click Entities "https://github.com/spicycoder/CICDTemplate/tree/main/src/CICDTemplate.Domain/Entities/"
    click Repositories "https://github.com/spicycoder/CICDTemplate/tree/main/src/CICDTemplate.Domain/Repositories/"
    click StateStore "https://github.com/spicycoder/CICDTemplate/blob/main/components/statestore.yaml"
    click PubSub "https://github.com/spicycoder/CICDTemplate/blob/main/components/pubsub.yaml"
    click SecretStore "https://github.com/spicycoder/CICDTemplate/blob/main/components/secretstore.yaml"
    click ConfigStore "https://github.com/spicycoder/CICDTemplate/blob/main/components/configstore.yaml"
    click K8s "https://github.com/spicycoder/CICDTemplate/tree/main/deployment/"
    click Docker "https://github.com/spicycoder/CICDTemplate/tree/main/src/CICDTemplate.Api/Dockerfile"
    click UnitTests "https://github.com/spicycoder/CICDTemplate/tree/main/tests/CICDTemplate.Application.UnitTests/"
    click FunctionalTests "https://github.com/spicycoder/CICDTemplate/tree/main/tests/CICDTemplate.FunctionalTests/"
    click ArchTests "https://github.com/spicycoder/CICDTemplate/tree/main/tests/CICDTemplate.ArchitectureTests/"
    click GithubActions "https://github.com/spicycoder/CICDTemplate/blob/main/.github/workflows/build.yml"
    click AppHost "https://github.com/spicycoder/CICDTemplate/tree/main/src/CICDTemplate.AppHost/"

    %% Styles
    classDef api fill:#2196F3,stroke:#fff,stroke-width:2px,color:#fff
    classDef application fill:#4CAF50,stroke:#fff,stroke-width:2px,color:#fff
    classDef domain fill:#FFC107,stroke:#fff,stroke-width:2px,color:#000
    classDef infra fill:#FF9800,stroke:#fff,stroke-width:2px,color:#fff
    classDef dapr fill:#9C27B0,stroke:#fff,stroke-width:2px,color:#fff
    classDef test fill:#607D8B,stroke:#fff,stroke-width:2px,color:#fff
    classDef devops fill:#795548,stroke:#fff,stroke-width:2px,color:#fff
    classDef container fill:#3F51B5,stroke:#fff,stroke-width:2px,color:#fff
```
