# ken-xue/devops-platform architecture

> Architecture diagram of the GitHub repository ken-xue/devops-platform, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ken-xue/devops-platform
- Repository: https://github.com/ken-xue/devops-platform

## Overview

##### Main Components
- Frontend Client: Although a separate “devops-platform-vue” repository is referenced, there is also a “client” module with its own Java code. Represent the user interface layer and how users interact with the system.
- API/Adapter Layer: Under the “core/adapter” directory you have REST controllers and configuration (CORS, SpringDoc, WebMvc). These controllers provide a front door for external requests – make sure to capture these as the gateway into your system.
- Application (Service) Layer: The “core/application” package contains the business use-case implementations, command/query executors, event handlers, and service logic. Label these as “Application Services” handling commands from the API layer.
- Domain Layer: The “core/domain” portion contains the core business entities, domain models, factories, and repositories. Show this layer as encapsulating the pure business rules based on Domain-Driven Design.
- Shared Data Transfer Objects: The “core/share-dataobject” serves as a common DTO layer for transmitting data between modules and across service boundaries.
- Extensions: The “extensions” directory contains custom implementations for Access Control (ACL) – both authorization, caching, database, event, and object storage. Represent these extension points and show that they plug into the core system to provide additional functionalities.
- Starter Module: The “starter” module bootstraps the entire application (with Application.java, configuration properties, resource files, etc.). Designate this module as the entry point for running the microservice.

##### External Integrations and Dependencies
- Jenkins: There is middleware for Jenkins integration (see “core/application/middleware/jenkins”), so show a connection to the Jenkins service.
- Other Tools: Libraries like Jsch (for SSH terminal connections), MyBatis-Plus, and caching mechanisms are included and should be noted as technical dependencies in the design.

##### Architectural Patterns and Design Principles
- Layered/DDD Structure: Clearly separate the system into Presentation (client/adapter), Application (service/command-query executors), Domain (business logic, entities, repositories) and Infrastructure (persistence, integration, adapters).
- Extensibility: Extensions exist to support various authorization and caching implementations. Show these as “pluggable” modules that integrate with the adapter and domain layers.

##### Final Touches for Clarity
- Layer and connection is annotated with brief descriptions or notes where the data flows (for example “HTTP Request”, “Command Dispatch”, “Event Bus Notification”, “Database Query”, etc.).

## Diagram (Mermaid)

```mermaid
graph TD
    %% Entry Point
    subgraph "Entry"
        Starter["Starter Module"]:::internal
    end

    %% Presentation Layer
    subgraph "Presentation Layer"
        UI["User Interface (Client)"]:::internal
    end

    %% API/Adapter Layer
    subgraph "API/Adapter Layer"
        API["REST API Gateway (API/Adapter)"]:::internal
    end

    %% Application Layer
    subgraph "Application Layer"
        APP["Application Services"]:::internal
        KubeIntegration["Kubernetes Integration"]:::internal
    end

    %% Domain Layer
    subgraph "Domain Layer"
        DOM["Domain Model"]:::internal
    end

    %% Infrastructure Layer
    subgraph "Infrastructure Layer"
        INFRA["Infrastructure & Persistence"]:::internal
    end

    %% Shared Components and Extensions
    subgraph "Shared & Extensions"
        DTO["Shared DTOs"]:::internal
        EXT["Extensions (ACL,Caching,etc.)"]:::internal
        EventBus["Event Bus"]:::internal
    end

    %% External Systems
    subgraph "External Systems"
        K8sEx["Kubernetes Cluster"]:::external
        MinioEx["Minio Object Storage"]:::external
        JenkinsEx["Jenkins Service"]:::external
        ZookeeperEx["Zookeeper Service"]:::external
        DBEx["Relational Database"]:::external
    end

    %% Connections
    Starter -->|"bootstraps"| UI
    UI -->|"HTTP_Request"| API
    API -->|"Dispatch"| APP
    APP -->|"Business_Logic"| DOM
    DOM -->|"Persistence_Call"| INFRA
    INFRA -->|"Query/Update"| DBEx
    INFRA -->|"File_Storage"| MinioEx
    INFRA -->|"Deploy_Jobs"| JenkinsEx
    INFRA -->|"Coordination"| ZookeeperEx
    APP -->|"Manage_Cluster"| KubeIntegration
    KubeIntegration -->|"Control"| K8sEx
    APP -->|"Data_Transfer"| DTO
    DOM -->|"Data_Transfer"| DTO
    APP -->|"Publish_Event"| EventBus
    DOM -->|"Raise_Event"| EventBus
    EXT -->|"Enhance"| APP
    EXT -->|"Extend_Functionality"| INFRA

    %% Click Events
    click Starter "https://github.com/ken-xue/devops-platform/tree/main/starter/"
    click UI "https://github.com/ken-xue/devops-platform/tree/main/client/src/main/java/io/kenxue/devops/client"
    click API "https://github.com/ken-xue/devops-platform/tree/main/core/adapter"
    click APP "https://github.com/ken-xue/devops-platform/tree/main/core/application"
    click DOM "https://github.com/ken-xue/devops-platform/tree/main/core/domain"
    click INFRA "https://github.com/ken-xue/devops-platform/tree/main/core/infrastructure"
    click DTO "https://github.com/ken-xue/devops-platform/tree/main/core/share-dataobject"
    click EXT "https://github.com/ken-xue/devops-platform/tree/main/extensions/"
    click KubeIntegration "https://github.com/ken-xue/devops-platform/tree/main/core/application/kubernetes"
    click K8sEx "https://github.com/ken-xue/devops-platform/tree/main/deploy/kubernetes"
    click MinioEx "https://github.com/ken-xue/devops-platform/tree/main/core/application/middleware/minio"
    click JenkinsEx "https://github.com/ken-xue/devops-platform/tree/main/core/application/middleware/jenkins"
    click ZookeeperEx "https://github.com/ken-xue/devops-platform/tree/main/core/application/middleware/zookeeper"
    click DBEx "https://github.com/ken-xue/devops-platform/blob/main/doc/script/DDL.sql"

    %% Styles
    classDef internal fill:#AED6F1,stroke:#1B4F72,stroke-width:2px;
    classDef external fill:#A9DFBF,stroke:#145A32,stroke-width:2px;
```
