# aurae-runtime/aurae architecture

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

- Interactive diagram: https://gitdiagram.com/aurae-runtime/aurae
- Repository: https://github.com/aurae-runtime/aurae

## Overview

##### Main Components

a) Core Runtime Components:
- Auraed (Main Daemon)
- Cell Service
- Runtime Service
- VM Service
- CRI Service
- Discovery Service
- Observe Service
- Health Service

b) Client Interfaces:
- AuraeScript (TypeScript-based client)
- Client Library
- gRPC API Layer

c) Security Layer:
- SPIFFE/SPIRE Integration
- mTLS Authentication
- x509 Certificate Management

##### Architectural Patterns to Highlight

- Microservice-style architecture with distinct services
- Layered security model
- Plugin-based extensibility
- Process isolation through cells
- Multi-tenant workload management

##### Component Relationships

**┌─────────────────────────────────────────────────────────────┐**
- Client Layer                            │
- ┌──────────────┐  ┌──────────────┐  ┌──────────────┐     │
- AuraeScript │  │    CLI       │  │ Other Clients │     │
- ┘  └──────────────┘  └──────────────┘     │
- ┬─────────────────────────────────┘

**┌──────────────────────────▼────────────────────────────────┐**
- Security Layer                         │
- ┌─────────────┐  ┌──────────────┐  ┌────────────────┐   │
- SPIFFE/SPIRE │  │     mTLS     │  │  x509 Certs    │   │
- ┘  └──────────────┘  └────────────────┘   │
- ┬─────────────────────────────────┘

**┌─────────────────────────▼────────────────────────────────┐**
- Auraed Core                           │
- ┌─────────────┐  ┌──────────────┐  ┌────────────────┐  │
- Cell Service │  │  VM Service  │  │  CRI Service   │  │
- ┘  └──────────────┘  └────────────────┘  │
- ┌─────────────┐  ┌──────────────┐  ┌────────────────┐  │
- Discovery  │  │   Observe    │  │    Health      │  │
- ┘  └──────────────┘  └────────────────┘  │
- ┬────────────────────────────────┘

**┌────────────────────────▼────────────────────────────────┐**
- System Resources                        │
- ┌─────────────┐  ┌──────────────┐  ┌────────────────┐ │
- Cells     │  │     VMs      │  │  Containers    │ │
- ┘  └──────────────┘  └────────────────┘ │
- ┘

##### Important Details

- Authentication flow
- Process isolation boundaries
- Monitoring/observability points
- Integration points with external systems

##### Technical Specifications

A side panel showing:
- Supported protocols (gRPC)
- Authentication methods (mTLS)
- Resource types (Cells, VMs, Pods)
- API versions (v0)

##### Notes for Implementation

- Keep service boundaries clear
- Bidirectional communication flows
- Where cgroups are used for isolation
- EBPF integration points
- How the TypeScript SDK interfaces with the system

- Nested containers
- Relationship lines with different styles
- Export to vector formats
- Proper text formatting

## Diagram (Mermaid)

```mermaid
graph TB
    %% Style Definitions
    classDef client fill:#3498db,stroke:#2980b9,color:white
    classDef security fill:#2ecc71,stroke:#27ae60,color:white
    classDef core fill:#e67e22,stroke:#d35400,color:white
    classDef resource fill:#9b59b6,stroke:#8e44ad,color:white
    classDef api fill:#95a5a6,stroke:#7f8c8d,color:white

    %% Client Layer
    subgraph ClientLayer
        AScript["AuraeScript"]
        CLI["CLI Tools"]
        Clients["Other Clients"]
    end

    %% Security Layer
    subgraph SecurityLayer
        SPIFFE["SPIFFE/SPIRE"]
        mTLS["mTLS Auth"]
        X509["x509 Certificates"]
    end

    %% Core Layer
    subgraph CoreLayer
        Auraed["Auraed Daemon"]
        CellSvc["Cell Service"]
        VMSvc["VM Service"]
        CRISvc["CRI Service"]
        DiscSvc["Discovery Service"]
        ObsSvc["Observe Service"]
        HealthSvc["Health Service"]
        EBPF["eBPF Integration"]
        Network["Network Management"]
        Init["System Init"]
        Logging["Logging System"]
    end

    %% Resource Layer
    subgraph ResourceLayer
        Cells["Process Cells"]
        VMs["Virtual Machines"]
        Containers["Containers"]
        CGroups["cgroups"]
    end

    %% API Layer
    GRPC["gRPC API Layer"]

    %% Relationships
    AScript --> GRPC
    CLI --> GRPC
    Clients --> GRPC
    GRPC --> SecurityLayer
    SecurityLayer --> Auraed
    Auraed --> CellSvc
    Auraed --> VMSvc
    Auraed --> CRISvc
    Auraed --> DiscSvc
    Auraed --> ObsSvc
    Auraed --> HealthSvc
    Auraed --> EBPF
    Auraed --> Network
    Auraed --> Init
    Auraed --> Logging
    CellSvc --> Cells
    VMSvc --> VMs
    CRISvc --> Containers
    Cells --> CGroups

    %% Click Events
    click Auraed "https://github.com/aurae-runtime/aurae/tree/main/auraed/src/"
    click CellSvc "https://github.com/aurae-runtime/aurae/tree/main/auraed/src/cells/cell_service/"
    click VMSvc "https://github.com/aurae-runtime/aurae/tree/main/auraed/src/vms/"
    click CRISvc "https://github.com/aurae-runtime/aurae/tree/main/auraed/src/cri/"
    click DiscSvc "https://github.com/aurae-runtime/aurae/tree/main/auraed/src/discovery/"
    click ObsSvc "https://github.com/aurae-runtime/aurae/tree/main/auraed/src/observe/"
    click HealthSvc "https://github.com/aurae-runtime/aurae/tree/main/client/src/grpc/health/"
    click AScript "https://github.com/aurae-runtime/aurae/tree/main/auraescript/"
    click GRPC "https://github.com/aurae-runtime/aurae/tree/main/api/"
    click X509 "https://github.com/aurae-runtime/aurae/blob/main/client/src/config/x509_details.rs"
    click Cells "https://github.com/aurae-runtime/aurae/tree/main/auraed/src/cells/cell_service/cells/"
    click CGroups "https://github.com/aurae-runtime/aurae/tree/main/auraed/src/cells/cell_service/cells/cgroups/"
    click EBPF "https://github.com/aurae-runtime/aurae/tree/main/auraed/src/ebpf/"
    click Init "https://github.com/aurae-runtime/aurae/tree/main/auraed/src/init/"
    click Logging "https://github.com/aurae-runtime/aurae/tree/main/auraed/src/logging/"
    click Containers "https://github.com/aurae-runtime/aurae/blob/main/auraed/src/cri/runtime_service.rs"
    click Network "https://github.com/aurae-runtime/aurae/tree/main/auraed/src/init/network/"

    %% Styling
    class AScript,CLI,Clients client
    class SPIFFE,mTLS,X509 security
    class Auraed,CellSvc,VMSvc,CRISvc,DiscSvc,ObsSvc,HealthSvc,EBPF,Network,Init,Logging core
    class Cells,VMs,Containers,CGroups resource
    class GRPC api
```
