# meshtastic/firmware architecture

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

- Interactive diagram: https://gitdiagram.com/meshtastic/firmware
- Repository: https://github.com/meshtastic/firmware

## Overview

Meshtastic is embedded firmware for decentralized LoRa messaging, location sharing, and telemetry across several hardware platforms. At boot, firmware setup initializes platform services and starts mesh, radio, GPS, input, and display components. Mesh packets are routed over radio; node state and application modules support messaging and other features, while device UI and phone-facing APIs provide user access. The source index supports the cited dependencies; several domain capabilities are documented in the README but their internal wiring was not sampled.

Main entry points: [`src/main.cpp`](https://github.com/meshtastic/firmware/blob/develop/src/main.cpp) (Boot and setup), [`src/mesh/MeshService.h`](https://github.com/meshtastic/firmware/blob/develop/src/mesh/MeshService.h) (Mesh service), [`src/graphics/Screen.h`](https://github.com/meshtastic/firmware/blob/develop/src/graphics/Screen.h) (Device screen), [`src/mesh/NodeDB.cpp`](https://github.com/meshtastic/firmware/blob/develop/src/mesh/NodeDB.cpp) (Node database)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_boot["Firmware runtime"]
  node_setup["Boot and setup<br/>[main.cpp]"]
  node_platform["Platform config<br/>[configuration.h]"]
  node_threads["Thread scheduler<br/>[OSThread.h]"]
  node_encrypted_storage[("Encrypted storage")]
end

subgraph group_mesh["Mesh networking"]
  node_mesh_service["Mesh service<br/>[MeshService.h]"]
  node_router["Routing<br/>[Router.h]"]
  node_routing_module["Routing module<br/>[RoutingModule.cpp]"]
  node_radio["Radio interfaces"]
  node_crypto["Packet cryptography<br/>[CryptoEngine.cpp]"]
  node_nodes[("Node database<br/>[NodeDB.cpp]")]
end

subgraph group_features["Device capabilities"]
  node_modules["Feature modules<br/>[Modules.cpp]"]
  node_gps["GPS and position<br/>[GPS.cpp]"]
  node_power["Power management<br/>[Power.cpp]"]
end

subgraph group_access["User interfaces"]
  node_input["Input devices<br/>[InputBroker.cpp]"]
  node_screen["Device screen<br/>[Screen.h]"]
  node_menu["Screen menus<br/>[MenuHandler.cpp]"]
  node_inkhud["InkHUD windows<br/>[WindowManager.cpp]"]
  node_phone["Phone API<br/>[PhoneAPI.cpp]"]
end

node_user(("Device user"))
node_phone_user(("Phone app"))

node_user -->|"provides input"| node_input
node_setup -->|"configures"| node_platform
node_setup -->|"starts scheduler"| node_threads
node_setup -->|"initializes"| node_mesh_service
node_setup -->|"initializes"| node_radio
node_setup -->|"initializes"| node_nodes
node_setup -->|"initializes"| node_gps
node_setup -->|"starts"| node_input
node_setup -->|"starts"| node_screen
node_setup -->|"initializes"| node_power
node_setup -->|"initializes"| node_encrypted_storage
node_mesh_service -->|"uses radio"| node_radio
node_routing_module -->|"uses service"| node_mesh_service
node_routing_module -->|"uses node state"| node_nodes
node_routing_module -->|"uses router"| node_router
node_mesh_service -.->|"uses cryptography"| node_crypto
node_mesh_service -->|"uses node state"| node_nodes
node_modules -.->|"registers features"| node_mesh_service
node_screen -->|"observes updates"| node_nodes
node_screen -->|"observes status"| node_power
node_screen -->|"observes status"| node_gps
node_menu -->|"updates display"| node_screen
node_menu -->|"reads node data"| node_nodes
node_inkhud -->|"requests render"| node_screen
node_user -->|"views status"| node_screen
node_phone_user -->|"exchanges data"| node_phone
node_phone -.->|"accesses mesh"| node_mesh_service
node_mesh_service -.->|"routes packets"| node_router
node_mesh_service -->|"delivers messages"| node_user

click node_setup "https://github.com/meshtastic/firmware/blob/develop/src/main.cpp"
click node_platform "https://github.com/meshtastic/firmware/blob/develop/src/configuration.h"
click node_threads "https://github.com/meshtastic/firmware/blob/develop/src/concurrency/OSThread.h"
click node_mesh_service "https://github.com/meshtastic/firmware/blob/develop/src/mesh/MeshService.h"
click node_router "https://github.com/meshtastic/firmware/blob/develop/src/mesh/Router.h"
click node_routing_module "https://github.com/meshtastic/firmware/blob/develop/src/modules/RoutingModule.cpp"
click node_radio "https://github.com/meshtastic/firmware/blob/develop/src/mesh/RadioLibInterface.cpp"
click node_crypto "https://github.com/meshtastic/firmware/blob/develop/src/mesh/CryptoEngine.cpp"
click node_nodes "https://github.com/meshtastic/firmware/blob/develop/src/mesh/NodeDB.cpp"
click node_modules "https://github.com/meshtastic/firmware/blob/develop/src/modules/Modules.cpp"
click node_gps "https://github.com/meshtastic/firmware/blob/develop/src/gps/GPS.cpp"
click node_power "https://github.com/meshtastic/firmware/blob/develop/src/Power.cpp"
click node_input "https://github.com/meshtastic/firmware/blob/develop/src/input/InputBroker.cpp"
click node_screen "https://github.com/meshtastic/firmware/blob/develop/src/graphics/Screen.h"
click node_menu "https://github.com/meshtastic/firmware/blob/develop/src/graphics/draw/MenuHandler.cpp"
click node_inkhud "https://github.com/meshtastic/firmware/blob/develop/src/graphics/niche/InkHUD/WindowManager.cpp"
click node_phone "https://github.com/meshtastic/firmware/blob/develop/src/mesh/PhoneAPI.cpp"
click node_encrypted_storage "https://github.com/meshtastic/firmware/blob/develop/src/security/EncryptedStorage.cpp"

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_setup,node_platform,node_threads,node_encrypted_storage,node_user toneBlue
class node_mesh_service,node_router,node_routing_module,node_radio,node_crypto,node_nodes toneAmber
class node_modules,node_gps,node_power toneMint
class node_input,node_screen,node_menu,node_inkhud,node_phone toneRose
class node_phone_user toneIndigo
```

## Components

### Firmware runtime

- [Boot and setup](https://github.com/meshtastic/firmware/blob/develop/src/main.cpp): `src/main.cpp`
- [Platform config](https://github.com/meshtastic/firmware/blob/develop/src/configuration.h): `src/configuration.h`
- [Thread scheduler](https://github.com/meshtastic/firmware/blob/develop/src/concurrency/OSThread.h): `src/concurrency/OSThread.h`
- [Encrypted storage](https://github.com/meshtastic/firmware/blob/develop/src/security/EncryptedStorage.cpp): `src/security/EncryptedStorage.cpp`

### Mesh networking

- [Mesh service](https://github.com/meshtastic/firmware/blob/develop/src/mesh/MeshService.h): `src/mesh/MeshService.h`
- [Routing](https://github.com/meshtastic/firmware/blob/develop/src/mesh/Router.h): `src/mesh/Router.h`
- [Routing module](https://github.com/meshtastic/firmware/blob/develop/src/modules/RoutingModule.cpp): `src/modules/RoutingModule.cpp`
- [Radio interfaces](https://github.com/meshtastic/firmware/blob/develop/src/mesh/RadioLibInterface.cpp): `src/mesh/RadioLibInterface.cpp`
- [Packet cryptography](https://github.com/meshtastic/firmware/blob/develop/src/mesh/CryptoEngine.cpp): `src/mesh/CryptoEngine.cpp`
- [Node database](https://github.com/meshtastic/firmware/blob/develop/src/mesh/NodeDB.cpp): `src/mesh/NodeDB.cpp`

### Device capabilities

- [Feature modules](https://github.com/meshtastic/firmware/blob/develop/src/modules/Modules.cpp): `src/modules/Modules.cpp`
- [GPS and position](https://github.com/meshtastic/firmware/blob/develop/src/gps/GPS.cpp): `src/gps/GPS.cpp`
- [Power management](https://github.com/meshtastic/firmware/blob/develop/src/Power.cpp): `src/Power.cpp`

### User interfaces

- [Input devices](https://github.com/meshtastic/firmware/blob/develop/src/input/InputBroker.cpp): `src/input/InputBroker.cpp`
- [Device screen](https://github.com/meshtastic/firmware/blob/develop/src/graphics/Screen.h): `src/graphics/Screen.h`
- [Screen menus](https://github.com/meshtastic/firmware/blob/develop/src/graphics/draw/MenuHandler.cpp): `src/graphics/draw/MenuHandler.cpp`
- [InkHUD windows](https://github.com/meshtastic/firmware/blob/develop/src/graphics/niche/InkHUD/WindowManager.cpp): `src/graphics/niche/InkHUD/WindowManager.cpp`
- [Phone API](https://github.com/meshtastic/firmware/blob/develop/src/mesh/PhoneAPI.cpp): `src/mesh/PhoneAPI.cpp`

### Other components

- **Device user**
- **Phone app**

## Connections

- Device user → Input devices: provides input
- Boot and setup → Platform config: configures (evidence: `src/configuration.h`)
- Boot and setup → Thread scheduler: starts scheduler (evidence: `src/main.cpp`)
- Boot and setup → Mesh service: initializes (evidence: `src/main.cpp`)
- Boot and setup → Radio interfaces: initializes (evidence: `src/main.cpp`)
- Boot and setup → Node database: initializes (evidence: `src/main.cpp`)
- Boot and setup → GPS and position: initializes (evidence: `src/main.cpp`)
- Boot and setup → Input devices: starts (evidence: `src/main.cpp`)
- Boot and setup → Device screen: starts (evidence: `src/main.cpp`)
- Boot and setup → Power management: initializes (evidence: `src/main.cpp`)
- Boot and setup → Encrypted storage: initializes (evidence: `src/main.cpp`)
- Mesh service → Radio interfaces: uses radio (evidence: `src/mesh/MeshService.h`)
- Routing module → Mesh service: uses service (evidence: `src/modules/RoutingModule.cpp`)
- Routing module → Node database: uses node state (evidence: `src/modules/RoutingModule.cpp`)
- Routing module → Routing: uses router (evidence: `src/modules/RoutingModule.cpp`)
- Mesh service → Packet cryptography: uses cryptography
- Mesh service → Node database: uses node state (evidence: `src/mesh/MeshService.h`)
- Feature modules → Mesh service: registers features
- Device screen → Node database: observes updates (evidence: `src/graphics/Screen.h`)
- Device screen → Power management: observes status (evidence: `src/graphics/Screen.h`)
- Device screen → GPS and position: observes status (evidence: `src/graphics/Screen.h`)
- Screen menus → Device screen: updates display (evidence: `src/graphics/draw/MenuHandler.cpp`)
- Screen menus → Node database: reads node data (evidence: `src/graphics/draw/MenuHandler.cpp`)
- InkHUD windows → Device screen: requests render (evidence: `src/graphics/niche/InkHUD/WindowManager.cpp`)
- Device user → Device screen: views status (evidence: `README.md`)
- Phone app → Phone API: exchanges data (evidence: `README.md`)
- Phone API → Mesh service: accesses mesh
- Mesh service → Routing: routes packets
- Mesh service → Device user: delivers messages (evidence: `README.md`)
