# astianmuchui/gdg-devfest-nbo-26 architecture

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

- Interactive diagram: https://gitdiagram.com/astianmuchui/gdg-devfest-nbo-26
- Repository: https://github.com/astianmuchui/gdg-devfest-nbo-26

## Overview

This demo simulates device readings, publishes them over MQTT, stores received telemetry synchronously in ScyllaDB, and exposes health and telemetry query APIs. The main runtime path is producer → broker → MQTT subscription handler → ScyllaDB; API routes query the same store for latest, history, and count. Prometheus and Grafana are documented monitoring capabilities, but their configuration is present without sampled runtime wiring, so they are shown as a separate, unverified integration.

Main entry points: [`internal/mqtt/adapter.go`](https://github.com/astianmuchui/gdg-devfest-nbo-26/blob/v1-naive/internal/mqtt/adapter.go) (MQTT Subscriber), [`internal/mqtt/event.go`](https://github.com/astianmuchui/gdg-devfest-nbo-26/blob/v1-naive/internal/mqtt/event.go) (MQTT Events), [`internal/mqtt/handlers.go`](https://github.com/astianmuchui/gdg-devfest-nbo-26/blob/v1-naive/internal/mqtt/handlers.go) (Reading Handler), [`internal/handlers/api/telemetry.go`](https://github.com/astianmuchui/gdg-devfest-nbo-26/blob/v1-naive/internal/handlers/api/telemetry.go) (Telemetry API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingestion["Telemetry Ingestion"]
  node_producer["Device Simulator<br/>[main.go]"]
  node_device["Simulated Devices<br/>[main.go]"]
  node_broker["MQTT Broker"]
  node_mqtt_client["MQTT Subscriber<br/>[adapter.go]"]
  node_mqtt_events["MQTT Events<br/>[event.go]"]
  node_reading_handler["Reading Handler<br/>[handlers.go]"]
  node_environment["Environment Config<br/>[environment.go]"]
end

subgraph group_storage["Telemetry Storage"]
  node_scylla_connection["Scylla Connection<br/>[connector.go]"]
  node_telemetry_record["Telemetry Record<br/>[types.go]"]
  node_scylla_queries["Telemetry Queries<br/>[queries.go]"]
  node_scylla_db[("ScyllaDB")]
end

subgraph group_api["Query API"]
  node_routes["HTTP Routes<br/>[routes.go]"]
  node_telemetry_api["Telemetry API<br/>[telemetry.go]"]
end

subgraph group_observability["Monitoring"]
  node_prometheus["Prometheus<br/>[prometheus.yml]"]
  node_grafana["Grafana Dashboard"]
  node_node_exporter["Node Exporter"]
  node_scylla_metrics["Scylla Metrics"]
end

node_http_client(("API Client"))
node_health_client(("Health Client"))

node_producer -->|"simulates"| node_device
node_producer -->|"publishes readings"| node_broker
node_mqtt_client -->|"connects and subscribes"| node_broker
node_mqtt_client -->|"registers callbacks"| node_mqtt_events
node_mqtt_events -->|"dispatches readings"| node_reading_handler
node_reading_handler -->|"builds record"| node_telemetry_record
node_reading_handler -->|"writes telemetry"| node_scylla_queries
node_scylla_queries -->|"reads and writes"| node_scylla_db
node_scylla_connection -->|"opens session"| node_scylla_db
node_scylla_connection -->|"reads settings"| node_environment
node_mqtt_client -->|"reads settings"| node_environment
node_mqtt_events -->|"reads subscription topic"| node_environment
node_http_client -->|"requests"| node_routes
node_routes -->|"routes telemetry requests"| node_telemetry_api
node_telemetry_api -->|"queries telemetry"| node_scylla_queries
node_telemetry_api -->|"returns JSON"| node_http_client
node_health_client -->|"checks health"| node_routes
node_prometheus -.->|"scrapes"| node_node_exporter
node_prometheus -.->|"scrapes"| node_scylla_metrics
node_grafana -.->|"uses datasource"| node_prometheus

click node_producer "https://github.com/astianmuchui/gdg-devfest-nbo-26/blob/v1-naive/cmd/producer/main.go"
click node_device "https://github.com/astianmuchui/gdg-devfest-nbo-26/blob/v1-naive/cmd/producer/main.go"
click node_mqtt_client "https://github.com/astianmuchui/gdg-devfest-nbo-26/blob/v1-naive/internal/mqtt/adapter.go"
click node_mqtt_events "https://github.com/astianmuchui/gdg-devfest-nbo-26/blob/v1-naive/internal/mqtt/event.go"
click node_reading_handler "https://github.com/astianmuchui/gdg-devfest-nbo-26/blob/v1-naive/internal/mqtt/handlers.go"
click node_environment "https://github.com/astianmuchui/gdg-devfest-nbo-26/blob/v1-naive/internal/env/environment.go"
click node_scylla_connection "https://github.com/astianmuchui/gdg-devfest-nbo-26/blob/v1-naive/internal/scylla/connector.go"
click node_telemetry_record "https://github.com/astianmuchui/gdg-devfest-nbo-26/blob/v1-naive/internal/scylla/types.go"
click node_scylla_queries "https://github.com/astianmuchui/gdg-devfest-nbo-26/blob/v1-naive/internal/scylla/queries.go"
click node_routes "https://github.com/astianmuchui/gdg-devfest-nbo-26/blob/v1-naive/internal/routes/routes.go"
click node_telemetry_api "https://github.com/astianmuchui/gdg-devfest-nbo-26/blob/v1-naive/internal/handlers/api/telemetry.go"
click node_prometheus "https://github.com/astianmuchui/gdg-devfest-nbo-26/blob/v1-naive/prometheus/prometheus.yml"
click node_grafana "https://github.com/astianmuchui/gdg-devfest-nbo-26/blob/v1-naive/grafana/dashboards/node-exporter-full.json"

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_producer,node_device,node_broker,node_mqtt_client,node_mqtt_events,node_reading_handler,node_environment,node_http_client,node_health_client toneBlue
class node_scylla_connection,node_telemetry_record,node_scylla_queries,node_scylla_db toneAmber
class node_routes,node_telemetry_api toneMint
class node_prometheus,node_grafana,node_node_exporter,node_scylla_metrics toneRose
```

## Components

### Telemetry Ingestion

- [Device Simulator](https://github.com/astianmuchui/gdg-devfest-nbo-26/blob/v1-naive/cmd/producer/main.go): `cmd/producer/main.go`
- [Simulated Devices](https://github.com/astianmuchui/gdg-devfest-nbo-26/blob/v1-naive/cmd/producer/main.go): `cmd/producer/main.go`
- **MQTT Broker**
- [MQTT Subscriber](https://github.com/astianmuchui/gdg-devfest-nbo-26/blob/v1-naive/internal/mqtt/adapter.go): `internal/mqtt/adapter.go`
- [MQTT Events](https://github.com/astianmuchui/gdg-devfest-nbo-26/blob/v1-naive/internal/mqtt/event.go): `internal/mqtt/event.go`
- [Reading Handler](https://github.com/astianmuchui/gdg-devfest-nbo-26/blob/v1-naive/internal/mqtt/handlers.go): `internal/mqtt/handlers.go`
- [Environment Config](https://github.com/astianmuchui/gdg-devfest-nbo-26/blob/v1-naive/internal/env/environment.go): `internal/env/environment.go`

### Telemetry Storage

- [Scylla Connection](https://github.com/astianmuchui/gdg-devfest-nbo-26/blob/v1-naive/internal/scylla/connector.go): `internal/scylla/connector.go`
- [Telemetry Record](https://github.com/astianmuchui/gdg-devfest-nbo-26/blob/v1-naive/internal/scylla/types.go): `internal/scylla/types.go`
- [Telemetry Queries](https://github.com/astianmuchui/gdg-devfest-nbo-26/blob/v1-naive/internal/scylla/queries.go): `internal/scylla/queries.go`
- **ScyllaDB**

### Query API

- [HTTP Routes](https://github.com/astianmuchui/gdg-devfest-nbo-26/blob/v1-naive/internal/routes/routes.go): `internal/routes/routes.go`
- [Telemetry API](https://github.com/astianmuchui/gdg-devfest-nbo-26/blob/v1-naive/internal/handlers/api/telemetry.go): `internal/handlers/api/telemetry.go`

### Monitoring

- [Prometheus](https://github.com/astianmuchui/gdg-devfest-nbo-26/blob/v1-naive/prometheus/prometheus.yml): `prometheus/prometheus.yml`
- [Grafana Dashboard](https://github.com/astianmuchui/gdg-devfest-nbo-26/blob/v1-naive/grafana/dashboards/node-exporter-full.json): `grafana/dashboards/node-exporter-full.json`
- **Node Exporter**
- **Scylla Metrics**

### Other components

- **API Client**
- **Health Client**

## Connections

- Device Simulator → Simulated Devices: simulates (evidence: `cmd/producer/main.go`)
- Device Simulator → MQTT Broker: publishes readings (evidence: `cmd/producer/main.go`)
- MQTT Subscriber → MQTT Broker: connects and subscribes (evidence: `internal/mqtt/adapter.go`)
- MQTT Subscriber → MQTT Events: registers callbacks (evidence: `internal/mqtt/adapter.go`)
- MQTT Events → Reading Handler: dispatches readings (evidence: `internal/mqtt/event.go`)
- Reading Handler → Telemetry Record: builds record (evidence: `internal/mqtt/handlers.go`)
- Reading Handler → Telemetry Queries: writes telemetry (evidence: `internal/mqtt/handlers.go`)
- Telemetry Queries → ScyllaDB: reads and writes (evidence: `internal/scylla/queries.go`)
- Scylla Connection → ScyllaDB: opens session (evidence: `internal/scylla/connector.go`)
- Scylla Connection → Environment Config: reads settings (evidence: `internal/scylla/connector.go`)
- MQTT Subscriber → Environment Config: reads settings (evidence: `internal/mqtt/adapter.go`)
- MQTT Events → Environment Config: reads subscription topic (evidence: `internal/mqtt/event.go`)
- API Client → HTTP Routes: requests (evidence: `internal/routes/routes.go`)
- HTTP Routes → Telemetry API: routes telemetry requests (evidence: `internal/routes/routes.go`)
- Telemetry API → Telemetry Queries: queries telemetry (evidence: `internal/handlers/api/telemetry.go`)
- Telemetry API → API Client: returns JSON (evidence: `internal/handlers/api/telemetry.go`)
- Health Client → HTTP Routes: checks health (evidence: `internal/routes/routes.go`)
- Prometheus → Node Exporter: scrapes
- Prometheus → Scylla Metrics: scrapes
- Grafana Dashboard → Prometheus: uses datasource
