# absmach/propeller architecture

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

- Interactive diagram: https://gitdiagram.com/absmach/propeller
- Repository: https://github.com/absmach/propeller

## Overview

##### Main Components

a) Core Services (represented as distinct containers/components):
- Manager Service (cmd/manager)
- Proplet Service (cmd/proplet)
- Proxy Service (cmd/proxy)
- CLI Interface (cmd/cli)

b) Infrastructure Components:
- NATS Message Broker (docker/nats)
- Nginx Reverse Proxy (docker/nginx)
- SpiceDB for authorization (docker/spicedb)
- OCI Registry (external component)

c) Runtime Components:
- WebAssembly Runtimes
- Wazero Runtime (proplet/runtimes/wazero.go)
- Host Runtime (proplet/runtimes/host.go)

##### Client Layer
- CLI tool connecting to Manager API
- External systems connecting via MQTT/HTTP proxy

##### Control Plane
- Manager service as the central orchestrator
- Connection to storage layer (pkg/storage)
- Integration with scheduler (pkg/scheduler)

##### Data Plane
- Proplet instances running WebAssembly workloads
- MQTT message routing through SuperMQ
- Proxy handling HTTP/MQTT traffic

##### Architectural Patterns to Highlight

- Service Mesh Architecture
- Event-driven communication via NATS
- Multi-runtime support for WebAssembly
- Security layer with SSL/TLS (docker/ssl)

##### Storage/State Layer

Use these visual elements:
- Blue containers for core services
- Green connections for secure communication
- Orange for WebAssembly runtimes
- Purple for infrastructure components

##### Implementation Details

- Rectangles: Core services
- Hexagons: Runtime environments
- Clouds: External services

**2. Include these connections:**
- REST APIs (Manager ↔ CLI)
- MQTT routes (Proxy ↔ Proplets)
- Event bus (NATS connections)
- Storage access patterns

**3. Add annotations for:**
- Security boundaries
- Scaling points
- WebAssembly execution environments
- Service mesh communication paths

##### Key Technical Elements to Emphasize

- WebAssembly runtime integration
- MQTT/HTTP proxy capabilities
- Scheduler implementation
- Security features (SSL/TLS, client verification)
- Storage abstractions
- Service mesh integration

## Diagram (Mermaid)

```mermaid
graph TB
    %% Define styles
    classDef client fill:#B7C9E2,stroke:#333
    classDef security fill:#FFB6C1,stroke:#333
    classDef control fill:#90EE90,stroke:#333
    classDef messaging fill:#DDA0DD,stroke:#333
    classDef runtime fill:#F0E68C,stroke:#333
    classDef storage fill:#E6E6FA,stroke:#333
    classDef proxy fill:#98FB98,stroke:#333
    classDef middleware fill:#FFA07A,stroke:#333

    %% Client Layer
    CLI["CLI Interface"]:::client
    ExtSys["External Systems"]:::client

    %% Security Layer
    NGINX["Nginx Reverse Proxy"]:::security
    SSL["SSL/TLS Layer"]:::security
    SpiceDB["SpiceDB Auth"]:::security

    %% Control Plane
    Manager["Manager Service"]:::control
    API["API Layer"]:::control
    Scheduler["Scheduler"]:::control

    %% Message Bus
    NATS["NATS Message Broker"]:::messaging

    %% Data Plane
    Proplet["Proplet Service"]:::runtime
    WazeroRT["Wazero Runtime"]:::runtime
    HostRT["Host Runtime"]:::runtime

    %% Storage Layer
    Storage["Storage Layer"]:::storage

    %% Proxy Layer
    ProxyService["Proxy Service"]:::proxy
    HTTPProxy["HTTP Proxy"]:::proxy
    MQTTProxy["MQTT Proxy"]:::proxy

    %% Middleware
    Logging["Logging Middleware"]:::middleware
    Metrics["Metrics Middleware"]:::middleware
    Tracing["Tracing Middleware"]:::middleware

    %% Relationships
    CLI --> NGINX
    ExtSys --> NGINX
    NGINX --> SSL
    SSL --> API
    API --> Manager
    Manager --> SpiceDB
    Manager --> Scheduler
    Manager --> Storage
    Manager --> NATS
    NATS --> Proplet
    Proplet --> WazeroRT
    Proplet --> HostRT
    ProxyService --> HTTPProxy
    ProxyService --> MQTTProxy
    HTTPProxy --> NATS
    MQTTProxy --> NATS
    Manager --> Logging
    Manager --> Metrics
    Manager --> Tracing

    %% Click Events
    click CLI "https://github.com/absmach/propeller/blob/main/cmd/cli/main.go"
    click Manager "https://github.com/absmach/propeller/blob/main/cmd/manager/main.go"
    click Proplet "https://github.com/absmach/propeller/blob/main/cmd/proplet/main.go"
    click ProxyService "https://github.com/absmach/propeller/blob/main/cmd/proxy/main.go"
    click NATS "https://github.com/absmach/propeller/blob/main/docker/nats/nats.conf"
    click NGINX "https://github.com/absmach/propeller/blob/main/docker/nginx/nginx-key.conf"
    click SpiceDB "https://github.com/absmach/propeller/blob/main/docker/spicedb/schema.zed"
    click SSL "https://github.com/absmach/propeller/tree/main/docker/ssl/certs"
    click WazeroRT "https://github.com/absmach/propeller/blob/main/proplet/runtimes/wazero.go"
    click HostRT "https://github.com/absmach/propeller/blob/main/proplet/runtimes/host.go"
    click Storage "https://github.com/absmach/propeller/blob/main/pkg/storage/storage.go"
    click Scheduler "https://github.com/absmach/propeller/blob/main/pkg/scheduler/scheduler.go"
    click MQTTProxy "https://github.com/absmach/propeller/blob/main/pkg/mqtt/pubsub.go"
    click API "https://github.com/absmach/propeller/blob/main/manager/api/endpoint.go"
    click Logging "https://github.com/absmach/propeller/blob/main/manager/middleware/logging.go"
    click Metrics "https://github.com/absmach/propeller/blob/main/manager/middleware/metrics.go"
    click Tracing "https://github.com/absmach/propeller/blob/main/manager/middleware/tracing.go"
    click HTTPProxy "https://github.com/absmach/propeller/blob/main/proxy/http.go"
    click MQTTProxy "https://github.com/absmach/propeller/blob/main/proxy/mqtt.go"
```
