# akthamh/iot-management-platform architecture

> Architecture diagram of the GitHub repository akthamh/iot-management-platform, 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/akthamh/iot-management-platform
- Repository: https://github.com/akthamh/iot-management-platform

## Overview

This is a local, interactive Python CLI for managing IoT devices and their tenant assignments. The user selects tenant or device operations in the main menu; managers validate input and coordinate catalog selection and repository operations, while repositories persist records in SQLite and expose Tenant and Device objects. Device workflows include registration, listing, search, update, deletion, catalog browsing, and tenant display; tenant workflows include registration, listing, lookup, and search. The README documents migration and foreign-key behavior. Edges reflect the excerpts and README; unsampled implementation details are not inferred.

Main entry points: [`main.py`](https://github.com/akthamh/iot-management-platform/blob/main/main.py) (Menu and routing), [`modules/device_manager.py`](https://github.com/akthamh/iot-management-platform/blob/main/modules/device_manager.py) (Device operations), [`modules/tenant_repository.py`](https://github.com/akthamh/iot-management-platform/blob/main/modules/tenant_repository.py) (Tenant repository), [`modules/database.py`](https://github.com/akthamh/iot-management-platform/blob/main/modules/database.py) (SQLite setup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI workflows"]
  node_app["Menu and routing<br/>[main.py]"]
  node_tenant_ops["Tenant operations<br/>[tenant_manager.py]"]
  node_device_ops["Device operations<br/>[device_manager.py]"]
end

subgraph group_domain["Catalog and models"]
  node_catalog["Device catalog<br/>[device_catalog.py]"]
  node_tenant_model["Tenant model<br/>[tenant.py]"]
  node_device_model["Device model<br/>[device.py]"]
end

subgraph group_persistence["Persistence"]
  node_tenant_repo["Tenant repository"]
  node_device_repo["Device repository"]
  node_database["SQLite setup<br/>[database.py]"]
end

node_user(("User"))
node_sqlite[("SQLite database")]

node_user -->|"selects operations"| node_app
node_app -->|"initializes"| node_database
node_app -->|"routes tenant actions"| node_tenant_ops
node_app -->|"routes device actions"| node_device_ops
node_app -->|"shows catalog"| node_catalog
node_tenant_ops -->|"calls tenant queries"| node_tenant_repo
node_tenant_ops -->|"displays objects"| node_tenant_model
node_device_ops -->|"calls device queries"| node_device_repo
node_device_ops -->|"looks up tenants"| node_tenant_repo
node_device_ops -->|"selects device type"| node_catalog
node_device_ops -->|"creates objects"| node_device_model
node_tenant_repo -->|"opens connection"| node_database
node_device_repo -->|"opens connection"| node_database
node_tenant_repo -->|"returns objects"| node_tenant_model
node_device_repo -->|"returns objects"| node_device_model
node_database -->|"creates schema and connections"| node_sqlite

click node_app "https://github.com/akthamh/iot-management-platform/blob/main/main.py"
click node_tenant_ops "https://github.com/akthamh/iot-management-platform/blob/main/modules/tenant_manager.py"
click node_device_ops "https://github.com/akthamh/iot-management-platform/blob/main/modules/device_manager.py"
click node_catalog "https://github.com/akthamh/iot-management-platform/blob/main/modules/device_catalog.py"
click node_tenant_model "https://github.com/akthamh/iot-management-platform/blob/main/modules/models/tenant.py"
click node_device_model "https://github.com/akthamh/iot-management-platform/blob/main/modules/models/device.py"
click node_tenant_repo "https://github.com/akthamh/iot-management-platform/blob/main/modules/tenant_repository.py"
click node_device_repo "https://github.com/akthamh/iot-management-platform/blob/main/modules/device_repository.py"
click node_database "https://github.com/akthamh/iot-management-platform/blob/main/modules/database.py"

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_app,node_tenant_ops,node_device_ops,node_user toneBlue
class node_catalog,node_tenant_model,node_device_model,node_sqlite toneAmber
class node_tenant_repo,node_device_repo,node_database toneMint
```

## Components

### CLI workflows

- [Menu and routing](https://github.com/akthamh/iot-management-platform/blob/main/main.py): `main.py`
- [Tenant operations](https://github.com/akthamh/iot-management-platform/blob/main/modules/tenant_manager.py): `modules/tenant_manager.py`
- [Device operations](https://github.com/akthamh/iot-management-platform/blob/main/modules/device_manager.py): `modules/device_manager.py`

### Catalog and models

- [Device catalog](https://github.com/akthamh/iot-management-platform/blob/main/modules/device_catalog.py): `modules/device_catalog.py`
- [Tenant model](https://github.com/akthamh/iot-management-platform/blob/main/modules/models/tenant.py): `modules/models/tenant.py`
- [Device model](https://github.com/akthamh/iot-management-platform/blob/main/modules/models/device.py): `modules/models/device.py`

### Persistence

- [Tenant repository](https://github.com/akthamh/iot-management-platform/blob/main/modules/tenant_repository.py): `modules/tenant_repository.py`
- [Device repository](https://github.com/akthamh/iot-management-platform/blob/main/modules/device_repository.py): `modules/device_repository.py`
- [SQLite setup](https://github.com/akthamh/iot-management-platform/blob/main/modules/database.py): `modules/database.py`

### Other components

- **User**
- **SQLite database**

## Connections

- User → Menu and routing: selects operations (evidence: `README.md`)
- Menu and routing → SQLite setup: initializes (evidence: `main.py`)
- Menu and routing → Tenant operations: routes tenant actions (evidence: `main.py`)
- Menu and routing → Device operations: routes device actions (evidence: `main.py`)
- Menu and routing → Device catalog: shows catalog (evidence: `main.py`)
- Tenant operations → Tenant repository: calls tenant queries (evidence: `modules/tenant_manager.py`)
- Tenant operations → Tenant model: displays objects (evidence: `modules/tenant_manager.py`)
- Device operations → Device repository: calls device queries (evidence: `modules/device_manager.py`)
- Device operations → Tenant repository: looks up tenants (evidence: `modules/device_manager.py`)
- Device operations → Device catalog: selects device type (evidence: `modules/device_manager.py`)
- Device operations → Device model: creates objects (evidence: `modules/device_manager.py`)
- Tenant repository → SQLite setup: opens connection (evidence: `modules/tenant_repository.py`)
- Device repository → SQLite setup: opens connection (evidence: `modules/device_repository.py`)
- Tenant repository → Tenant model: returns objects (evidence: `modules/tenant_repository.py`)
- Device repository → Device model: returns objects (evidence: `modules/device_repository.py`)
- SQLite setup → SQLite database: creates schema and connections (evidence: `modules/database.py`)
