# ianluites/simons-column architecture

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

- Interactive diagram: https://gitdiagram.com/ianluites/simons-column
- Repository: https://github.com/ianluites/simons-column

## Overview

##### Main System Components

a) Hardware Layer:
- TPIC6C596 Shift Registers
- Raspberry Pi 3 B+
- LED Light Column

b) Software Components:
- Rust Server (Main Control Server)
- Python Light Control Library
- Web UI (Node.js/Svelte-based)
- Rust Emulator (Development Component)

##### Frontend Tier
- Monaco editor component (found in node/ui/src/lib)
- HTTP/WebSocket connections to the server

##### Backend Tier
- Main components:
- Choreography Module
- Orchestrator
- Web API Layer
- State Management

##### Hardware Control Tier
- TPIC6C596 Shift Registers
- Light Column
- GPIO Interface

- Rectangles: Main components
- Hexagons: Hardware components

##### Key Relationships to Highlight

a) Control Flow:
**Web UI → Rust Server → TPIC6C596 → Light Column**

b) Development Flow:
**Web UI → Rust Server → Emulator (Development Mode)**

##### Component Details

Server Components (rust/bin/server):
- API endpoints
- Choreography management
- Orchestration logic
- State management

Web UI Components (node/ui):
- SvelteKit application
- Monaco editor integration
- API communication layer

Hardware Interface:
- GPIO communication
- Shift register control
- Light patterns management

##### Additional Elements

- Version/environment indicators
- Configuration paths
- Development-only components

## Diagram (Mermaid)

```mermaid
graph TB
    %% Frontend Layer
    subgraph Frontend
        WebUI["Web UI"]:::frontend
        MonacoEditor["Monaco Editor"]:::frontend
    end
    click WebUI "https://github.com/IanLuites/Simons-Column/tree/main/node/ui/src"
    click MonacoEditor "https://github.com/IanLuites/Simons-Column/blob/main/node/ui/src/lib/Monaco.svelte"

    %% Backend Layer
    subgraph Backend
        RustServer["Rust Server"]:::server
        click RustServer "https://github.com/IanLuites/Simons-Column/blob/main/rust/bin/server/src/main.rs"

        subgraph ServerComponents
            Choreography["Choreography Module"]:::component
            Orchestrator["Orchestrator"]:::component
            WebAPI["Web API Layer"]:::component
            StateManager["State Management"]:::component
        end
        click Choreography "https://github.com/IanLuites/Simons-Column/blob/main/rust/bin/server/src/choreography/mod.rs"
        click Orchestrator "https://github.com/IanLuites/Simons-Column/blob/main/rust/bin/server/src/orchestrator/mod.rs"
        click WebAPI "https://github.com/IanLuites/Simons-Column/blob/main/rust/bin/server/src/web/api/mod.rs"
        click StateManager "https://github.com/IanLuites/Simons-Column/blob/main/rust/bin/server/src/web/state/mod.rs"
    end

    %% Hardware Layer
    subgraph Hardware
        ShiftRegister["TPIC6C596 Shift Register"]:::hardware
        LightColumn["LED Light Column"]:::hardware
        GPIO["GPIO Interface"]:::hardware
    end
    click ShiftRegister "https://github.com/IanLuites/Simons-Column/blob/main/rust/crates/tpic6c596/src/lib.rs"
    click GPIO "https://github.com/IanLuites/Simons-Column/blob/main/rust/crates/tpic6c596/src/connectors/rpi.rs"

    %% Development Components
    subgraph Development
        Emulator["Rust Emulator"]:::dev
        PythonLib["Python Light Control Library"]:::dev
        Benchmarks["Benchmarking Tools"]:::dev
        EmulatorInterface["Emulator Interface"]:::dev
    end
    click Emulator "https://github.com/IanLuites/Simons-Column/blob/main/rust/bin/emulator/src/main.rs"
    click PythonLib "https://github.com/IanLuites/Simons-Column/blob/main/python/lights/__init__.py"
    click Benchmarks "https://github.com/IanLuites/Simons-Column/tree/main/docs/benchmarks/gpio"
    click EmulatorInterface "https://github.com/IanLuites/Simons-Column/blob/main/rust/crates/tpic6c596/src/connectors/emulator.rs"

    %% Connections
    WebUI --> |HTTP/WebSocket| RustServer
    MonacoEditor --> WebUI
    RustServer --> Choreography
    RustServer --> Orchestrator
    RustServer --> WebAPI
    RustServer --> StateManager
    RustServer --> |Production| ShiftRegister
    ShiftRegister --> GPIO
    GPIO --> LightColumn
    RustServer -.-> |Development| Emulator
    Emulator -.-> EmulatorInterface
    PythonLib -.-> |Direct Control| GPIO

    %% Styles
    classDef frontend fill:#e6f3ff,stroke:#3182ce
    classDef server fill:#f0fff4,stroke:#38a169
    classDef component fill:#faf5ff,stroke:#805ad5
    classDef hardware fill:#fff5f5,stroke:#e53e3e
    classDef dev fill:#fffaf0,stroke:#dd6b20

    %% Legend
    subgraph Legend
        Frontend_L["Frontend Component"]:::frontend
        Server_L["Server Component"]:::server
        Component_L["Server Module"]:::component
        Hardware_L["Hardware Component"]:::hardware
        Dev_L["Development Component"]:::dev
    end
```
