# fristonio/xene architecture

> Architecture diagram of the GitHub repository fristonio/xene, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/fristonio/xene
- Repository: https://github.com/fristonio/xene

## Overview

##### Main Components Identification

a) Core Components:
- API Server (Central Brain)
- Agents (Workflow Executors)
- Key-Value Store (Badger)
- UI Interface
- CLI Tool (xenectl)

b) Authentication Components:
- mTLS System
- JWT Authentication
- Google OAuth Integration

**┌─ Control Plane ─────────────────────┐**
- ┌─────────────┐    ┌──────────────┐ │
- API Server │◄───┤ Auth Systems │ │
- ┘    └──────────────┘ │
- ▲                  ▲        │

- ┌────┴─────┐     ┌─────┴────┐   │
- Badger  │     │   UI     │   │
- Store  │     │ Interface│   │
- ┘     └──────────┘   │
- ┬────────────────────────┘

**┌───────────▼────────────────────────┐**
- Agent Network               │
- ┌─────────┐ ┌─────────┐ ┌────────┐│
- Agent 1 │ │ Agent 2 │ │Agent N ││
- ┬────┘ └────┬────┘ └───┬────┘│

- ┌──▼───────────▼───────────▼──┐ │
- Container Runtime       │ │
- ┘ │
- ┘

##### Component Interactions

Following interactions:
- mTLS communication between API Server and Agents
- JWT/OAuth authentication flow for user access
- Workflow execution path from API Server through Agents
- Data persistence flow to Badger store
- CLI and UI interaction with API Server

##### Additional Details

Important architectural aspects:
- Controller patterns for state reconciliation
- DAG-based workflow execution model
- Secret management system
- Pipeline execution flow
- Log streaming pathways

##### Technical Specifications

A technical specifications section showing:
- Supported runtime executors (Docker)
- Authentication methods
- Storage backend (Badger)
- Communication protocols (gRPC, REST)

##### Notes

Important architectural notes:
- Level-triggered nature of the system
- State reconciliation model
- Kubernetes-inspired design patterns
- Security implementation details

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Control_Plane
        API[API Server]:::apiserver
        Auth[Authentication Systems]:::auth
        Store[(Badger Store)]:::store
        UI[UI Interface]:::ui
        CLI[xenectl CLI]:::ui
        
        subgraph AuthComponents
            JWT[JWT Auth]:::auth
            OAuth[OAuth]:::auth
            MTLS[mTLS]:::auth
        end
        
        subgraph Controllers
            WFC[Workflow Controller]:::controller
            DAG[DAG System]:::controller
        end
    end
    
    subgraph Agent_Network
        Agent1[Agent 1]:::agent
        Agent2[Agent 2]:::agent
        Agent3[Agent N]:::agent
        
        subgraph Runtime
            Docker[Docker Runtime]:::runtime
            ContainerRuntime[Container Runtime]:::runtime
        end
    end
    
    %% Connections
    Auth --> API
    JWT --> Auth
    OAuth --> Auth
    MTLS --> Auth
    
    API --> Store
    UI --> API
    CLI --> API
    
    API --> WFC
    WFC --> DAG
    DAG --> Agent1
    DAG --> Agent2
    DAG --> Agent3
    
    Agent1 --> ContainerRuntime
    Agent2 --> ContainerRuntime
    Agent3 --> ContainerRuntime
    ContainerRuntime --> Docker
    
    %% Click Events
    click API "https://github.com/fristonio/xene/tree/master/pkg/apiserver/"
    click Agent1 "https://github.com/fristonio/xene/tree/master/pkg/agent/"
    click Agent2 "https://github.com/fristonio/xene/tree/master/pkg/agent/"
    click Agent3 "https://github.com/fristonio/xene/tree/master/pkg/agent/"
    click Store "https://github.com/fristonio/xene/tree/master/pkg/store/badger/"
    click CLI "https://github.com/fristonio/xene/tree/master/cmd/xenectl/"
    click Auth "https://github.com/fristonio/xene/tree/master/pkg/auth/"
    click JWT "https://github.com/fristonio/xene/tree/master/pkg/auth/jwt/"
    click OAuth "https://github.com/fristonio/xene/tree/master/pkg/auth/oauth/"
    click MTLS "https://github.com/fristonio/xene/tree/master/contrib/certs/"
    click ContainerRuntime "https://github.com/fristonio/xene/tree/master/pkg/executor/cre/"
    click Docker "https://github.com/fristonio/xene/tree/master/pkg/executor/cre/docker/"
    click DAG "https://github.com/fristonio/xene/tree/master/pkg/dag/"
    click WFC "https://github.com/fristonio/xene/tree/master/pkg/controller/"
    
    %% Styles
    classDef apiserver fill:#3498db
    classDef auth fill:#f1c40f
    classDef store fill:#2ecc71
    classDef ui fill:#9b59b6
    classDef agent fill:#3498db
    classDef runtime fill:#e74c3c
    classDef controller fill:#1abc9c
    
    %% Legend
    subgraph Legend
        L1[API Components]:::apiserver
        L2[Auth Components]:::auth
        L3[Storage]:::store
        L4[User Interfaces]:::ui
        L5[Agents]:::agent
        L6[Runtime Components]:::runtime
        L7[Controllers]:::controller
    end
```
