# marekwo/mc-webui architecture

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

- Interactive diagram: https://gitdiagram.com/marekwo/mc-webui
- Repository: https://github.com/marekwo/mc-webui

## Overview

mc-webui is a Flask web interface for operating a MeshCore LoRa network device. The main workflow is browser actions through the web application and API to device commands, with device events and messages persisted for chat, contacts, and search. Separate capabilities include channel and DM interaction, contact and route management, archives, console access, diagnostics, maps, and the Android WebView companion. The graph uses documented capabilities and indexed imports; unsampled feature wiring is omitted where it cannot be verified.

Main entry points: [`app/main.py`](https://github.com/marekwo/mc-webui/blob/main/app/main.py) (Flask app), [`app/static/js/app.js`](https://github.com/marekwo/mc-webui/blob/main/app/static/js/app.js) (Browser UI), [`app/routes/api.py`](https://github.com/marekwo/mc-webui/blob/main/app/routes/api.py) (REST API), [`app/device_manager.py`](https://github.com/marekwo/mc-webui/blob/main/app/device_manager.py) (Device manager)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_webapp["Flask app<br/>[main.py]"]
  node_api["REST API<br/>[api.py]"]
  node_views["Page views<br/>[views.py]"]
  node_i18n["Translations<br/>[i18n.py]"]
end

subgraph group_mesh["Mesh operations"]
  node_device["Device manager<br/>[device_manager.py]"]
  node_cli["Command wrapper<br/>[cli.py]"]
  node_parser["Message parser<br/>[parser.py]"]
  node_regions["Region helpers<br/>[regions.py]"]
end

subgraph group_data["Data and services"]
  node_db[("SQLite database<br/>[database.py]")]
  node_archive["Archive manager<br/>[manager.py]"]
  node_observer["Mesh observer<br/>[observer.py]"]
  node_diagnostics["Diagnostics<br/>[diagnostics.py]"]
end

subgraph group_clients["User clients"]
  node_browser["Browser UI<br/>[app.js]"]
  node_console["Interactive console<br/>[console.js]"]
  node_contacts["Contact tools<br/>[contacts.js]"]
  node_dm["Direct messages<br/>[dm.js]"]
  node_repeaters["Repeater tools<br/>[repeaters.js]"]
  node_pathanalysis["Path analysis<br/>[path-analyzer.js]"]
  node_logs["System log viewer<br/>[logs.js]"]
  node_map["Contact map<br/>[geo.py]"]
  node_android["Android companion<br/>[MainActivity.kt]"]
end

node_admin(("User"))
node_meshcore{{"MeshCore device"}}

node_admin -->|"uses"| node_browser
node_browser -->|"requests pages"| node_webapp
node_webapp -->|"registers"| node_api
node_webapp -->|"registers"| node_views
node_webapp -->|"uses"| node_i18n
node_webapp -->|"initializes"| node_device
node_webapp -->|"initializes"| node_db
node_api -->|"calls"| node_cli
node_api -->|"calls"| node_device
node_api -->|"uses"| node_regions
node_cli -->|"gets manager"| node_webapp
node_device -->|"communicates"| node_meshcore
node_browser -.->|"opens"| node_console
node_browser -.->|"opens"| node_contacts
node_browser -.->|"opens"| node_dm
node_browser -.->|"opens"| node_repeaters
node_browser -.->|"opens"| node_pathanalysis
node_device -->|"stores events"| node_db
node_device -.->|"starts"| node_observer
node_webapp -->|"initializes"| node_archive
node_archive -.->|"archives messages"| node_db
node_api -->|"uses"| node_diagnostics
node_browser -.->|"views"| node_logs
node_api -->|"uses"| node_map
node_admin -->|"uses"| node_android
node_android -->|"opens instance"| node_webapp

click node_browser "https://github.com/marekwo/mc-webui/blob/main/app/static/js/app.js"
click node_webapp "https://github.com/marekwo/mc-webui/blob/main/app/main.py"
click node_api "https://github.com/marekwo/mc-webui/blob/main/app/routes/api.py"
click node_views "https://github.com/marekwo/mc-webui/blob/main/app/routes/views.py"
click node_i18n "https://github.com/marekwo/mc-webui/blob/main/app/i18n.py"
click node_device "https://github.com/marekwo/mc-webui/blob/main/app/device_manager.py"
click node_cli "https://github.com/marekwo/mc-webui/blob/main/app/meshcore/cli.py"
click node_parser "https://github.com/marekwo/mc-webui/blob/main/app/meshcore/parser.py"
click node_regions "https://github.com/marekwo/mc-webui/blob/main/app/meshcore/regions.py"
click node_console "https://github.com/marekwo/mc-webui/blob/main/app/static/js/console.js"
click node_contacts "https://github.com/marekwo/mc-webui/blob/main/app/static/js/contacts.js"
click node_dm "https://github.com/marekwo/mc-webui/blob/main/app/static/js/dm.js"
click node_repeaters "https://github.com/marekwo/mc-webui/blob/main/app/static/js/repeaters.js"
click node_pathanalysis "https://github.com/marekwo/mc-webui/blob/main/app/static/js/path-analyzer.js"
click node_db "https://github.com/marekwo/mc-webui/blob/main/app/database.py"
click node_archive "https://github.com/marekwo/mc-webui/blob/main/app/archiver/manager.py"
click node_observer "https://github.com/marekwo/mc-webui/blob/main/app/observer.py"
click node_diagnostics "https://github.com/marekwo/mc-webui/blob/main/app/diagnostics.py"
click node_logs "https://github.com/marekwo/mc-webui/blob/main/app/static/js/logs.js"
click node_map "https://github.com/marekwo/mc-webui/blob/main/app/geo.py"
click node_android "https://github.com/marekwo/mc-webui/blob/main/android/src/app/src/main/java/it/wojtaszek/mc/wrapper/MainActivity.kt"

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_webapp,node_api,node_views,node_i18n,node_admin toneBlue
class node_device,node_cli,node_parser,node_regions toneAmber
class node_db,node_archive,node_observer,node_diagnostics toneMint
class node_browser,node_console,node_contacts,node_dm,node_repeaters,node_pathanalysis,node_logs,node_map,node_android toneRose
class node_meshcore toneIndigo
```

## Components

### Web application

- [Flask app](https://github.com/marekwo/mc-webui/blob/main/app/main.py): `app/main.py`
- [REST API](https://github.com/marekwo/mc-webui/blob/main/app/routes/api.py): `app/routes/api.py`
- [Page views](https://github.com/marekwo/mc-webui/blob/main/app/routes/views.py): `app/routes/views.py`
- [Translations](https://github.com/marekwo/mc-webui/blob/main/app/i18n.py): `app/i18n.py`

### Mesh operations

- [Device manager](https://github.com/marekwo/mc-webui/blob/main/app/device_manager.py): `app/device_manager.py`
- [Command wrapper](https://github.com/marekwo/mc-webui/blob/main/app/meshcore/cli.py): `app/meshcore/cli.py`
- [Message parser](https://github.com/marekwo/mc-webui/blob/main/app/meshcore/parser.py): `app/meshcore/parser.py`
- [Region helpers](https://github.com/marekwo/mc-webui/blob/main/app/meshcore/regions.py): `app/meshcore/regions.py`

### Data and services

- [SQLite database](https://github.com/marekwo/mc-webui/blob/main/app/database.py): `app/database.py`
- [Archive manager](https://github.com/marekwo/mc-webui/blob/main/app/archiver/manager.py): `app/archiver/manager.py`
- [Mesh observer](https://github.com/marekwo/mc-webui/blob/main/app/observer.py): `app/observer.py`
- [Diagnostics](https://github.com/marekwo/mc-webui/blob/main/app/diagnostics.py): `app/diagnostics.py`

### User clients

- [Browser UI](https://github.com/marekwo/mc-webui/blob/main/app/static/js/app.js): `app/static/js/app.js`
- [Interactive console](https://github.com/marekwo/mc-webui/blob/main/app/static/js/console.js): `app/static/js/console.js`
- [Contact tools](https://github.com/marekwo/mc-webui/blob/main/app/static/js/contacts.js): `app/static/js/contacts.js`
- [Direct messages](https://github.com/marekwo/mc-webui/blob/main/app/static/js/dm.js): `app/static/js/dm.js`
- [Repeater tools](https://github.com/marekwo/mc-webui/blob/main/app/static/js/repeaters.js): `app/static/js/repeaters.js`
- [Path analysis](https://github.com/marekwo/mc-webui/blob/main/app/static/js/path-analyzer.js): `app/static/js/path-analyzer.js`
- [System log viewer](https://github.com/marekwo/mc-webui/blob/main/app/static/js/logs.js): `app/static/js/logs.js`
- [Contact map](https://github.com/marekwo/mc-webui/blob/main/app/geo.py): `app/geo.py`
- [Android companion](https://github.com/marekwo/mc-webui/blob/main/android/src/app/src/main/java/it/wojtaszek/mc/wrapper/MainActivity.kt): `android/src/app/src/main/java/it/wojtaszek/mc/wrapper/MainActivity.kt`

### Other components

- **User**
- **MeshCore device**

## Connections

- User → Browser UI: uses
- Browser UI → Flask app: requests pages
- Flask app → REST API: registers (evidence: `app/main.py`)
- Flask app → Page views: registers (evidence: `app/main.py`)
- Flask app → Translations: uses (evidence: `app/main.py`)
- Flask app → Device manager: initializes (evidence: `app/main.py`)
- Flask app → SQLite database: initializes (evidence: `app/main.py`)
- REST API → Command wrapper: calls (evidence: `app/routes/api.py`)
- REST API → Device manager: calls (evidence: `app/routes/api.py`)
- REST API → Region helpers: uses (evidence: `app/routes/api.py`)
- Command wrapper → Flask app: gets manager (evidence: `app/meshcore/cli.py`)
- Device manager → MeshCore device: communicates
- Browser UI → Interactive console: opens
- Browser UI → Contact tools: opens
- Browser UI → Direct messages: opens
- Browser UI → Repeater tools: opens
- Browser UI → Path analysis: opens
- Device manager → SQLite database: stores events (evidence: `app/device_manager.py`)
- Device manager → Mesh observer: starts
- Flask app → Archive manager: initializes (evidence: `app/main.py`)
- Archive manager → SQLite database: archives messages
- REST API → Diagnostics: uses (evidence: `app/routes/api.py`)
- Browser UI → System log viewer: views
- REST API → Contact map: uses (evidence: `app/routes/api.py`)
- User → Android companion: uses
- Android companion → Flask app: opens instance
