# angeliteai/angelite architecture

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

- Interactive diagram: https://gitdiagram.com/angeliteai/angelite
- Repository: https://github.com/angeliteai/angelite

## Overview

##### Major Components
- Core Infrastructure & Libraries:
- Rust-native components (for example, the “lib/rust/io-sys” module along with many other Rust libraries under src-old/rust, src-old/refactor, etc.).
- Build and utility tools (Cargo.toml, Dockerfile, Package.swift, build.zig, and various build scripts) which support cross-language builds and deployment.
- Feature/Product Modules:
- angelite.chat: A conversational/chat component.
- angelite.dev: A dual git–and–cargo integrated repository system.
- angelite.ai: AI communication components.
- api.diy: A declarative game BaaS offering rapid API deployment with real-time collaboration.
- Prism: A war simulator game module.
- GPU and WASM Modules:
- GPU-accelerated processing is evident in files such as Shader.metal, various shader-related files in “src/gfx” (including Swift, Zig, and even shader source files for Metal and GLSL), and “src/math” for computational geometry and vector math.
- Web/Frontend Components (Legacy and/or supplementary):
- The “src-old/javascript/…” directories reveal Svelte-based frontends for several products (angelite-ai, angelite-app, angelite-blog, etc.), which might be touched by WASM or serve as rich client interfaces.
- Communication & Distributed System Layer:
- Distributed identity, zero-latency communication, multi-threading, and permission frameworks that are likely implemented across the Rust core and integrated with the respective product modules.

##### Out Interactions and Data Flow
- Build and deployment pipelines (using Docker, Cargo, and Package.swift) that serve to integrate these various components in an automated, high-performance way.

##### Architectural Patterns and Design Principles
- Modularity (each product is largely self-contained yet unified by the core libraries).
- WASM-first strategy by noting which modules (like the UI components and some client-side logic) are intended to compile to WebAssembly.
- GPU offloading capability and native multi-threading with annotated submodules that support these functions.
- Demonstrate separation of concerns: the file tree suggests clear boundaries (e.g., “lib” for core systems, “src-old” for legacy/supplementary apps, and “src” for current tests/demos).

##### Integrate Relevant Technologies and Frameworks
- Rust ecosystems for core libraries and performance layers.
- Swift for Apple-specific GPU components.
- Zig for low-level system programming and maybe some cross-platform rendering modules.
- JavaScript (including Svelte and Vite configurations) for frontend/UI modules.
- WASM where applicable.
- Docker for containerized deployments.

## Diagram (Mermaid)

```mermaid
flowchart TD

    subgraph "Build & Deployment Tools"
        B1["Cargo.toml"]:::build
        B2["Dockerfile"]:::build
        B3["Package.swift"]:::build
        B4["build.zig"]:::build
        B5["Build Scripts"]:::build
    end

    subgraph "Core Infrastructure & Libraries"
        RC["Rust Native Core"]:::core
        LR["Legacy Rust Modules"]:::core
    end

    subgraph "Feature/Product Modules"
        AC["Angelite Chat"]:::product
        AD["Angelite Dev"]:::product
        AA["Angelite AI"]:::product
        API["API DIY"]:::product
        PR["Prism Simulator"]:::product
    end

    subgraph "GPU and WASM Modules"
        SH["Shader"]:::gpu
        GS["GPU Shaders"]:::gpu
        MC["Math Computations"]:::gpu
        SG["Swift GPU"]:::gpu
        ZG["Zig GPU"]:::gpu
    end

    subgraph "Communication & Distributed System"
        RT["Real-time Communication"]:::comm
        ZLS["Zero-Latency Sync"]:::comm
    end

    subgraph "Web/Frontend Components"
        AAApp["Angelite App"]:::web
        AABlog["Angelite Blog"]:::web
    end

    %% Build Tools -> Core Infrastructure
    B5 -->|"builds"| RC

    %% Feature Modules integrate with Core Infrastructure
    AC -->|"calls"| RC
    AD -->|"calls"| RC
    AA -->|"calls"| RC
    API -->|"calls"| RC
    PR -->|"calls"| RC

    %% Core Infrastructure offloads to GPU/WASM Modules
    RC -->|"offloads"| SH
    RC -->|"offloads"| GS
    RC -->|"calculates"| MC
    RC -->|"integrates"| SG
    RC -->|"integrates"| ZG

    %% Communication Layer interacts with Core Infrastructure
    RT -->|"communicates"| RC
    ZLS -->|"communicates"| RC

    %% Web/Frontend Components send API calls to Feature Modules
    AAApp -->|"APIcalls"| AD
    AABlog -->|"APIcalls"| AA

    %% Styles
    classDef build fill:#ffcc00,stroke:#333,stroke-width:2px;
    classDef core fill:#ff9999,stroke:#333,stroke-width:2px;
    classDef product fill:#99ccff,stroke:#333,stroke-width:2px;
    classDef gpu fill:#ccffcc,stroke:#333,stroke-width:2px;
    classDef comm fill:#ccffff,stroke:#333,stroke-width:2px;
    classDef web fill:#ffccff,stroke:#333,stroke-width:2px;

    %% Click Events for Core Infrastructure & Libraries
    click RC "https://github.com/angeliteai/angelite/tree/main/lib/rust/io-sys"
    click LR "https://github.com/angeliteai/angelite/tree/main/src-old/rust"

    %% Click Events for Feature/Product Modules
    click AC "https://github.com/angeliteai/angelite/tree/main/src-old/javascript/old/angelite-chat"
    click AD "https://github.com/angeliteai/angelite/tree/main/src-old/javascript/angelite"
    click AA "https://github.com/angeliteai/angelite/tree/main/src-old/javascript/angelite-ai"
    click API "https://github.com/angeliteai/angelite/tree/main/src-old/refactor/api-diy"
    click PR "https://github.com/angeliteai/angelite/tree/main/src-old/rust/prism"

    %% Click Events for GPU and WASM Modules
    click SH "https://github.com/angeliteai/angelite/blob/main/Shader.metal"
    click GS "https://github.com/angeliteai/angelite/tree/main/src/gfx"
    click MC "https://github.com/angeliteai/angelite/tree/main/src/math"
    click SG "https://github.com/angeliteai/angelite/tree/main/src-old/swift/gfx"
    click ZG "https://github.com/angeliteai/angelite/tree/main/src-old/zig/gfx"

    %% Click Events for Communication & Distributed System
    click RT "https://github.com/angeliteai/angelite/tree/main/src-old/rust/rt"
    click ZLS "https://github.com/angeliteai/angelite/tree/main/src-old/rust/sync"

    %% Click Events for Web/Frontend Components
    click AAApp "https://github.com/angeliteai/angelite/tree/main/src-old/javascript/angelite-app"
    click AABlog "https://github.com/angeliteai/angelite/tree/main/src-old/javascript/angelite-blog"
```
