# l1ghtweight/netman architecture

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

- Interactive diagram: https://gitdiagram.com/l1ghtweight/netman
- Repository: https://github.com/l1ghtweight/netman

## Overview

##### Main Components

a) Core Components:
- User Interface Layer (Script Entry Points)
- Authentication Service
- Usage Monitoring Service
- Email Notification Service
- Data Storage Layer

b) External Systems:
- IUT Internet Portal (iusers page)
- Gmail SMTP Server
- Mobile App Integration Point (netboy)

**┌─ External Systems Layer ─────┐**
- IUT Portal               │
- Gmail SMTP               │
- Mobile App (netboy)      │
- ┘
- ↕
**┌─ Core Services Layer ────────┐**
- Authentication Service    │
- Usage Monitor            │
- Email Notifier           │
- ┘
- ↕
**┌─ Data Layer ────────────────┐**
- credentials.json         │
- secrets.py              │
- ┘

##### Component Details

a) Entry Points (Purple):
- netman.py (main script)
- netman_cron.sh (scheduling script)
- usage.sh (usage script)

b) Services (Blue):
- Authentication Service: Handles IUT portal login
- Usage Monitor: Scrapes and processes usage data
- Email Notifier: Handles email composition and sending

c) Data Storage (Green):
- credentials.json: User credentials store
- secrets.py: Email configuration store

d) External Systems (Orange):
- IUT Portal (HTTP/HTTPS)
- Gmail SMTP Server
- Mobile App Integration

##### Flow Indicators

- Data flow between components
- Authentication flows
- Email notification paths
- Mobile app integration points

##### Notes for Implementation

- Use standard UML or C4 model notation
- Clear separation between local and external components
- Scheduling mechanisms clearly
- Mobile app integration point for future expansion

##### Technical Stack Indicators

Technology badges for:
- Python 3.x
- Gmail SMTP
- JSON storage
- Cron/Task Scheduler

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and Classes
    classDef external fill:#FFA07A,stroke:#FF6347
    classDef core fill:#87CEEB,stroke:#4682B4
    classDef data fill:#98FB98,stroke:#3CB371
    classDef entry fill:#DDA0DD,stroke:#9370DB
    classDef scheduler fill:#FFD700,stroke:#DAA520

    %% External Systems Layer
    subgraph ExternalSystems
        IUTPortal["IUT Portal\n(iusers page)"]:::external
        GmailSMTP["Gmail SMTP\nServer"]:::external
        NetboyApp["Mobile App\n(netboy)"]:::external
    end

    %% Core Services Layer
    subgraph CoreServices
        AuthService["Authentication\nService"]:::core
        UsageMonitor["Usage Monitoring\nService"]:::core
        EmailNotifier["Email Notification\nService"]:::core
    end

    %% Entry Points Layer
    subgraph EntryPoints
        Netman["netman.py\n(Main Script)"]:::entry
        NetmanCron["netman_cron.sh"]:::scheduler
        UsageScript["usage.sh"]:::entry
    end

    %% Data Storage Layer
    subgraph DataStorage
        Credentials["credentials.json"]:::data
        Secrets["secrets.py"]:::data
        Assets["Assets"]:::data
        Requirements["requirements.txt"]:::data
    end

    %% Relationships
    Netman --> AuthService
    Netman --> UsageMonitor
    NetmanCron --> Netman
    UsageScript --> UsageMonitor
    
    AuthService --> IUTPortal
    UsageMonitor --> IUTPortal
    EmailNotifier --> GmailSMTP
    
    AuthService --> Credentials
    EmailNotifier --> Secrets
    UsageMonitor --> Assets
    
    UsageMonitor --> EmailNotifier
    NetboyApp --> UsageMonitor

    %% Click Events
    click Netman "https://github.com/L1ghtweight/netman/blob/main/netman.py"
    click UsageMonitor "https://github.com/L1ghtweight/netman/blob/main/get_usage.py"
    click EmailNotifier "https://github.com/L1ghtweight/netman/blob/main/send_mail.py"
    click NetmanCron "https://github.com/L1ghtweight/netman/blob/main/netman_cron.sh"
    click UsageScript "https://github.com/L1ghtweight/netman/blob/main/usage.sh"
    click Assets "https://github.com/L1ghtweight/netman/tree/main/assets"
    click Requirements "https://github.com/L1ghtweight/netman/blob/main/requirements.txt"

    %% Legend
    subgraph Legend
        L1["External Systems"]:::external
        L2["Core Services"]:::core
        L3["Data Storage"]:::data
        L4["Entry Points"]:::entry
        L5["Scheduler"]:::scheduler
    end
```
