# alessandromatera/lanowl architecture

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

- Interactive diagram: https://gitdiagram.com/alessandromatera/lanowl
- Repository: https://github.com/alessandromatera/lanowl

## Overview

lanowl is a self-hosted network-monitoring and maintenance application. Its main workflow watches devices and the internet, investigates incidents with read-only checks and a local model, then reports findings through alerts and the dashboard. Separate capabilities cover discovery, security reviews, updates, backups, and owner-approved actions. The README documents these workflows; sampled code confirms key boundaries such as passive probes and approval-gated actions. Some source modules are unsampled, so the graph avoids asserting their internal call wiring.

Main entry points: [`src/lanowl/actions.py`](https://github.com/alessandromatera/lanowl/blob/main/src/lanowl/actions.py) (Approved actions), [`src/lanowl/web.py`](https://github.com/alessandromatera/lanowl/blob/main/src/lanowl/web.py) (Dashboard), [`src/lanowl/wanwatch.py`](https://github.com/alessandromatera/lanowl/blob/main/src/lanowl/wanwatch.py) (Internet watcher), [`src/lanowl/discovery.py`](https://github.com/alessandromatera/lanowl/blob/main/src/lanowl/discovery.py) (Device discovery)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_monitoring["Network monitoring"]
  node_alerts["Incident alerts<br/>[alerts.py]"]
  node_wanwatch["Internet watcher<br/>[wanwatch.py]"]
  node_probes["Network probes<br/>[probes.py]"]
  node_routeros["RouterOS access<br/>[routeros.py]"]
  node_discovery["Device discovery<br/>[discovery.py]"]
  node_netfacts["Network facts<br/>[netfacts.py]"]
  node_report["Health reporting<br/>[report.py]"]
end

subgraph group_investigation["Diagnosis and intelligence"]
  node_agent["AI investigator<br/>[agent.py]"]
  node_checks["Diagnostic checks<br/>[checks.py]"]
  node_prompts["Model context<br/>[prompts.py]"]
  node_records["History and records<br/>[records.py]"]
end

subgraph group_security["Security and discovery"]
  node_exposure["Security review<br/>[exposure.py]"]
  node_hostlog["Host log review<br/>[hostlog.py]"]
  node_cves["Vulnerability scans<br/>[cves.py]"]
end

subgraph group_maintenance["Device maintenance"]
  node_updates["Update checks<br/>[updates.py]"]
  node_backups["Device backups<br/>[backups.py]"]
  node_actions["Approved actions<br/>[actions.py]"]
  node_containers["Container updates<br/>[containers.py]"]
end

subgraph group_product["Application interface"]
  node_main["Runtime coordinator<br/>[main.py]"]
  node_web["Dashboard<br/>[web.py]"]
  node_settingsweb["Setup and settings<br/>[settingsweb.py]"]
  node_login["Login controls<br/>[login.py]"]
  node_sinks["Notification sinks<br/>[sinks.py]"]
end

node_owner(("Network owner"))
node_ollama["Ollama model"]

node_owner -->|"views status"| node_web
node_owner -->|"asks questions"| node_web
node_owner -->|"approves fixes"| node_actions
node_wanwatch -->|"reports blips"| node_alerts
node_discovery -->|"presents devices"| node_owner
node_exposure -->|"presents findings"| node_owner
node_updates -->|"reports updates"| node_owner
node_backups -->|"offers backups"| node_owner
node_actions -->|"requests approval"| node_owner
node_owner -->|"confirms proposals"| node_actions
node_checks -->|"runs diagnostics"| node_probes
node_agent -->|"uses checks"| node_checks
node_agent -.->|"investigates incidents"| node_ollama
node_web -->|"serves settings"| node_settingsweb
node_web -->|"uses login"| node_login
node_report -->|"feeds alerting"| node_alerts
node_wanwatch -->|"reads router data"| node_routeros
node_discovery -->|"reads router tables"| node_routeros
node_updates -->|"checks containers"| node_containers
node_actions -->|"updates containers"| node_containers

click node_main "https://github.com/alessandromatera/lanowl/blob/main/src/lanowl/main.py"
click node_web "https://github.com/alessandromatera/lanowl/blob/main/src/lanowl/web.py"
click node_settingsweb "https://github.com/alessandromatera/lanowl/blob/main/src/lanowl/settingsweb.py"
click node_login "https://github.com/alessandromatera/lanowl/blob/main/src/lanowl/login.py"
click node_sinks "https://github.com/alessandromatera/lanowl/blob/main/src/lanowl/sinks.py"
click node_alerts "https://github.com/alessandromatera/lanowl/blob/main/src/lanowl/alerts.py"
click node_wanwatch "https://github.com/alessandromatera/lanowl/blob/main/src/lanowl/wanwatch.py"
click node_probes "https://github.com/alessandromatera/lanowl/blob/main/src/lanowl/probes.py"
click node_routeros "https://github.com/alessandromatera/lanowl/blob/main/src/lanowl/routeros.py"
click node_discovery "https://github.com/alessandromatera/lanowl/blob/main/src/lanowl/discovery.py"
click node_netfacts "https://github.com/alessandromatera/lanowl/blob/main/src/lanowl/netfacts.py"
click node_report "https://github.com/alessandromatera/lanowl/blob/main/src/lanowl/report.py"
click node_agent "https://github.com/alessandromatera/lanowl/blob/main/src/lanowl/agent.py"
click node_checks "https://github.com/alessandromatera/lanowl/blob/main/src/lanowl/checks.py"
click node_prompts "https://github.com/alessandromatera/lanowl/blob/main/src/lanowl/prompts.py"
click node_records "https://github.com/alessandromatera/lanowl/blob/main/src/lanowl/records.py"
click node_exposure "https://github.com/alessandromatera/lanowl/blob/main/src/lanowl/exposure.py"
click node_hostlog "https://github.com/alessandromatera/lanowl/blob/main/src/lanowl/hostlog.py"
click node_cves "https://github.com/alessandromatera/lanowl/blob/main/src/lanowl/cves.py"
click node_updates "https://github.com/alessandromatera/lanowl/blob/main/src/lanowl/updates.py"
click node_backups "https://github.com/alessandromatera/lanowl/blob/main/src/lanowl/backups.py"
click node_actions "https://github.com/alessandromatera/lanowl/blob/main/src/lanowl/actions.py"
click node_containers "https://github.com/alessandromatera/lanowl/blob/main/src/lanowl/containers.py"

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_alerts,node_wanwatch,node_probes,node_routeros,node_discovery,node_netfacts,node_report toneBlue
class node_agent,node_checks,node_prompts,node_records toneAmber
class node_exposure,node_hostlog,node_cves toneMint
class node_updates,node_backups,node_actions,node_containers toneRose
class node_main,node_web,node_settingsweb,node_login,node_sinks,node_owner,node_ollama toneIndigo
```

## Components

### Network monitoring

- [Incident alerts](https://github.com/alessandromatera/lanowl/blob/main/src/lanowl/alerts.py): `src/lanowl/alerts.py`
- [Internet watcher](https://github.com/alessandromatera/lanowl/blob/main/src/lanowl/wanwatch.py): `src/lanowl/wanwatch.py`
- [Network probes](https://github.com/alessandromatera/lanowl/blob/main/src/lanowl/probes.py): `src/lanowl/probes.py`
- [RouterOS access](https://github.com/alessandromatera/lanowl/blob/main/src/lanowl/routeros.py): `src/lanowl/routeros.py`
- [Device discovery](https://github.com/alessandromatera/lanowl/blob/main/src/lanowl/discovery.py): `src/lanowl/discovery.py`
- [Network facts](https://github.com/alessandromatera/lanowl/blob/main/src/lanowl/netfacts.py): `src/lanowl/netfacts.py`
- [Health reporting](https://github.com/alessandromatera/lanowl/blob/main/src/lanowl/report.py): `src/lanowl/report.py`

### Diagnosis and intelligence

- [AI investigator](https://github.com/alessandromatera/lanowl/blob/main/src/lanowl/agent.py): `src/lanowl/agent.py`
- [Diagnostic checks](https://github.com/alessandromatera/lanowl/blob/main/src/lanowl/checks.py): `src/lanowl/checks.py`
- [Model context](https://github.com/alessandromatera/lanowl/blob/main/src/lanowl/prompts.py): `src/lanowl/prompts.py`
- [History and records](https://github.com/alessandromatera/lanowl/blob/main/src/lanowl/records.py): `src/lanowl/records.py`

### Security and discovery

- [Security review](https://github.com/alessandromatera/lanowl/blob/main/src/lanowl/exposure.py): `src/lanowl/exposure.py`
- [Host log review](https://github.com/alessandromatera/lanowl/blob/main/src/lanowl/hostlog.py): `src/lanowl/hostlog.py`
- [Vulnerability scans](https://github.com/alessandromatera/lanowl/blob/main/src/lanowl/cves.py): `src/lanowl/cves.py`

### Device maintenance

- [Update checks](https://github.com/alessandromatera/lanowl/blob/main/src/lanowl/updates.py): `src/lanowl/updates.py`
- [Device backups](https://github.com/alessandromatera/lanowl/blob/main/src/lanowl/backups.py): `src/lanowl/backups.py`
- [Approved actions](https://github.com/alessandromatera/lanowl/blob/main/src/lanowl/actions.py): `src/lanowl/actions.py`
- [Container updates](https://github.com/alessandromatera/lanowl/blob/main/src/lanowl/containers.py): `src/lanowl/containers.py`

### Application interface

- [Runtime coordinator](https://github.com/alessandromatera/lanowl/blob/main/src/lanowl/main.py): `src/lanowl/main.py`
- [Dashboard](https://github.com/alessandromatera/lanowl/blob/main/src/lanowl/web.py): `src/lanowl/web.py`
- [Setup and settings](https://github.com/alessandromatera/lanowl/blob/main/src/lanowl/settingsweb.py): `src/lanowl/settingsweb.py`
- [Login controls](https://github.com/alessandromatera/lanowl/blob/main/src/lanowl/login.py): `src/lanowl/login.py`
- [Notification sinks](https://github.com/alessandromatera/lanowl/blob/main/src/lanowl/sinks.py): `src/lanowl/sinks.py`

### Other components

- **Network owner**
- **Ollama model**

## Connections

- Network owner → Dashboard: views status (evidence: `README.md`)
- Network owner → Dashboard: asks questions (evidence: `README.md`)
- Network owner → Approved actions: approves fixes (evidence: `README.md`)
- Internet watcher → Incident alerts: reports blips (evidence: `README.md`)
- Device discovery → Network owner: presents devices (evidence: `README.md`)
- Security review → Network owner: presents findings (evidence: `README.md`)
- Update checks → Network owner: reports updates (evidence: `README.md`)
- Device backups → Network owner: offers backups (evidence: `README.md`)
- Approved actions → Network owner: requests approval (evidence: `src/lanowl/actions.py`)
- Network owner → Approved actions: confirms proposals (evidence: `src/lanowl/actions.py`)
- Diagnostic checks → Network probes: runs diagnostics (evidence: `src/lanowl/checks.py`)
- AI investigator → Diagnostic checks: uses checks (evidence: `src/lanowl/checks.py`)
- AI investigator → Ollama model: investigates incidents
- Dashboard → Setup and settings: serves settings (evidence: `src/lanowl/web.py`)
- Dashboard → Login controls: uses login (evidence: `src/lanowl/web.py`)
- Health reporting → Incident alerts: feeds alerting (evidence: `src/lanowl/report.py`)
- Internet watcher → RouterOS access: reads router data (evidence: `src/lanowl/wanwatch.py`)
- Device discovery → RouterOS access: reads router tables (evidence: `src/lanowl/discovery.py`)
- Update checks → Container updates: checks containers (evidence: `src/lanowl/updates.py`)
- Approved actions → Container updates: updates containers (evidence: `src/lanowl/actions.py`)
