# line/centraldogma architecture

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

- Interactive diagram: https://gitdiagram.com/line/centraldogma
- Repository: https://github.com/line/centraldogma

## Overview

##### Main Components and Architecture

The system should be represented with these key components:

a. Core Services:
- Central Server (with Git backend)
- ZooKeeper Cluster (for replication)
- HTTP/2 API Layer
- Authentication/Authorization Layer

b. Client Components:
- Java Client (with Armeria integration)
- Web Interface
- CLI Client
- xDS Control Plane

##### Integration Points

Following connections:
- Client-Server communication via HTTP/2
- Server-ZooKeeper replication
- Git backend storage
- Authentication providers (SAML, Shiro)
- Mirroring system connections

##### Detailed Component Breakdown

Create subsections for:

a. Server Components:
- Project Management
- Repository Management
- Storage Layer (Git)
- Cache Layer
- Command Executor
- Replication System
- Mirror Service
- Security/Auth Service

b. Client Libraries:
- Java Client
- Spring Boot Integration
- Armeria Integration
- xDS Support

##### Data Flow Representation

Following flows:
- Write operations (commits)
- Read operations (queries)
- Watch operations (real-time updates)
- Replication flow
- Mirroring operations

##### Cross-Cutting Concerns

Aspects:
- Security boundaries
- Caching layers
- Monitoring/Metrics
- High availability setup

##### Specific Implementation Details

Highlight:
- ZooKeeper-based replication
- Git-based storage
- HTTP/2 API endpoints
- Authentication providers
- Mirroring capabilities
- xDS control plane integration

##### Storage Layer (Bottom)

- Component types
- Connection types

- High-level architecture for overview
- Detailed subsystem interactions when needed

This structure reflects Central Dogma's nature as a distributed configuration management system with high availability and version control capabilities.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles and classes
    classDef client fill:#90EE90
    classDef core fill:#87CEEB
    classDef storage fill:#DEB887
    classDef security fill:#FFB6C1
    classDef integration fill:#FFD700

    %% Client Layer
    subgraph Clients
        JC["Java Client"]:::client
        WI["Web Interface"]:::client
        CLI["CLI Client"]:::client
        XDS["xDS Control Plane"]:::client
    end

    %% API/Interface Layer
    subgraph API
        HTTP["HTTP/2 API Layer"]:::core
        AUTH["Authentication Layer"]:::security
        subgraph "Auth Providers"
            SAML["SAML Provider"]:::security
            SHIRO["Shiro Provider"]:::security
        end
    end

    %% Service Layer
    subgraph "Core Services"
        CS["Central Server"]:::core
        subgraph "Server Components"
            PM["Project Management"]:::core
            RM["Repository Management"]:::core
            CE["Command Executor"]:::core
            CL["Cache Layer"]:::core
            MS["Mirror Service"]:::core
        end
    end

    %% Storage Layer
    subgraph "Storage & Replication"
        GB["Git Backend"]:::storage
        ZK["ZooKeeper Cluster"]:::storage
    end

    %% Connections
    JC --> HTTP
    WI --> HTTP
    CLI --> HTTP
    XDS --> HTTP
    
    HTTP --> AUTH
    AUTH --> SAML
    AUTH --> SHIRO
    
    AUTH --> CS
    CS --> PM
    CS --> RM
    CS --> CE
    CS --> CL
    CS --> MS
    
    PM --> GB
    RM --> GB
    CS --> ZK
    
    %% Click events
    click JC "https://github.com/line/centraldogma/tree/main/client/java"
    click WI "https://github.com/line/centraldogma/tree/main/webapp/"
    click XDS "https://github.com/line/centraldogma/tree/main/xds/"
    click HTTP "https://github.com/line/centraldogma/tree/main/server/src/main/java/com/linecorp/centraldogma/server/internal/api"
    click SAML "https://github.com/line/centraldogma/tree/main/server-auth/saml"
    click SHIRO "https://github.com/line/centraldogma/tree/main/server-auth/shiro"
    click PM "https://github.com/line/centraldogma/tree/main/server/src/main/java/com/linecorp/centraldogma/server/internal/storage/project"
    click RM "https://github.com/line/centraldogma/tree/main/server/src/main/java/com/linecorp/centraldogma/server/internal/storage/repository"
    click CE "https://github.com/line/centraldogma/tree/main/server/src/main/java/com/linecorp/centraldogma/server/command"
    click CL "https://github.com/line/centraldogma/tree/main/server/src/main/java/com/linecorp/centraldogma/server/internal/storage/repository/cache"
    click MS "https://github.com/line/centraldogma/tree/main/server/src/main/java/com/linecorp/centraldogma/server/internal/mirror"
    click GB "https://github.com/line/centraldogma/tree/main/server/src/main/java/com/linecorp/centraldogma/server/internal/storage/repository/git"
    click ZK "https://github.com/line/centraldogma/tree/main/server/src/main/java/com/linecorp/centraldogma/server/internal/replication"

    %% Legend
    subgraph Legend
        C1["Client Component"]:::client
        C2["Core Service"]:::core
        C3["Storage"]:::storage
        C4["Security"]:::security
        C5["Integration Point"]:::integration
    end
```
