# alhaweity/quotamanager architecture

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

- Interactive diagram: https://gitdiagram.com/alhaweity/quotamanager
- Repository: https://github.com/alhaweity/quotamanager

## Overview

Quota Manager is a home-network gateway that assigns shared monthly allowances, measures device traffic, and enforces limits while providing a dashboard for household administration. The main path is administrator → web dashboard → API → quota service and persistence → gateway enforcement; live counters feed dashboard views. Separate capabilities cover DNS and firewall security, network visibility, VPN and remote access, and local file sharing. The map uses the shown excerpts, SOURCE INDEX references, and README; several unsampled feature implementations are represented at their exact directory paths, with uncertain links omitted.

Main entry points: [`api/app.py`](https://github.com/alhaweity/quotamanager/blob/main/api/app.py) (REST and live API), [`quota/vpn_manager.py`](https://github.com/alhaweity/quotamanager/blob/main/quota/vpn_manager.py) (VPN management), [`web/js/main.js`](https://github.com/alhaweity/quotamanager/blob/main/web/js/main.js) (Web dashboard), [`quota/db.py`](https://github.com/alhaweity/quotamanager/blob/main/quota/db.py) (SQLite persistence)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Dashboard"]
  node_dashboard["Web dashboard<br/>[main.js]"]
  node_overview["Usage overview<br/>[overview.js]"]
  node_people["People and devices<br/>[people.js]"]
  node_quota_ui["Quota controls<br/>[quota.js]"]
  node_security_ui["Security controls<br/>[security.js]"]
  node_vpn_ui["VPN controls<br/>[vpn.js]"]
  node_share_ui["File sharing<br/>[share.js]"]
end

subgraph group_control["API and quota"]
  node_api["REST and live API<br/>[app.py]"]
  node_quota_service["Quota service<br/>[service.py]"]
  node_database[("SQLite persistence<br/>[db.py]")]
end

subgraph group_gateway["Gateway enforcement"]
  node_engine_state["Traffic snapshots<br/>[engine.py]"]
  node_packet_rules["Packet enforcement<br/>[nftables.py]"]
end

subgraph group_features["Network features"]
  node_dns_rules["DNS rules<br/>[dns_rules.py]"]
  node_firewall["Firewall<br/>[firewall.py]"]
  node_insights["Usage analytics"]
  node_network["Network discovery<br/>[topology.py]"]
end

subgraph group_access["Remote and local access"]
  node_vpn_manager["VPN management<br/>[vpn_manager.py]"]
  node_vpn_parser["VPN parsing<br/>[vpn_parser.py]"]
  node_vpn_sharing["VPN sharing<br/>[vpnshare.py]"]
  node_tailscale["Tailscale access<br/>[tailscale.py]"]
  node_local_share["Local sharing service<br/>[local_share.py]"]
end

node_admin(("Administrator"))
node_household(("Household devices"))

node_admin -->|"administers"| node_dashboard
node_dashboard -->|"renders"| node_overview
node_dashboard -->|"requests data"| node_api
node_overview -->|"loads dashboard"| node_api
node_people -->|"manages devices"| node_api
node_quota_ui -.->|"sets allowances"| node_api
node_security_ui -->|"configures security"| node_api
node_vpn_ui -->|"manages VPN"| node_api
node_share_ui -->|"manages sharing"| node_api
node_api -.->|"uses quota logic"| node_quota_service
node_api -.->|"reads and writes"| node_database
node_quota_service -->|"persists quota state"| node_database
node_api -->|"reads live state"| node_engine_state
node_household -.->|"traffic enforced"| node_packet_rules
node_packet_rules -.->|"publishes counters"| node_engine_state
node_api -.->|"uses DNS controls"| node_dns_rules
node_api -.->|"uses firewall controls"| node_firewall
node_api -.->|"uses history analytics"| node_insights
node_api -->|"configures remote access"| node_tailscale
node_vpn_manager -.->|"uses stored settings"| node_database
node_vpn_manager -->|"parses VPN config"| node_vpn_parser
node_vpn_manager -->|"uses sharing"| node_vpn_sharing
node_api -.->|"exposes sharing"| node_local_share
node_household -.->|"shares files"| node_local_share

click node_dashboard "https://github.com/alhaweity/quotamanager/blob/main/web/js/main.js"
click node_overview "https://github.com/alhaweity/quotamanager/blob/main/web/js/pages/overview.js"
click node_people "https://github.com/alhaweity/quotamanager/blob/main/web/js/pages/people.js"
click node_quota_ui "https://github.com/alhaweity/quotamanager/blob/main/web/js/pages/quota.js"
click node_security_ui "https://github.com/alhaweity/quotamanager/blob/main/web/js/pages/security.js"
click node_vpn_ui "https://github.com/alhaweity/quotamanager/blob/main/web/js/pages/vpn.js"
click node_share_ui "https://github.com/alhaweity/quotamanager/blob/main/web/js/pages/share.js"
click node_api "https://github.com/alhaweity/quotamanager/blob/main/api/app.py"
click node_quota_service "https://github.com/alhaweity/quotamanager/blob/main/quota/service.py"
click node_database "https://github.com/alhaweity/quotamanager/blob/main/quota/db.py"
click node_engine_state "https://github.com/alhaweity/quotamanager/blob/main/quota/engine.py"
click node_packet_rules "https://github.com/alhaweity/quotamanager/blob/main/quota/nftables.py"
click node_dns_rules "https://github.com/alhaweity/quotamanager/blob/main/quota/dns_rules.py"
click node_firewall "https://github.com/alhaweity/quotamanager/blob/main/quota/firewall.py"
click node_insights "https://github.com/alhaweity/quotamanager/blob/main/quota/history_analytics.py"
click node_network "https://github.com/alhaweity/quotamanager/blob/main/quota/topology.py"
click node_vpn_manager "https://github.com/alhaweity/quotamanager/blob/main/quota/vpn_manager.py"
click node_vpn_parser "https://github.com/alhaweity/quotamanager/blob/main/quota/vpn_parser.py"
click node_vpn_sharing "https://github.com/alhaweity/quotamanager/blob/main/quota/vpnshare.py"
click node_tailscale "https://github.com/alhaweity/quotamanager/blob/main/quota/tailscale.py"
click node_local_share "https://github.com/alhaweity/quotamanager/blob/main/quota/local_share.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_dashboard,node_overview,node_people,node_quota_ui,node_security_ui,node_vpn_ui,node_share_ui toneBlue
class node_api,node_quota_service,node_database toneAmber
class node_engine_state,node_packet_rules toneMint
class node_dns_rules,node_firewall,node_insights,node_network toneRose
class node_vpn_manager,node_vpn_parser,node_vpn_sharing,node_tailscale,node_local_share,node_admin,node_household toneIndigo
```

## Components

### Dashboard

- [Web dashboard](https://github.com/alhaweity/quotamanager/blob/main/web/js/main.js): `web/js/main.js`
- [Usage overview](https://github.com/alhaweity/quotamanager/blob/main/web/js/pages/overview.js): `web/js/pages/overview.js`
- [People and devices](https://github.com/alhaweity/quotamanager/blob/main/web/js/pages/people.js): `web/js/pages/people.js`
- [Quota controls](https://github.com/alhaweity/quotamanager/blob/main/web/js/pages/quota.js): `web/js/pages/quota.js`
- [Security controls](https://github.com/alhaweity/quotamanager/blob/main/web/js/pages/security.js): `web/js/pages/security.js`
- [VPN controls](https://github.com/alhaweity/quotamanager/blob/main/web/js/pages/vpn.js): `web/js/pages/vpn.js`
- [File sharing](https://github.com/alhaweity/quotamanager/blob/main/web/js/pages/share.js): `web/js/pages/share.js`

### API and quota

- [REST and live API](https://github.com/alhaweity/quotamanager/blob/main/api/app.py): `api/app.py`
- [Quota service](https://github.com/alhaweity/quotamanager/blob/main/quota/service.py): `quota/service.py`
- [SQLite persistence](https://github.com/alhaweity/quotamanager/blob/main/quota/db.py): `quota/db.py`

### Gateway enforcement

- [Traffic snapshots](https://github.com/alhaweity/quotamanager/blob/main/quota/engine.py): `quota/engine.py`
- [Packet enforcement](https://github.com/alhaweity/quotamanager/blob/main/quota/nftables.py): `quota/nftables.py`

### Network features

- [DNS rules](https://github.com/alhaweity/quotamanager/blob/main/quota/dns_rules.py): `quota/dns_rules.py`
- [Firewall](https://github.com/alhaweity/quotamanager/blob/main/quota/firewall.py): `quota/firewall.py`
- [Usage analytics](https://github.com/alhaweity/quotamanager/blob/main/quota/history_analytics.py): `quota/history_analytics.py`
- [Network discovery](https://github.com/alhaweity/quotamanager/blob/main/quota/topology.py): `quota/topology.py`

### Remote and local access

- [VPN management](https://github.com/alhaweity/quotamanager/blob/main/quota/vpn_manager.py): `quota/vpn_manager.py`
- [VPN parsing](https://github.com/alhaweity/quotamanager/blob/main/quota/vpn_parser.py): `quota/vpn_parser.py`
- [VPN sharing](https://github.com/alhaweity/quotamanager/blob/main/quota/vpnshare.py): `quota/vpnshare.py`
- [Tailscale access](https://github.com/alhaweity/quotamanager/blob/main/quota/tailscale.py): `quota/tailscale.py`
- [Local sharing service](https://github.com/alhaweity/quotamanager/blob/main/quota/local_share.py): `quota/local_share.py`

### Other components

- **Administrator**
- **Household devices**

## Connections

- Administrator → Web dashboard: administers
- Web dashboard → Usage overview: renders (evidence: `web/js/main.js`)
- Web dashboard → REST and live API: requests data (evidence: `web/js/main.js`)
- Usage overview → REST and live API: loads dashboard (evidence: `web/js/pages/overview.js`)
- People and devices → REST and live API: manages devices
- Quota controls → REST and live API: sets allowances
- Security controls → REST and live API: configures security (evidence: `web/js/pages/security.js`)
- VPN controls → REST and live API: manages VPN (evidence: `web/js/pages/vpn.js`)
- File sharing → REST and live API: manages sharing (evidence: `web/js/pages/share.js`)
- REST and live API → Quota service: uses quota logic (evidence: `api/app.py`)
- REST and live API → SQLite persistence: reads and writes (evidence: `api/app.py`)
- Quota service → SQLite persistence: persists quota state (evidence: `quota/service.py`)
- REST and live API → Traffic snapshots: reads live state (evidence: `quota/engine.py`)
- Household devices → Packet enforcement: traffic enforced
- Packet enforcement → Traffic snapshots: publishes counters (evidence: `quota/nftables.py`)
- REST and live API → DNS rules: uses DNS controls (evidence: `api/app.py`)
- REST and live API → Firewall: uses firewall controls
- REST and live API → Usage analytics: uses history analytics (evidence: `api/app.py`)
- REST and live API → Tailscale access: configures remote access (evidence: `api/app.py`)
- VPN management → SQLite persistence: uses stored settings (evidence: `quota/vpn_manager.py`)
- VPN management → VPN parsing: parses VPN config (evidence: `quota/vpn_manager.py`)
- VPN management → VPN sharing: uses sharing (evidence: `quota/vpn_manager.py`)
- REST and live API → Local sharing service: exposes sharing (evidence: `api/app.py`)
- Household devices → Local sharing service: shares files
