# espressif/esp-now architecture

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

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

## Overview

ESP-NOW is an embedded wireless component for one-to-many and many-to-many device communication, control, configuration, firmware upgrades, and debugging. A typical workflow starts with devices communicating over ESP-NOW, then uses domain services such as provisioning, control, security, or OTA to deliver a result. The graph preserves these documented capabilities and the principal implementation areas. Some links between services and transport are dashed: the excerpts and source index show references, but do not establish the exact runtime calls.

Main entry points: [`src/espnow/include/espnow.h`](https://github.com/espressif/esp-now/blob/master/src/espnow/include/espnow.h) (Transport API), [`src/debug/src/commands/cmd_espnow.c`](https://github.com/espressif/esp-now/blob/master/src/debug/src/commands/cmd_espnow.c) (Wireless debug commands), [`src/control/src/espnow_ctrl.c`](https://github.com/espressif/esp-now/blob/master/src/control/src/espnow_ctrl.c) (Device control), [`src/time/src/espnow_time.c`](https://github.com/espressif/esp-now/blob/master/src/time/src/espnow_time.c) (Time synchronization)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_transport["Wireless transport"]
  node_transport_api["Transport API<br/>[espnow.h]"]
  node_transport_runtime["Transport runtime<br/>[espnow.c]"]
  node_groups["Device groups<br/>[espnow_group.c]"]
end

subgraph group_domains["Device services"]
  node_control["Device control<br/>[espnow_ctrl.c]"]
  node_provisioning["Wi-Fi provisioning<br/>[espnow_prov.c]"]
  node_security["Security services<br/>[espnow_security.c]"]
  node_security_initiator["Security initiator"]
  node_security_responder["Security responder"]
  node_security_client["Protocomm client security<br/>[client_security1.c]"]
  node_ota_initiator["OTA initiator"]
  node_ota_responder["OTA responder"]
end

subgraph group_debug["Debugging"]
  node_commands["Wireless debug commands<br/>[cmd_espnow.c]"]
  node_iperf["Throughput testing<br/>[cmd_iperf.c]"]
  node_console["Debug console<br/>[espnow_console.c]"]
  node_logging["Wireless logging<br/>[espnow_log.c]"]
  node_flash_logs["Flash log storage<br/>[espnow_log_flash.c]"]
  node_sdcard["SD-card support<br/>[sdcard.c]"]
  node_pcap["Packet capture<br/>[pcap.c]"]
end

subgraph group_foundation["Utilities and time"]
  node_time["Time synchronization<br/>[espnow_time.c]"]
  node_timesync["SNTP helpers<br/>[espnow_timesync.c]"]
  node_storage[("Persistent storage<br/>[espnow_storage.c]")]
  node_memory["Memory utilities<br/>[espnow_mem.c]"]
  node_utils["System utilities<br/>[espnow_utils.c]"]
end

node_devices(("ESP-NOW devices"))

node_devices -->|"communicate over"| node_transport_api
node_transport_runtime -.->|"implements"| node_transport_api
node_groups -.->|"uses"| node_transport_api
node_control -.->|"uses"| node_transport_api
node_provisioning -.->|"uses"| node_transport_api
node_security -.->|"uses"| node_transport_api
node_security_initiator -.->|"uses"| node_transport_api
node_security_responder -.->|"uses"| node_transport_api
node_security_client -.->|"supports"| node_security
node_ota_initiator -.->|"uses"| node_transport_api
node_ota_responder -.->|"uses"| node_transport_api
node_time -.->|"uses"| node_transport_api
node_time -.->|"uses"| node_timesync
node_control -.->|"uses"| node_storage
node_commands -->|"sends control"| node_control
node_commands -.->|"starts provisioning"| node_provisioning
node_commands -.->|"supports upgrades"| node_ota_initiator
node_commands -.->|"supports security"| node_security_initiator
node_commands -.->|"uses"| node_transport_api
node_iperf -.->|"uses"| node_transport_api
node_console -.->|"uses"| node_transport_api
node_logging -.->|"uses"| node_transport_api
node_flash_logs -.->|"uses"| node_storage
node_sdcard -.->|"uses"| node_utils
node_pcap -.->|"uses"| node_utils

click node_transport_api "https://github.com/espressif/esp-now/blob/master/src/espnow/include/espnow.h"
click node_transport_runtime "https://github.com/espressif/esp-now/blob/master/src/espnow/src/espnow.c"
click node_groups "https://github.com/espressif/esp-now/blob/master/src/espnow/src/espnow_group.c"
click node_control "https://github.com/espressif/esp-now/blob/master/src/control/src/espnow_ctrl.c"
click node_provisioning "https://github.com/espressif/esp-now/blob/master/src/provisioning/src/espnow_prov.c"
click node_security "https://github.com/espressif/esp-now/blob/master/src/security/src/espnow_security.c"
click node_security_initiator "https://github.com/espressif/esp-now/blob/master/src/security/src/espnow_security_initiator.c"
click node_security_responder "https://github.com/espressif/esp-now/blob/master/src/security/src/espnow_security_responder.c"
click node_security_client "https://github.com/espressif/esp-now/blob/master/src/security/src/protocomm/security/client_security1.c"
click node_ota_initiator "https://github.com/espressif/esp-now/blob/master/src/ota/espnow_ota_initiator.c"
click node_ota_responder "https://github.com/espressif/esp-now/blob/master/src/ota/espnow_ota_responder.c"
click node_time "https://github.com/espressif/esp-now/blob/master/src/time/src/espnow_time.c"
click node_timesync "https://github.com/espressif/esp-now/blob/master/src/utils/src/espnow_timesync.c"
click node_storage "https://github.com/espressif/esp-now/blob/master/src/utils/src/espnow_storage.c"
click node_memory "https://github.com/espressif/esp-now/blob/master/src/utils/src/espnow_mem.c"
click node_utils "https://github.com/espressif/esp-now/blob/master/src/utils/src/espnow_utils.c"
click node_commands "https://github.com/espressif/esp-now/blob/master/src/debug/src/commands/cmd_espnow.c"
click node_iperf "https://github.com/espressif/esp-now/blob/master/src/debug/src/commands/cmd_iperf.c"
click node_console "https://github.com/espressif/esp-now/blob/master/src/debug/src/espnow_console.c"
click node_logging "https://github.com/espressif/esp-now/blob/master/src/debug/src/espnow_log.c"
click node_flash_logs "https://github.com/espressif/esp-now/blob/master/src/debug/src/espnow_log_flash.c"
click node_sdcard "https://github.com/espressif/esp-now/blob/master/src/debug/src/sdcard/sdcard.c"
click node_pcap "https://github.com/espressif/esp-now/blob/master/src/debug/src/commands/pcap/pcap.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_transport_api,node_transport_runtime,node_groups toneBlue
class node_control,node_provisioning,node_security,node_security_initiator,node_security_responder,node_security_client,node_ota_initiator,node_ota_responder toneAmber
class node_commands,node_iperf,node_console,node_logging,node_flash_logs,node_sdcard,node_pcap toneMint
class node_time,node_timesync,node_storage,node_memory,node_utils toneRose
class node_devices toneIndigo
```

## Components

### Wireless transport

- [Transport API](https://github.com/espressif/esp-now/blob/master/src/espnow/include/espnow.h): `src/espnow/include/espnow.h`
- [Transport runtime](https://github.com/espressif/esp-now/blob/master/src/espnow/src/espnow.c): `src/espnow/src/espnow.c`
- [Device groups](https://github.com/espressif/esp-now/blob/master/src/espnow/src/espnow_group.c): `src/espnow/src/espnow_group.c`

### Device services

- [Device control](https://github.com/espressif/esp-now/blob/master/src/control/src/espnow_ctrl.c): `src/control/src/espnow_ctrl.c`
- [Wi-Fi provisioning](https://github.com/espressif/esp-now/blob/master/src/provisioning/src/espnow_prov.c): `src/provisioning/src/espnow_prov.c`
- [Security services](https://github.com/espressif/esp-now/blob/master/src/security/src/espnow_security.c): `src/security/src/espnow_security.c`
- [Security initiator](https://github.com/espressif/esp-now/blob/master/src/security/src/espnow_security_initiator.c): `src/security/src/espnow_security_initiator.c`
- [Security responder](https://github.com/espressif/esp-now/blob/master/src/security/src/espnow_security_responder.c): `src/security/src/espnow_security_responder.c`
- [Protocomm client security](https://github.com/espressif/esp-now/blob/master/src/security/src/protocomm/security/client_security1.c): `src/security/src/protocomm/security/client_security1.c`
- [OTA initiator](https://github.com/espressif/esp-now/blob/master/src/ota/espnow_ota_initiator.c): `src/ota/espnow_ota_initiator.c`
- [OTA responder](https://github.com/espressif/esp-now/blob/master/src/ota/espnow_ota_responder.c): `src/ota/espnow_ota_responder.c`

### Debugging

- [Wireless debug commands](https://github.com/espressif/esp-now/blob/master/src/debug/src/commands/cmd_espnow.c): `src/debug/src/commands/cmd_espnow.c`
- [Throughput testing](https://github.com/espressif/esp-now/blob/master/src/debug/src/commands/cmd_iperf.c): `src/debug/src/commands/cmd_iperf.c`
- [Debug console](https://github.com/espressif/esp-now/blob/master/src/debug/src/espnow_console.c): `src/debug/src/espnow_console.c`
- [Wireless logging](https://github.com/espressif/esp-now/blob/master/src/debug/src/espnow_log.c): `src/debug/src/espnow_log.c`
- [Flash log storage](https://github.com/espressif/esp-now/blob/master/src/debug/src/espnow_log_flash.c): `src/debug/src/espnow_log_flash.c`
- [SD-card support](https://github.com/espressif/esp-now/blob/master/src/debug/src/sdcard/sdcard.c): `src/debug/src/sdcard/sdcard.c`
- [Packet capture](https://github.com/espressif/esp-now/blob/master/src/debug/src/commands/pcap/pcap.c): `src/debug/src/commands/pcap/pcap.c`

### Utilities and time

- [Time synchronization](https://github.com/espressif/esp-now/blob/master/src/time/src/espnow_time.c): `src/time/src/espnow_time.c`
- [SNTP helpers](https://github.com/espressif/esp-now/blob/master/src/utils/src/espnow_timesync.c): `src/utils/src/espnow_timesync.c`
- [Persistent storage](https://github.com/espressif/esp-now/blob/master/src/utils/src/espnow_storage.c): `src/utils/src/espnow_storage.c`
- [Memory utilities](https://github.com/espressif/esp-now/blob/master/src/utils/src/espnow_mem.c): `src/utils/src/espnow_mem.c`
- [System utilities](https://github.com/espressif/esp-now/blob/master/src/utils/src/espnow_utils.c): `src/utils/src/espnow_utils.c`

### Other components

- **ESP-NOW devices**

## Connections

- ESP-NOW devices → Transport API: communicate over
- Transport runtime → Transport API: implements (evidence: `src/espnow/src/espnow.c`)
- Device groups → Transport API: uses (evidence: `src/espnow/src/espnow_group.c`)
- Device control → Transport API: uses (evidence: `src/control/src/espnow_ctrl.c`)
- Wi-Fi provisioning → Transport API: uses (evidence: `src/provisioning/src/espnow_prov.c`)
- Security services → Transport API: uses (evidence: `src/security/src/espnow_security.c`)
- Security initiator → Transport API: uses (evidence: `src/security/src/espnow_security_initiator.c`)
- Security responder → Transport API: uses (evidence: `src/security/src/espnow_security_responder.c`)
- Protocomm client security → Security services: supports
- OTA initiator → Transport API: uses (evidence: `src/ota/espnow_ota_initiator.c`)
- OTA responder → Transport API: uses (evidence: `src/ota/espnow_ota_responder.c`)
- Time synchronization → Transport API: uses (evidence: `src/time/src/espnow_time.c`)
- Time synchronization → SNTP helpers: uses
- Device control → Persistent storage: uses
- Wireless debug commands → Device control: sends control (evidence: `src/debug/src/commands/cmd_espnow.c`)
- Wireless debug commands → Wi-Fi provisioning: starts provisioning
- Wireless debug commands → OTA initiator: supports upgrades
- Wireless debug commands → Security initiator: supports security
- Wireless debug commands → Transport API: uses (evidence: `src/debug/src/commands/cmd_espnow.c`)
- Throughput testing → Transport API: uses (evidence: `src/debug/src/commands/cmd_iperf.c`)
- Debug console → Transport API: uses (evidence: `src/debug/src/espnow_console.c`)
- Wireless logging → Transport API: uses (evidence: `src/debug/src/espnow_log.c`)
- Flash log storage → Persistent storage: uses
- SD-card support → System utilities: uses
- Packet capture → System utilities: uses
