# hemna/aprsd-admin-extension architecture

> Architecture diagram of the GitHub repository hemna/aprsd-admin-extension, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-10-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hemna/aprsd-admin-extension
- Repository: https://github.com/hemna/aprsd-admin-extension

## Overview

##### Project type and purpose
- This is a Python “extension” or plugin for the aprsd daemon that spins up an admin web interface. It ships as a pip-installable package (`aprsd-admin-extension`) and plugs into aprsd (>= 3.4.0).

##### File structure
- Top-level packaging: `setup.py`, `pyproject.toml`, `requirements*.txt`, `Makefile`, `tox.ini`, `docs/`, `tests/`.
- Main package: `aprsd_admin_extension/`
- `extension.py` – entrypoint where aprsd discovers and registers the extension
- `conf/` – code to parse and expose configuration options
- `cmds/web.py` – CLI command (“aprsd-admin web”) to launch the web server
- `threads/log_monitor.py` – background thread that tails or watches aprsd logs
- `wsgi.py` – WSGI application factory
- `web/` – static assets (JS/CSS/images) and Jinja2 HTML templates for the admin UI
- `utils.py` – shared helper functions
- Tests: end-to-end smoke test (`test_aprsd_admin_extension.py`)
- Docs: Sphinx files describing installation, usage, configuration.

##### Read the README for additional insights
- Confirms it’s an APRS-admin interface served over HTTP
- Points to a CLI reference for the `web` command
- Mentions it integrates at runtime as an aprsd extension

##### Don’t overthink—capture every logical piece
- Extension entrypoint
- Config loader
- Background threads
- WSGI HTTP server
- Client assets

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Core Daemon
    subgraph "APRSD Daemon"
        D["APRSD Daemon"]:::backend
    end

    %% Extension Components
    subgraph "APRSD-Admin Extension"
        EL["Extension Loader"]:::backend
        CM1["Config Module (main.py)"]:::backend
        CM2["Config Module (opts.py)"]:::backend
        LM["Log Monitor Thread"]:::backend
        CLI["CLI Command: aprsd-admin web"]:::backend
        WSGI["WSGI Server & Handlers"]:::backend
        UT["Shared Utilities"]:::backend

        subgraph "Web UI"
            STA["Static Assets (JS/CSS/images)"]:::frontend
            TMP["HTML Templates"]:::frontend
        end
    end

    %% Client and External
    B["Browser Client"]:::frontend
    N["APRS Network / Peers"]:::external

    %% Relationships & Data Flow
    D -->|"Plugin API: load extension"| EL
    EL -->|"load configuration"| CM1
    EL -->|"load configuration"| CM2
    EL -->|"start background thread"| LM
    LM -->|"tail logs"| D
    CLI -->|"invoke WSGI server"| WSGI
    WSGI -->|"serve static files"| STA
    WSGI -->|"render templates"| TMP
    B -->|"HTTP GET/POST"| WSGI
    B -->|"AJAX GET /logs"| WSGI
    WSGI -->|"use helpers"| UT
    N -->|"APRS packets"| D

    %% Click Events
    click EL "https://github.com/hemna/aprsd-admin-extension/blob/master/aprsd_admin_extension/extension.py"
    click CM1 "https://github.com/hemna/aprsd-admin-extension/blob/master/aprsd_admin_extension/conf/main.py"
    click CM2 "https://github.com/hemna/aprsd-admin-extension/blob/master/aprsd_admin_extension/conf/opts.py"
    click CLI "https://github.com/hemna/aprsd-admin-extension/blob/master/aprsd_admin_extension/cmds/web.py"
    click LM "https://github.com/hemna/aprsd-admin-extension/blob/master/aprsd_admin_extension/threads/log_monitor.py"
    click WSGI "https://github.com/hemna/aprsd-admin-extension/blob/master/aprsd_admin_extension/wsgi.py"
    click UT "https://github.com/hemna/aprsd-admin-extension/blob/master/aprsd_admin_extension/utils.py"
    click STA "https://github.com/hemna/aprsd-admin-extension/tree/master/aprsd_admin_extension/web/admin/static/"
    click TMP "https://github.com/hemna/aprsd-admin-extension/blob/master/aprsd_admin_extension/web/admin/templates/index.html"
    click B "https://github.com/hemna/aprsd-admin-extension/blob/master/tests/test_aprsd_admin_extension.py"
    click N "https://github.com/hemna/aprsd-admin-extension/tree/master/docs/"

    %% Styles
    classDef backend fill:#E3F2FD,stroke:#2196F3,color:#0D47A1;
    classDef frontend fill:#FFF3E0,stroke:#FF9800,color:#E65100;
    classDef external fill:#E8F5E9,stroke:#4CAF50,color:#1B5E20;
```
