# rusaexp1emb2025/group16 architecture

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

- Interactive diagram: https://gitdiagram.com/rusaexp1emb2025/group16
- Repository: https://github.com/rusaexp1emb2025/group16

## Overview

##### Project type and purpose
- This is a backend service written in Rust, organized as a Cargo workspace under `server/`.
- It exposes an HTTP API to clients, applies domain logic, and calls out to an external “Remo” API (IoT endpoint) to adjust lighting.

##### File structure
- Top-level crates in `server/`:
- **atmos**: Rust binary (`main.rs`) – the entry point.
- **atmos_server**: Library crate implementing the service’s layers (domains, inbound HTTP, outbound adapters).
- **remo_api**: Auto-generated client code for the external Remo API.
- `atmos_server/src/domain`: business models (e.g. lighting, atmosfreq), ports and services (DDD style).
- `atmos_server/src/inbound/http`: HTTP routes and API definitions.
- `atmos_server/src/outbound/remo`: adapter invoking `remo_api` to talk to the IoT cloud.
- No database code – it’s a real-time, stateless orchestrator between HTTP clients and IoT.

##### README for additional insights
- The README only names the project (“group16”), so we rely on code structure to infer the layered DDD pattern and external API integration.

##### Essential details to capture
– The Cargo workspace structure and crate boundaries.
– The inbound/outbound ports & adapters pattern.
– The flow of data from client to IoT device and back.
– The dependency of `atmos_server` on `remo_api` for external calls.
– The entry point (`atmos` crate) that glues everything together.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Clients
    Client["Clients"]:::external

    %% Atmos Binary
    atmos_bin["atmos (binary)"]:::internal

    %% Server Library Crate
    subgraph "atmos_server (library crate)"
        lib_root["atmos_server root"]:::internal

        subgraph "Inbound HTTP Layer"
            api["api.rs"]:::internal
            routes["routes.rs"]:::internal
            adjust["adjust_lighting.rs"]:::internal
        end

        subgraph "Domain Layer"
            models["models.rs"]:::internal
            lighting_model["models/lighting.rs"]:::internal
            atmosfreq_model["models/atmosfreq.rs"]:::internal
            ports["ports.rs"]:::internal
            lighting_port["ports/lighting.rs"]:::internal
            service["service.rs"]:::internal
            adjust_svc["adjust_lighting.rs"]:::internal
        end

        outbound["Outbound Adapter (remo.rs)"]:::internal
    end

    %% remo_api crate
    subgraph "remo_api (auto-generated)"
        remo_api_root["remo_api root"]:::library
        default_api["default_api.rs"]:::library
        api_models["models (data models)"]:::library
    end

    %% External System
    RemoCloud["Remo Cloud / IoT Devices"]:::external

    %% Connections
    Client -->|HTTP Request| atmos_bin
    atmos_bin -->|starts server| lib_root
    lib_root -->|handles request| api
    api --> routes
    routes --> adjust
    adjust --> models
    models --> lighting_model
    lighting_model --> atmosfreq_model
    atmosfreq_model --> ports
    ports --> lighting_port
    lighting_port --> service
    service --> adjust_svc
    adjust_svc --> outbound
    outbound -->|calls| remo_api_root
    remo_api_root --> default_api
    default_api --> api_models
    api_models --> RemoCloud
    RemoCloud -->|response| api_models
    api_models --> default_api
    default_api --> remo_api_root
    remo_api_root --> outbound
    outbound --> adjust_svc
    adjust_svc --> service
    service --> lighting_port
    lighting_port --> ports
    ports --> atmosfreq_model
    atmosfreq_model --> lighting_model
    lighting_model --> models
    models --> adjust
    adjust --> routes
    routes --> api
    api --> lib_root
    lib_root --> atmos_bin
    atmos_bin --> Client

    %% Click Events
    click atmos_bin "https://github.com/rusaexp1emb2025/group16/blob/main/server/crates/atmos/src/main.rs"
    click lib_root "https://github.com/rusaexp1emb2025/group16/blob/main/server/crates/atmos_server/src/lib.rs"
    click api "https://github.com/rusaexp1emb2025/group16/blob/main/server/crates/atmos_server/src/inbound/http/api.rs"
    click routes "https://github.com/rusaexp1emb2025/group16/blob/main/server/crates/atmos_server/src/inbound/http/routes.rs"
    click adjust "https://github.com/rusaexp1emb2025/group16/blob/main/server/crates/atmos_server/src/inbound/http/routes/adjust_lighting.rs"
    click models "https://github.com/rusaexp1emb2025/group16/blob/main/server/crates/atmos_server/src/domain/models.rs"
    click lighting_model "https://github.com/rusaexp1emb2025/group16/blob/main/server/crates/atmos_server/src/domain/models/lighting.rs"
    click atmosfreq_model "https://github.com/rusaexp1emb2025/group16/blob/main/server/crates/atmos_server/src/domain/models/atmosfreq.rs"
    click ports "https://github.com/rusaexp1emb2025/group16/blob/main/server/crates/atmos_server/src/domain/ports.rs"
    click lighting_port "https://github.com/rusaexp1emb2025/group16/blob/main/server/crates/atmos_server/src/domain/ports/lighting.rs"
    click service "https://github.com/rusaexp1emb2025/group16/blob/main/server/crates/atmos_server/src/domain/service.rs"
    click adjust_svc "https://github.com/rusaexp1emb2025/group16/blob/main/server/crates/atmos_server/src/domain/service/adjust_lighting.rs"
    click outbound "https://github.com/rusaexp1emb2025/group16/blob/main/server/crates/atmos_server/src/outbound/remo.rs"
    click remo_api_root "https://github.com/rusaexp1emb2025/group16/blob/main/server/crates/remo_api/src/lib.rs"
    click default_api "https://github.com/rusaexp1emb2025/group16/blob/main/server/crates/remo_api/src/apis/default_api.rs"
    click api_models "https://github.com/rusaexp1emb2025/group16/tree/main/server/crates/remo_api/src/models"

    %% Styles
    classDef internal fill:#a8f0a5,stroke:#333,stroke-width:1px
    classDef library fill:#a5c8f0,stroke:#333,stroke-width:1px
    classDef external fill:#d3d3d3,stroke:#333,stroke-width:1px
```
