# satrai-lab/comdex architecture

> Architecture diagram of the GitHub repository satrai-lab/comdex, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/satrai-lab/comdex
- Repository: https://github.com/satrai-lab/comdex

## Overview

ComDeX is a decentralized NGSI-LD-style IoT broker built around an Action Handler and MQTT brokers; the primary workflow is a client issuing an entity or subscription action, which the handler exchanges through MQTT. The repository also contains ComDeX-FL, an extension for collaborative training, and demo materials for federated setups. The graph shows the documented core and the sampled FL components; unsampled demo internals and unverified runtime connections are not expanded.

Main entry points: [`actionhandler.py`](https://github.com/satrai-lab/comdex/blob/main/actionhandler.py) (Action Handler), [`comdex-FL/fl_collab.py`](https://github.com/satrai-lab/comdex/blob/main/comdex-FL/fl_collab.py) (FL Coordination), [`comdex-FL/c_action.py`](https://github.com/satrai-lab/comdex/blob/main/comdex-FL/c_action.py) (FL Action Handler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_core["ComDeX Core"]
  node_handler["Action Handler<br/>[actionhandler.py]"]
  node_mqtt[("MQTT Broker")]
  node_entity["Entity Operations<br/>[actionhandler.py]"]
  node_subscriptions["Subscriptions<br/>[actionhandler.py]"]
end

subgraph group_discovery["Context Discovery"]
  node_discovery["Context Discovery<br/>[actionhandler.py]"]
  node_advertisements["Provider Advertisements<br/>[actionhandler.py]"]
end

subgraph group_fl["Federated Learning"]
  node_fl_action["FL Action Handler<br/>[c_action.py]"]
  node_fl_control["FL Coordination<br/>[fl_collab.py]"]
  node_datasets["Dataset Loading<br/>[fl_collab.py]"]
  node_models["Model Registry<br/>[fl_collab.py]"]
  node_training["Local Training<br/>[fl_collab.py]"]
  node_fl_server["FL Server<br/>[fl_collab.py]"]
  node_fl_client["FL Client<br/>[fl_collab.py]"]
end

subgraph group_demos["Demonstrations"]
  node_demo["Federation Demos"]
end

node_client(("IoT Client"))

node_client -->|"requests actions"| node_handler
node_handler -->|"routes commands"| node_entity
node_handler -->|"routes commands"| node_subscriptions
node_entity -->|"publishes entities"| node_mqtt
node_subscriptions -.->|"subscribes topics"| node_mqtt
node_handler -->|"discovers context"| node_discovery
node_discovery -->|"queries topics"| node_mqtt
node_handler -->|"monitors providers"| node_advertisements
node_advertisements -->|"subscribes topics"| node_mqtt
node_fl_control -->|"loads data"| node_datasets
node_fl_control -->|"creates models"| node_models
node_fl_client -->|"trains locally"| node_training
node_training -->|"uses loaders"| node_datasets
node_fl_server -->|"starts server role"| node_fl_control
node_fl_client -->|"starts client role"| node_fl_control
node_fl_control -.->|"references handler"| node_fl_action

click node_handler "https://github.com/satrai-lab/comdex/blob/main/actionhandler.py"
click node_entity "https://github.com/satrai-lab/comdex/blob/main/actionhandler.py"
click node_subscriptions "https://github.com/satrai-lab/comdex/blob/main/actionhandler.py"
click node_discovery "https://github.com/satrai-lab/comdex/blob/main/actionhandler.py"
click node_advertisements "https://github.com/satrai-lab/comdex/blob/main/actionhandler.py"
click node_fl_action "https://github.com/satrai-lab/comdex/blob/main/comdex-FL/c_action.py"
click node_fl_control "https://github.com/satrai-lab/comdex/blob/main/comdex-FL/fl_collab.py"
click node_datasets "https://github.com/satrai-lab/comdex/blob/main/comdex-FL/fl_collab.py"
click node_models "https://github.com/satrai-lab/comdex/blob/main/comdex-FL/fl_collab.py"
click node_training "https://github.com/satrai-lab/comdex/blob/main/comdex-FL/fl_collab.py"
click node_fl_server "https://github.com/satrai-lab/comdex/blob/main/comdex-FL/fl_collab.py"
click node_fl_client "https://github.com/satrai-lab/comdex/blob/main/comdex-FL/fl_collab.py"
click node_demo "https://github.com/satrai-lab/comdex/tree/main/DEMO"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_handler,node_mqtt,node_entity,node_subscriptions,node_client toneBlue
class node_discovery,node_advertisements toneAmber
class node_fl_action,node_fl_control,node_datasets,node_models,node_training,node_fl_server,node_fl_client toneMint
class node_demo toneRose
```

## Components

### ComDeX Core

- [Action Handler](https://github.com/satrai-lab/comdex/blob/main/actionhandler.py): `actionhandler.py`
- **MQTT Broker**
- [Entity Operations](https://github.com/satrai-lab/comdex/blob/main/actionhandler.py): `actionhandler.py`
- [Subscriptions](https://github.com/satrai-lab/comdex/blob/main/actionhandler.py): `actionhandler.py`

### Context Discovery

- [Context Discovery](https://github.com/satrai-lab/comdex/blob/main/actionhandler.py): `actionhandler.py`
- [Provider Advertisements](https://github.com/satrai-lab/comdex/blob/main/actionhandler.py): `actionhandler.py`

### Federated Learning

- [FL Action Handler](https://github.com/satrai-lab/comdex/blob/main/comdex-FL/c_action.py): `comdex-FL/c_action.py`
- [FL Coordination](https://github.com/satrai-lab/comdex/blob/main/comdex-FL/fl_collab.py): `comdex-FL/fl_collab.py`
- [Dataset Loading](https://github.com/satrai-lab/comdex/blob/main/comdex-FL/fl_collab.py): `comdex-FL/fl_collab.py`
- [Model Registry](https://github.com/satrai-lab/comdex/blob/main/comdex-FL/fl_collab.py): `comdex-FL/fl_collab.py`
- [Local Training](https://github.com/satrai-lab/comdex/blob/main/comdex-FL/fl_collab.py): `comdex-FL/fl_collab.py`
- [FL Server](https://github.com/satrai-lab/comdex/blob/main/comdex-FL/fl_collab.py): `comdex-FL/fl_collab.py`
- [FL Client](https://github.com/satrai-lab/comdex/blob/main/comdex-FL/fl_collab.py): `comdex-FL/fl_collab.py`

### Demonstrations

- [Federation Demos](https://github.com/satrai-lab/comdex/tree/main/DEMO): `DEMO`

### Other components

- **IoT Client**

## Connections

- IoT Client → Action Handler: requests actions (evidence: `README.md`)
- Action Handler → Entity Operations: routes commands (evidence: `actionhandler.py`)
- Action Handler → Subscriptions: routes commands (evidence: `README.md`)
- Entity Operations → MQTT Broker: publishes entities (evidence: `actionhandler.py`)
- Subscriptions → MQTT Broker: subscribes topics (evidence: `README.md`)
- Action Handler → Context Discovery: discovers context (evidence: `README.md`)
- Context Discovery → MQTT Broker: queries topics (evidence: `actionhandler.py`)
- Action Handler → Provider Advertisements: monitors providers (evidence: `actionhandler.py`)
- Provider Advertisements → MQTT Broker: subscribes topics (evidence: `actionhandler.py`)
- FL Coordination → Dataset Loading: loads data (evidence: `comdex-FL/fl_collab.py`)
- FL Coordination → Model Registry: creates models (evidence: `comdex-FL/fl_collab.py`)
- FL Client → Local Training: trains locally (evidence: `comdex-FL/fl_collab.py`)
- Local Training → Dataset Loading: uses loaders (evidence: `comdex-FL/fl_collab.py`)
- FL Server → FL Coordination: starts server role (evidence: `comdex-FL/fl_collab.py`)
- FL Client → FL Coordination: starts client role (evidence: `comdex-FL/fl_collab.py`)
- FL Coordination → FL Action Handler: references handler (evidence: `comdex-FL/fl_collab.py`)
