# espressif/esp-rainmaker architecture

> Architecture diagram of the GitHub repository espressif/esp-rainmaker, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/espressif/esp-rainmaker
- Repository: https://github.com/espressif/esp-rainmaker

## Overview

ESP RainMaker is firmware for ESP32 products that exposes device state and controls to RainMaker clients through the cloud. The primary workflow is defining a node, devices, and parameters in firmware, connecting it to the cloud over MQTT, and enabling phone apps or CLI tools to monitor and control it. The README also identifies claiming as the source of cloud credentials. Other documented or tree-visible capabilities include OTA, local control, scenes, schedules, groups, authentication, and Thread border-router support. Some connections are documented only at the product level; unsampled implementation links are omitted.

Main entry points: [`components/esp_rainmaker/src/core/esp_rmaker_node.c`](https://github.com/espressif/esp-rainmaker/blob/master/components/esp_rainmaker/src/core/esp_rmaker_node.c) (Node, devices, parameters), [`components/esp_rainmaker/src/mqtt/esp_rmaker_mqtt.c`](https://github.com/espressif/esp-rainmaker/blob/master/components/esp_rainmaker/src/mqtt/esp_rmaker_mqtt.c) (MQTT transport), [`components/esp_rainmaker/src/ota/esp_rmaker_ota.c`](https://github.com/espressif/esp-rainmaker/blob/master/components/esp_rainmaker/src/ota/esp_rmaker_ota.c) (OTA workflow), [`components/esp_rainmaker/src/core/esp_rmaker_client_data.c`](https://github.com/espressif/esp-rainmaker/blob/master/components/esp_rainmaker/src/core/esp_rmaker_client_data.c) (Client credentials)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_model["Device model"]
  node_node_model["Node, devices, parameters<br/>[esp_rmaker_node.c]"]
  node_standard_types["Standard device types"]
  node_standard_params["Standard parameters"]
  node_standard_services["Standard services"]
end

subgraph group_connect["Connectivity and identity"]
  node_mqtt["MQTT transport<br/>[esp_rmaker_mqtt.c]"]
  node_client_data["Client credentials"]
  node_node_auth["Node authentication"]
  node_auth_service["Authentication service"]
  node_command_response["Command responses"]
  node_console["Device console"]
end

subgraph group_features["Control capabilities"]
  node_local_control["Local control"]
  node_scenes["Scenes"]
  node_schedules["Schedules"]
  node_groups_feature["Device groups"]
  node_controller["RainMaker controller"]
end

subgraph group_updates["Firmware updates"]
  node_ota["OTA workflow<br/>[esp_rmaker_ota.c]"]
  node_ota_topics["Topic-based OTA"]
  node_ota_mqtt["MQTT image transfer"]
  node_ota_https["HTTPS image transfer"]
end

subgraph group_integrations["Platform integrations"]
  node_thread_br["Thread border router"]
end

node_developer(("Firmware developer"))
node_clients(("Phone app / CLI"))
node_cloud(("RainMaker Cloud"))
node_claim(("Claiming Service"))

node_developer -->|"defines devices"| node_node_model
node_node_model -.->|"can use"| node_standard_types
node_node_model -.->|"can use"| node_standard_params
node_node_model -.->|"can use"| node_standard_services
node_claim -->|"provides credentials"| node_client_data
node_client_data -->|"supplies identity data"| node_node_auth
node_node_auth -.->|"uses connection data"| node_mqtt
node_mqtt -->|"connects device"| node_cloud
node_clients -->|"remote access"| node_cloud
node_cloud -->|"remote connectivity"| node_mqtt
node_command_response -->|"publishes response"| node_mqtt
node_console -->|"sets parameters"| node_node_model
node_ota -->|"configures protocol"| node_ota_topics
node_ota -->|"selects transfer"| node_ota_https
node_ota -->|"selects transfer"| node_ota_mqtt
node_ota_topics -->|"publishes status"| node_mqtt
node_ota_mqtt -.->|"writes image blocks"| node_ota
node_thread_br -.->|"exposes service"| node_node_model

click node_node_model "https://github.com/espressif/esp-rainmaker/blob/master/components/esp_rainmaker/src/core/esp_rmaker_node.c"
click node_standard_types "https://github.com/espressif/esp-rainmaker/blob/master/components/esp_rainmaker/src/standard_types/esp_rmaker_standard_devices.c"
click node_standard_params "https://github.com/espressif/esp-rainmaker/blob/master/components/esp_rainmaker/src/standard_types/esp_rmaker_standard_params.c"
click node_standard_services "https://github.com/espressif/esp-rainmaker/blob/master/components/esp_rainmaker/src/standard_types/esp_rmaker_standard_services.c"
click node_mqtt "https://github.com/espressif/esp-rainmaker/blob/master/components/esp_rainmaker/src/mqtt/esp_rmaker_mqtt.c"
click node_client_data "https://github.com/espressif/esp-rainmaker/blob/master/components/esp_rainmaker/src/core/esp_rmaker_client_data.c"
click node_node_auth "https://github.com/espressif/esp-rainmaker/blob/master/components/esp_rainmaker/src/core/esp_rmaker_node_auth.c"
click node_auth_service "https://github.com/espressif/esp-rainmaker/blob/master/components/esp_rainmaker/src/core/esp_rmaker_auth_service.c"
click node_command_response "https://github.com/espressif/esp-rainmaker/blob/master/components/esp_rainmaker/src/core/esp_rmaker_cmd_resp_manager.c"
click node_console "https://github.com/espressif/esp-rainmaker/blob/master/components/esp_rainmaker/src/console/esp_rmaker_commands.c"
click node_local_control "https://github.com/espressif/esp-rainmaker/blob/master/components/esp_rainmaker/src/core/esp_rmaker_local_ctrl.c"
click node_scenes "https://github.com/espressif/esp-rainmaker/blob/master/components/esp_rainmaker/src/core/esp_rmaker_scenes.c"
click node_schedules "https://github.com/espressif/esp-rainmaker/blob/master/components/esp_rainmaker/src/core/esp_rmaker_schedule.c"
click node_groups_feature "https://github.com/espressif/esp-rainmaker/blob/master/components/esp_rainmaker/src/core/esp_rmaker_groups.c"
click node_controller "https://github.com/espressif/esp-rainmaker/blob/master/components/esp_rainmaker/src/rainmaker_controller/esp_rmaker_controller.c"
click node_ota "https://github.com/espressif/esp-rainmaker/blob/master/components/esp_rainmaker/src/ota/esp_rmaker_ota.c"
click node_ota_topics "https://github.com/espressif/esp-rainmaker/blob/master/components/esp_rainmaker/src/ota/esp_rmaker_ota_using_topics.c"
click node_ota_mqtt "https://github.com/espressif/esp-rainmaker/blob/master/components/esp_rainmaker/src/ota/esp_rmaker_mqtt_ota.c"
click node_ota_https "https://github.com/espressif/esp-rainmaker/blob/master/components/esp_rainmaker/src/ota/esp_rmaker_https_ota.c"
click node_thread_br "https://github.com/espressif/esp-rainmaker/blob/master/components/esp_rainmaker/src/thread_br/esp_rmaker_thread_br.c"

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_node_model,node_standard_types,node_standard_params,node_standard_services toneBlue
class node_mqtt,node_client_data,node_node_auth,node_auth_service,node_command_response,node_console toneAmber
class node_local_control,node_scenes,node_schedules,node_groups_feature,node_controller toneMint
class node_ota,node_ota_topics,node_ota_mqtt,node_ota_https toneRose
class node_thread_br,node_developer,node_clients,node_cloud,node_claim toneIndigo
```

## Components

### Device model

- [Node, devices, parameters](https://github.com/espressif/esp-rainmaker/blob/master/components/esp_rainmaker/src/core/esp_rmaker_node.c): `components/esp_rainmaker/src/core/esp_rmaker_node.c`
- [Standard device types](https://github.com/espressif/esp-rainmaker/blob/master/components/esp_rainmaker/src/standard_types/esp_rmaker_standard_devices.c): `components/esp_rainmaker/src/standard_types/esp_rmaker_standard_devices.c`
- [Standard parameters](https://github.com/espressif/esp-rainmaker/blob/master/components/esp_rainmaker/src/standard_types/esp_rmaker_standard_params.c): `components/esp_rainmaker/src/standard_types/esp_rmaker_standard_params.c`
- [Standard services](https://github.com/espressif/esp-rainmaker/blob/master/components/esp_rainmaker/src/standard_types/esp_rmaker_standard_services.c): `components/esp_rainmaker/src/standard_types/esp_rmaker_standard_services.c`

### Connectivity and identity

- [MQTT transport](https://github.com/espressif/esp-rainmaker/blob/master/components/esp_rainmaker/src/mqtt/esp_rmaker_mqtt.c): `components/esp_rainmaker/src/mqtt/esp_rmaker_mqtt.c`
- [Client credentials](https://github.com/espressif/esp-rainmaker/blob/master/components/esp_rainmaker/src/core/esp_rmaker_client_data.c): `components/esp_rainmaker/src/core/esp_rmaker_client_data.c`
- [Node authentication](https://github.com/espressif/esp-rainmaker/blob/master/components/esp_rainmaker/src/core/esp_rmaker_node_auth.c): `components/esp_rainmaker/src/core/esp_rmaker_node_auth.c`
- [Authentication service](https://github.com/espressif/esp-rainmaker/blob/master/components/esp_rainmaker/src/core/esp_rmaker_auth_service.c): `components/esp_rainmaker/src/core/esp_rmaker_auth_service.c`
- [Command responses](https://github.com/espressif/esp-rainmaker/blob/master/components/esp_rainmaker/src/core/esp_rmaker_cmd_resp_manager.c): `components/esp_rainmaker/src/core/esp_rmaker_cmd_resp_manager.c`
- [Device console](https://github.com/espressif/esp-rainmaker/blob/master/components/esp_rainmaker/src/console/esp_rmaker_commands.c): `components/esp_rainmaker/src/console/esp_rmaker_commands.c`

### Control capabilities

- [Local control](https://github.com/espressif/esp-rainmaker/blob/master/components/esp_rainmaker/src/core/esp_rmaker_local_ctrl.c): `components/esp_rainmaker/src/core/esp_rmaker_local_ctrl.c`
- [Scenes](https://github.com/espressif/esp-rainmaker/blob/master/components/esp_rainmaker/src/core/esp_rmaker_scenes.c): `components/esp_rainmaker/src/core/esp_rmaker_scenes.c`
- [Schedules](https://github.com/espressif/esp-rainmaker/blob/master/components/esp_rainmaker/src/core/esp_rmaker_schedule.c): `components/esp_rainmaker/src/core/esp_rmaker_schedule.c`
- [Device groups](https://github.com/espressif/esp-rainmaker/blob/master/components/esp_rainmaker/src/core/esp_rmaker_groups.c): `components/esp_rainmaker/src/core/esp_rmaker_groups.c`
- [RainMaker controller](https://github.com/espressif/esp-rainmaker/blob/master/components/esp_rainmaker/src/rainmaker_controller/esp_rmaker_controller.c): `components/esp_rainmaker/src/rainmaker_controller/esp_rmaker_controller.c`

### Firmware updates

- [OTA workflow](https://github.com/espressif/esp-rainmaker/blob/master/components/esp_rainmaker/src/ota/esp_rmaker_ota.c): `components/esp_rainmaker/src/ota/esp_rmaker_ota.c`
- [Topic-based OTA](https://github.com/espressif/esp-rainmaker/blob/master/components/esp_rainmaker/src/ota/esp_rmaker_ota_using_topics.c): `components/esp_rainmaker/src/ota/esp_rmaker_ota_using_topics.c`
- [MQTT image transfer](https://github.com/espressif/esp-rainmaker/blob/master/components/esp_rainmaker/src/ota/esp_rmaker_mqtt_ota.c): `components/esp_rainmaker/src/ota/esp_rmaker_mqtt_ota.c`
- [HTTPS image transfer](https://github.com/espressif/esp-rainmaker/blob/master/components/esp_rainmaker/src/ota/esp_rmaker_https_ota.c): `components/esp_rainmaker/src/ota/esp_rmaker_https_ota.c`

### Platform integrations

- [Thread border router](https://github.com/espressif/esp-rainmaker/blob/master/components/esp_rainmaker/src/thread_br/esp_rmaker_thread_br.c): `components/esp_rainmaker/src/thread_br/esp_rmaker_thread_br.c`

### Other components

- **Firmware developer**
- **Phone app / CLI**
- **RainMaker Cloud**
- **Claiming Service**

## Connections

- Firmware developer → Node, devices, parameters: defines devices
- Node, devices, parameters → Standard device types: can use
- Node, devices, parameters → Standard parameters: can use
- Node, devices, parameters → Standard services: can use
- Claiming Service → Client credentials: provides credentials
- Client credentials → Node authentication: supplies identity data
- Node authentication → MQTT transport: uses connection data
- MQTT transport → RainMaker Cloud: connects device
- Phone app / CLI → RainMaker Cloud: remote access
- RainMaker Cloud → MQTT transport: remote connectivity
- Command responses → MQTT transport: publishes response (evidence: `components/esp_rainmaker/src/core/esp_rmaker_cmd_resp_manager.c`)
- Device console → Node, devices, parameters: sets parameters (evidence: `components/esp_rainmaker/src/console/esp_rmaker_commands.c`)
- OTA workflow → Topic-based OTA: configures protocol (evidence: `components/esp_rainmaker/src/ota/esp_rmaker_ota.c`)
- OTA workflow → HTTPS image transfer: selects transfer (evidence: `components/esp_rainmaker/src/ota/esp_rmaker_ota.c`)
- OTA workflow → MQTT image transfer: selects transfer (evidence: `components/esp_rainmaker/src/ota/esp_rmaker_ota.c`)
- Topic-based OTA → MQTT transport: publishes status (evidence: `components/esp_rainmaker/src/ota/esp_rmaker_ota_using_topics.c`)
- MQTT image transfer → OTA workflow: writes image blocks
- Thread border router → Node, devices, parameters: exposes service
