# mendersoftware/mender-helm architecture

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

- Interactive diagram: https://gitdiagram.com/mendersoftware/mender-helm
- Repository: https://github.com/mendersoftware/mender-helm

## Overview

##### Project Type and Purpose
- Mender is a Helm chart for deploying the Mender server services – a microservices-based, IoT device management and software update platform. Its purpose is to update and manage IoT devices at scale securely.
- The README indicates that Mender has both enterprise and open source modes. It provides installation instructions via Helm and describes many distinct components (e.g., api‑gateway, deployments, device-auth, gui, tenantadm, etc.).

##### Analyzing the File Structure
- The top-level directories consist of configuration files (Makefile, .gitignore), examples, and the “mender” directory that holds the Helm chart definitions.
- Within “mender/templates”, you see many subdirectories corresponding to various microservices (for instance, “api-gateway”, “device-auth”, “deployments”, “gui”, “inventory”, “tenantadm”, “useradm”, “workflows”, “auditlogs”, “create-artifact-worker”, etc.). This means the chart deploys many interrelated components.
- Additional directories (e.g., tests, examples) provide testing scripts and YAML sample values.
- The presence of dependency chart archives (MongoDB, NATS, Redis) within mender/charts suggests essential external or bundled services.

##### Architectural Insights from the README
- The README details many configurable parameters for each component. This reinforces the microservices nature where each subcomponent (service) – like API Gateway, device authentication, inventory, deployments, etc. – is independently scalable and configured.
- There is explicit mention of external dependencies such as Docker registries, databases (MongoDB), messaging (NATS), caching (Redis), S3/MinIO storage, and even external SMTP configurations.

a. Main Components:
– API Gateway: Acts as the entry point, handling the external TLS/HTTP load and reverse proxy (using Traefik).
– Service Components: Components like device-auth, deployments, gui, inventory, reporting, tenantadm, useradm, workflows, auditlogs, deviceconnect, deviceconfig, devicemonitor, etc. Each is represented as its own deployment/pod.
– Supporting Services: Bundled dependencies such as MongoDB, NATS, Redis, and optionally storage services (MinIO/AWS S3 or Azure Blob Storage).
– Persistence & Secrets: Persistent volumes (especially for the generate-delta-worker) and K8s secrets for sensitive data (like TLS certificates and various credentials).
– Kubernetes Infrastructure: Helm release objects, horizontal autoscaling, pod security contexts, and update strategies.

b. Relationships and Interactions:
– Show dependency relationships between the components and their external databases/messaging systems. For example, device-auth and inventory point to MongoDB and Redis; API Gateway may route some calls towards MinIO/Storage Proxy.
– Indicate automation for database migrations and maintenance cronjobs as separate but supporting flows.
– Represent external integrations like SMTP, authentication and rate-limiting (e.g., in api-gateway) as separate nodes.

c. Architectural Patterns and Design Principles:
– Use a microservices architecture pattern where each component is an isolated service (deployed as a separate Helm template and pod) that communicates over defined APIs.
– Emphasize the separation between control-plane (e.g., tenantadm, useradm) and data plane (e.g., device-auth) components.

d. Relevant Technologies/Frameworks:
– Kubernetes as the orchestration platform.
– Helm for deployment management.
– Traefik (via the api-gateway component) for HTTP routing.
– Docker images for containerized services, as pulled from registries (docker.io and registry.mender.io).
– External services such as MongoDB (for persistence), NATS (for messaging), Redis (for caching), and S3/MinIO (for storage).

##### Detailed Steps for the Principal Software Engineer
– Exit the API Gateway block into individual blocks representing each service (gui, device-auth, deployments, inventory, tenantadm, useradm, workflows, auditlogs, etc.).
c. Connection with configuration or protocol details where useful (e.g., ‘REST API’, ‘DB connection’, ‘Messaging’).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Global Nodes
    Client["Client"]:::external

    %% Frontend Services Subgraph
    subgraph "Frontend Services"
        API_Gateway["API Gateway"]:::frontend
        GUI["GUI"]:::frontend
    end

    %% Backend Services Subgraph
    subgraph "Backend Services"
        Device_Auth["Device Auth"]:::backend
        Deployments["Deployments"]:::backend
        Inventory["Inventory"]:::backend
        Tenantadm["Tenant Administration"]:::backend
        Useradm["User Administration"]:::backend
        Auditlogs["Audit Logs"]:::backend
        Workflows["Workflows"]:::backend
        Create_Artifact_Worker["Create Artifact Worker"]:::backend
        Device_Config["Device Configuration"]:::backend
        Device_Connect["Device Connect"]:::backend
        Device_Monitor["Device Monitor"]:::backend
        Generate_Delta_Worker["Generate Delta Worker"]:::backend
        IoT_Manager["IoT Manager"]:::backend
    end

    %% External Dependencies Subgraph
    subgraph "External Dependencies"
        External_Dep["MongoDB, NATS, Redis"]:::external
    end

    %% Connections from Client to Frontend
    Client -->|"HTTP/TLS"| API_Gateway

    %% Connections within Frontend
    API_Gateway -->|"REST"| GUI

    %% API Gateway forwarding to Backend Microservices
    API_Gateway -->|"routes"| Device_Auth
    API_Gateway -->|"routes"| Deployments
    API_Gateway -->|"routes"| Inventory
    API_Gateway -->|"routes"| Tenantadm
    API_Gateway -->|"routes"| Useradm
    API_Gateway -->|"routes"| Auditlogs
    API_Gateway -->|"routes"| Workflows
    API_Gateway -->|"routes"| Create_Artifact_Worker
    API_Gateway -->|"routes"| Device_Config
    API_Gateway -->|"routes"| Device_Connect
    API_Gateway -->|"routes"| Device_Monitor
    API_Gateway -->|"routes"| Generate_Delta_Worker
    API_Gateway -->|"routes"| IoT_Manager

    %% Connections from specific backend services to external dependencies
    Device_Auth -->|"DB"| External_Dep
    Inventory -->|"Cache/DB"| External_Dep
    API_Gateway -->|"Storage"| External_Dep

    %% Class Definitions for coloring
    classDef frontend fill:#e0f7ff,stroke:#1f78b4,stroke-width:2px;
    classDef backend fill:#e0ffe0,stroke:#33a02c,stroke-width:2px;
    classDef external fill:#f0f0f0,stroke:#666666,stroke-width:2px;

    %% Click Events
    click API_Gateway "https://github.com/mendersoftware/mender-helm/tree/master/mender/templates/api-gateway"
    click Device_Auth "https://github.com/mendersoftware/mender-helm/tree/master/mender/templates/device-auth"
    click Deployments "https://github.com/mendersoftware/mender-helm/tree/master/mender/templates/deployments"
    click GUI "https://github.com/mendersoftware/mender-helm/tree/master/mender/templates/gui"
    click Inventory "https://github.com/mendersoftware/mender-helm/tree/master/mender/templates/inventory"
    click Tenantadm "https://github.com/mendersoftware/mender-helm/tree/master/mender/templates/tenantadm"
    click Useradm "https://github.com/mendersoftware/mender-helm/tree/master/mender/templates/useradm"
    click Auditlogs "https://github.com/mendersoftware/mender-helm/tree/master/mender/templates/auditlogs"
    click Workflows "https://github.com/mendersoftware/mender-helm/tree/master/mender/templates/workflows"
    click Create_Artifact_Worker "https://github.com/mendersoftware/mender-helm/tree/master/mender/templates/create-artifact-worker"
    click Device_Config "https://github.com/mendersoftware/mender-helm/tree/master/mender/templates/deviceconfig"
    click Device_Connect "https://github.com/mendersoftware/mender-helm/tree/master/mender/templates/deviceconnect"
    click Device_Monitor "https://github.com/mendersoftware/mender-helm/tree/master/mender/templates/devicemonitor"
    click Generate_Delta_Worker "https://github.com/mendersoftware/mender-helm/tree/master/mender/templates/generate-delta-worker"
    click IoT_Manager "https://github.com/mendersoftware/mender-helm/tree/master/mender/templates/iot-manager"
    click External_Dep "https://github.com/mendersoftware/mender-helm/tree/master/mender/charts"
```
