# rosugabriel/nodemcuproxy architecture

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

- Interactive diagram: https://gitdiagram.com/rosugabriel/nodemcuproxy
- Repository: https://github.com/rosugabriel/nodemcuproxy

## Overview

This is a small ESP8266-based proxy for managing another server. After joining Wi-Fi, its HTTP server serves a status page and handles wake and shutdown requests: status is checked with ping, wake sends a UDP magic packet, and shutdown posts to the server’s configured HTTP endpoint. The source excerpt shows these handlers and their direct calls; the README documents the intended integrations. Secrets are referenced by the source, but the repository only contains an example secrets header, so configuration details are not expanded.

Main entry points: [`src/main.cpp`](https://github.com/rosugabriel/nodemcuproxy/blob/main/src/main.cpp) (HTTP control server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_device["ESP8266 controller"]
  node_firmware["Controller firmware<br/>[main.cpp]"]
  node_web["HTTP control server<br/>[main.cpp]"]
  node_page["Status page<br/>[main.cpp]"]
end

subgraph group_management["Server management"]
  node_status["Server reachability<br/>[main.cpp]"]
  node_wake["Wake handler<br/>[main.cpp]"]
  node_packet["Magic packet<br/>[main.cpp]"]
  node_shutdown["Shutdown handler<br/>[main.cpp]"]
  node_httpclient["HTTP shutdown client<br/>[main.cpp]"]
end

node_operator(("Browser user"))
node_wifi{{"Wi-Fi network"}}
node_udp{{"UDP broadcast"}}
node_target{{"Managed server"}}

node_firmware -->|"connects"| node_wifi
node_firmware -->|"starts"| node_web
node_operator -->|"requests"| node_web
node_web -->|"routes status"| node_status
node_web -->|"routes wake"| node_wake
node_web -->|"routes shutdown"| node_shutdown
node_status -->|"pings"| node_target
node_status -->|"renders"| node_page
node_wake -->|"responds with"| node_page
node_wake -->|"creates"| node_packet
node_packet -->|"broadcasts"| node_udp
node_udp -->|"sends wake packet"| node_target
node_shutdown -->|"responds with"| node_page
node_shutdown -->|"posts through"| node_httpclient
node_httpclient -->|"posts shutdown"| node_target

click node_firmware "https://github.com/rosugabriel/nodemcuproxy/blob/main/src/main.cpp"
click node_web "https://github.com/rosugabriel/nodemcuproxy/blob/main/src/main.cpp"
click node_page "https://github.com/rosugabriel/nodemcuproxy/blob/main/src/main.cpp"
click node_status "https://github.com/rosugabriel/nodemcuproxy/blob/main/src/main.cpp"
click node_wake "https://github.com/rosugabriel/nodemcuproxy/blob/main/src/main.cpp"
click node_packet "https://github.com/rosugabriel/nodemcuproxy/blob/main/src/main.cpp"
click node_shutdown "https://github.com/rosugabriel/nodemcuproxy/blob/main/src/main.cpp"
click node_httpclient "https://github.com/rosugabriel/nodemcuproxy/blob/main/src/main.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_firmware,node_web,node_page,node_operator toneBlue
class node_status,node_wake,node_packet,node_shutdown,node_httpclient toneAmber
class node_wifi,node_udp toneIndigo
class node_target toneMint
```

## Components

### ESP8266 controller

- [Controller firmware](https://github.com/rosugabriel/nodemcuproxy/blob/main/src/main.cpp): `src/main.cpp`
- [HTTP control server](https://github.com/rosugabriel/nodemcuproxy/blob/main/src/main.cpp): `src/main.cpp`
- [Status page](https://github.com/rosugabriel/nodemcuproxy/blob/main/src/main.cpp): `src/main.cpp`

### Server management

- [Server reachability](https://github.com/rosugabriel/nodemcuproxy/blob/main/src/main.cpp): `src/main.cpp`
- [Wake handler](https://github.com/rosugabriel/nodemcuproxy/blob/main/src/main.cpp): `src/main.cpp`
- [Magic packet](https://github.com/rosugabriel/nodemcuproxy/blob/main/src/main.cpp): `src/main.cpp`
- [Shutdown handler](https://github.com/rosugabriel/nodemcuproxy/blob/main/src/main.cpp): `src/main.cpp`
- [HTTP shutdown client](https://github.com/rosugabriel/nodemcuproxy/blob/main/src/main.cpp): `src/main.cpp`

### Other components

- **Browser user**
- **Wi-Fi network**
- **UDP broadcast**
- **Managed server**

## Connections

- Controller firmware → Wi-Fi network: connects (evidence: `src/main.cpp`)
- Controller firmware → HTTP control server: starts (evidence: `src/main.cpp`)
- Browser user → HTTP control server: requests (evidence: `src/main.cpp`)
- HTTP control server → Server reachability: routes status (evidence: `src/main.cpp`)
- HTTP control server → Wake handler: routes wake (evidence: `src/main.cpp`)
- HTTP control server → Shutdown handler: routes shutdown (evidence: `src/main.cpp`)
- Server reachability → Managed server: pings (evidence: `src/main.cpp`)
- Server reachability → Status page: renders (evidence: `src/main.cpp`)
- Wake handler → Status page: responds with (evidence: `src/main.cpp`)
- Wake handler → Magic packet: creates (evidence: `src/main.cpp`)
- Magic packet → UDP broadcast: broadcasts (evidence: `src/main.cpp`)
- UDP broadcast → Managed server: sends wake packet
- Shutdown handler → Status page: responds with (evidence: `src/main.cpp`)
- Shutdown handler → HTTP shutdown client: posts through (evidence: `src/main.cpp`)
- HTTP shutdown client → Managed server: posts shutdown (evidence: `src/main.cpp`)
