# tsanga/orbt architecture

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

- Interactive diagram: https://gitdiagram.com/tsanga/orbt
- Repository: https://github.com/tsanga/orbt

## Overview

##### Main Components
- API Service (orbt/api): Written in Rust, it uses GraphQL to handle user data, sessions, and real-time updates via websockets (for chat or other server–client state management). Note the modular structure in directories like auth, model, schema, store, stream, and types.
- CLI (orbt/cli): Acts as the “gateway” for bundling and running the API and web services together. It assists in creating an interactive session (configuring room names, passwords, etc.) and packages everything into a single executable.
- Web Frontend (orbt/web): Built with Next.js 13 (using the appDir beta) and React 18, this service provides the user interface, handling client-side interactions and communicating with the API.
- (Planned) Virtual Machine Service (orbt/vm – currently commented out in the README): This would handle launching a lightweight container that runs a virtual display, browser, and captures display via ffmpeg with support for WebRTC to relay the video stream.

##### Architectural Patterns
- Separation of Concerns: The system is clearly divided into distinct services for API, web, CLI (and eventually VM), promoting modularity.
- Microservices/Containerization: Each component has its own Docker configuration (e.g., Dockerfile in both the api and web directories and a docker-compose.yaml at the root) which suggests container-based deployment.
- Integration via GraphQL & WS: The API layer not only serves GraphQL queries/mutations but also handles websocket-based subscriptions to push events like chat messages.
- Build and CI/CD Pipelines: GitHub Actions workflows (.github/workflows/api.yml and web.yml) indicate automated testing and deployment pipelines for the API and web services.

##### Final Recommendations
- Use clear labels for every component (e.g., “orbt/api – GraphQL Engine (Rust)”, “orbt/web – Frontend (Next.js/React)”, “orbt/cli – Service Orchestrator”, “orbt/vm – Planned Virtual Machine Service”).
- From Web to API: “GraphQL Calls / WS Subscriptions”.
- From CLI to API & Web: “Orchestration Commands”.

Happy diagramming!

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Container Orchestration & CI/CD
    subgraph "Container Orchestration & CI/CD"
        docker["Docker Compose & Workflows"]:::orchestration
    end

    %% Backend Services: API, CLI, Shared Utility
    subgraph "Backend Services"
        api["orbt/api – GraphQL Engine (Rust)"]:::api
        subgraph "API Modules"
            auth["auth"]:::api
            model["model"]:::api
            schema["schema"]:::api
            store["store"]:::api
            stream["stream"]:::api
            types["types"]:::api
        end
        cli["orbt/cli – Service Orchestrator"]:::cli
        shared["api-macro – Shared Library/Utility"]:::shared
        %% Linking internal API modules to the API Service
        api --> auth
        api --> model
        api --> schema
        api --> store
        api --> stream
        api --> types
    end

    %% Frontend Service
    subgraph "Frontend Services"
        web["orbt/web – Frontend (Next.js/React)"]:::web
    end

    %% Planned Service
    subgraph "Planned Services"
        vm["orbt/vm – Planned Virtual Machine Service"]:::vm
    end

    %% Relationships between components
    web -->|"GraphQLCalls/WSSubs"| api
    cli -->|"OrchestrationCmd"| api
    cli -->|"OrchestrationCmd"| web
    vm ---|"Planned:Control/Status"| web
    vm ---|"Planned:Updates"| api
    docker -.-> api
    docker -.-> web
    docker -.-> cli

    %% Click Events
    click api "https://github.com/tsanga/orbt/tree/master/api/"
    click auth "https://github.com/tsanga/orbt/tree/master/api/src/auth"
    click model "https://github.com/tsanga/orbt/tree/master/api/src/model"
    click schema "https://github.com/tsanga/orbt/tree/master/api/src/schema"
    click store "https://github.com/tsanga/orbt/tree/master/api/src/store"
    click stream "https://github.com/tsanga/orbt/tree/master/api/src/stream"
    click types "https://github.com/tsanga/orbt/tree/master/api/src/types"
    click cli "https://github.com/tsanga/orbt/tree/master/cli/"
    click web "https://github.com/tsanga/orbt/tree/master/web/"
    click shared "https://github.com/tsanga/orbt/tree/master/api-macro/"
    click docker "https://github.com/tsanga/orbt/blob/master/docker-compose.yaml"

    %% Styles
    classDef api fill:#CCEEFF,stroke:#337AB7,stroke-width:2px;
    classDef cli fill:#DFF0D8,stroke:#3C763D,stroke-width:2px;
    classDef web fill:#FCF8E3,stroke:#8A6D3B,stroke-width:2px;
    classDef vm fill:#F2F2F2,stroke:#A6A6A6,stroke-dasharray: 5 5,stroke-width:2px;
    classDef orchestration fill:#E6E6FA,stroke:#6A5ACD,stroke-width:2px;
    classDef shared fill:#FFD1DC,stroke:#FF69B4,stroke-width:2px;
```
