# tinny-robot/esp32oledstudio architecture

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

- Interactive diagram: https://gitdiagram.com/tinny-robot/esp32oledstudio
- Repository: https://github.com/tinny-robot/esp32oledstudio

## Overview

ESP32OLEDStudio is an Arduino library for controlling an SH1106 OLED locally, through either a simple sketch API or a browser UI served by the ESP32 access point. The main path is browser interaction → local HTTP handlers → display state → OLED rendering; sketches can also draw directly through the facade. The README documents dashboard, text, image-processing/upload, settings, and display modes. Source excerpts show the facade, display wrapper, and server handlers; some UI and route wiring is documented but not fully sampled.

Main entry points: [`data/app.js`](https://github.com/tinny-robot/esp32oledstudio/blob/main/data/app.js) (UI and API client), [`src/WebServerManager.cpp`](https://github.com/tinny-robot/esp32oledstudio/blob/main/src/WebServerManager.cpp) (AP and HTTP handlers), [`src/ESP32OLEDStudio.cpp`](https://github.com/tinny-robot/esp32oledstudio/blob/main/src/ESP32OLEDStudio.cpp) (Studio facade), [`src/OLEDDisplay.cpp`](https://github.com/tinny-robot/esp32oledstudio/blob/main/src/OLEDDisplay.cpp) (Display wrapper)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Arduino API"]
  node_facade["Studio facade"]
  node_facade_header["Facade API<br/>[ESP32OLEDStudio.h]"]
end

subgraph group_display["OLED Rendering"]
  node_display["Display wrapper<br/>[OLEDDisplay.cpp]"]
  node_display_header["Display modes and state<br/>[OLEDDisplay.h]"]
end

subgraph group_server["Local Web Server"]
  node_webmanager["AP and HTTP handlers"]
  node_webheader["Server API contract<br/>[WebServerManager.h]"]
  node_webcontent["Embedded UI assets<br/>[WebContent.h]"]
end

subgraph group_browser["Browser Interface"]
  node_browserui["Dashboard and controls<br/>[index.html]"]
  node_browserlogic["UI and API client<br/>[app.js]"]
  node_imageprocessing["Image processing<br/>[app.js]"]
  node_styles["Interface styling<br/>[style.css]"]
  node_dashboard["Status dashboard<br/>[app.js]"]
  node_textcontrol["Text and font controls<br/>[app.js]"]
  node_settings["Settings controls<br/>[app.js]"]
end

node_sketch(("Arduino sketch"))
node_u8g2["U8g2 driver"]
node_oled["SH1106 OLED"]
node_client(("Phone or laptop"))

node_sketch -->|"calls"| node_facade
node_facade -->|"initializes and delegates"| node_display
node_facade -->|"starts and services"| node_webmanager
node_facade -->|"implements API"| node_facade_header
node_display -->|"implements state API"| node_display_header
node_display -->|"draws through"| node_u8g2
node_u8g2 -->|"updates"| node_oled
node_webmanager -->|"implements handlers"| node_webheader
node_webmanager -->|"updates display state"| node_display
node_webmanager -->|"serves embedded assets"| node_webcontent
node_client -->|"uses"| node_browserui
node_browserui -->|"loads script"| node_browserlogic
node_browserui -->|"loads stylesheet"| node_styles
node_browserlogic -->|"sends HTTP requests"| node_webmanager
node_browserlogic -->|"refreshes"| node_dashboard
node_browserlogic -->|"initializes controls"| node_textcontrol
node_browserlogic -->|"initializes controls"| node_settings
node_browserlogic -->|"processes selected image"| node_imageprocessing
node_imageprocessing -->|"uploads bitmap"| node_webmanager

click node_facade "https://github.com/tinny-robot/esp32oledstudio/blob/main/src/ESP32OLEDStudio.cpp"
click node_facade_header "https://github.com/tinny-robot/esp32oledstudio/blob/main/src/ESP32OLEDStudio.h"
click node_display "https://github.com/tinny-robot/esp32oledstudio/blob/main/src/OLEDDisplay.cpp"
click node_display_header "https://github.com/tinny-robot/esp32oledstudio/blob/main/src/OLEDDisplay.h"
click node_webmanager "https://github.com/tinny-robot/esp32oledstudio/blob/main/src/WebServerManager.cpp"
click node_webheader "https://github.com/tinny-robot/esp32oledstudio/blob/main/src/WebServerManager.h"
click node_webcontent "https://github.com/tinny-robot/esp32oledstudio/blob/main/src/WebContent.h"
click node_browserui "https://github.com/tinny-robot/esp32oledstudio/blob/main/data/index.html"
click node_browserlogic "https://github.com/tinny-robot/esp32oledstudio/blob/main/data/app.js"
click node_imageprocessing "https://github.com/tinny-robot/esp32oledstudio/blob/main/data/app.js"
click node_styles "https://github.com/tinny-robot/esp32oledstudio/blob/main/data/style.css"
click node_dashboard "https://github.com/tinny-robot/esp32oledstudio/blob/main/data/app.js"
click node_textcontrol "https://github.com/tinny-robot/esp32oledstudio/blob/main/data/app.js"
click node_settings "https://github.com/tinny-robot/esp32oledstudio/blob/main/data/app.js"

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_facade,node_facade_header toneBlue
class node_display,node_display_header toneAmber
class node_webmanager,node_webheader,node_webcontent toneMint
class node_browserui,node_browserlogic,node_imageprocessing,node_styles,node_dashboard,node_textcontrol,node_settings toneRose
class node_sketch,node_u8g2,node_oled,node_client toneIndigo
```

## Components

### Arduino API

- [Studio facade](https://github.com/tinny-robot/esp32oledstudio/blob/main/src/ESP32OLEDStudio.cpp): `src/ESP32OLEDStudio.cpp`
- [Facade API](https://github.com/tinny-robot/esp32oledstudio/blob/main/src/ESP32OLEDStudio.h): `src/ESP32OLEDStudio.h`

### OLED Rendering

- [Display wrapper](https://github.com/tinny-robot/esp32oledstudio/blob/main/src/OLEDDisplay.cpp): `src/OLEDDisplay.cpp`
- [Display modes and state](https://github.com/tinny-robot/esp32oledstudio/blob/main/src/OLEDDisplay.h): `src/OLEDDisplay.h`

### Local Web Server

- [AP and HTTP handlers](https://github.com/tinny-robot/esp32oledstudio/blob/main/src/WebServerManager.cpp): `src/WebServerManager.cpp`
- [Server API contract](https://github.com/tinny-robot/esp32oledstudio/blob/main/src/WebServerManager.h): `src/WebServerManager.h`
- [Embedded UI assets](https://github.com/tinny-robot/esp32oledstudio/blob/main/src/WebContent.h): `src/WebContent.h`

### Browser Interface

- [Dashboard and controls](https://github.com/tinny-robot/esp32oledstudio/blob/main/data/index.html): `data/index.html`
- [UI and API client](https://github.com/tinny-robot/esp32oledstudio/blob/main/data/app.js): `data/app.js`
- [Image processing](https://github.com/tinny-robot/esp32oledstudio/blob/main/data/app.js): `data/app.js`
- [Interface styling](https://github.com/tinny-robot/esp32oledstudio/blob/main/data/style.css): `data/style.css`
- [Status dashboard](https://github.com/tinny-robot/esp32oledstudio/blob/main/data/app.js): `data/app.js`
- [Text and font controls](https://github.com/tinny-robot/esp32oledstudio/blob/main/data/app.js): `data/app.js`
- [Settings controls](https://github.com/tinny-robot/esp32oledstudio/blob/main/data/app.js): `data/app.js`

### Other components

- **Arduino sketch**
- **U8g2 driver**
- **SH1106 OLED**
- **Phone or laptop**

## Connections

- Arduino sketch → Studio facade: calls (evidence: `README.md`)
- Studio facade → Display wrapper: initializes and delegates (evidence: `src/ESP32OLEDStudio.cpp`)
- Studio facade → AP and HTTP handlers: starts and services (evidence: `src/ESP32OLEDStudio.cpp`)
- Studio facade → Facade API: implements API (evidence: `src/ESP32OLEDStudio.cpp`)
- Display wrapper → Display modes and state: implements state API (evidence: `src/OLEDDisplay.cpp`)
- Display wrapper → U8g2 driver: draws through (evidence: `README.md`)
- U8g2 driver → SH1106 OLED: updates (evidence: `README.md`)
- AP and HTTP handlers → Server API contract: implements handlers (evidence: `src/WebServerManager.cpp`)
- AP and HTTP handlers → Display wrapper: updates display state (evidence: `src/WebServerManager.cpp`)
- AP and HTTP handlers → Embedded UI assets: serves embedded assets (evidence: `src/WebServerManager.cpp`)
- Phone or laptop → Dashboard and controls: uses (evidence: `README.md`)
- Dashboard and controls → UI and API client: loads script
- Dashboard and controls → Interface styling: loads stylesheet
- UI and API client → AP and HTTP handlers: sends HTTP requests (evidence: `README.md`)
- UI and API client → Status dashboard: refreshes (evidence: `data/app.js`)
- UI and API client → Text and font controls: initializes controls (evidence: `data/app.js`)
- UI and API client → Settings controls: initializes controls (evidence: `data/app.js`)
- UI and API client → Image processing: processes selected image (evidence: `data/app.js`)
- Image processing → AP and HTTP handlers: uploads bitmap (evidence: `README.md`)
