# tranminhhieu20/regov architecture

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

- Interactive diagram: https://gitdiagram.com/tranminhhieu20/regov
- Repository: https://github.com/tranminhhieu20/regov

## Overview

AQUA-REG-TOOL combines a desktop account/licensing client with browser automation for registering on configured sites and managing payout details. The intended automation entry point fetches site configuration, connects to a Hidemium browser through Playwright, and runs per-site flows; the checked-in `__main__` currently starts a separate mobile-browser path instead. The API exposes configuration, account/session, and password-recovery operations backed by database logic. Some client modules and API/database sections were not sampled, so uncertain internal links are omitted.

Main entry points: [`CLIENT_TOOL/main.py`](https://github.com/tranminhhieu20/regov/blob/main/CLIENT_TOOL/main.py) (Automation entry), [`SERVER_API/db.py`](https://github.com/tranminhhieu20/regov/blob/main/SERVER_API/db.py) (Account and config logic), [`CLIENT_TOOL/api_client.py`](https://github.com/tranminhhieu20/regov/blob/main/CLIENT_TOOL/api_client.py) (API client), [`CLIENT_TOOL/auth_gui.py`](https://github.com/tranminhhieu20/regov/blob/main/CLIENT_TOOL/auth_gui.py) (Authentication UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Desktop client"]
  node_auth_gui["Authentication UI<br/>[auth_gui.py]"]
  node_client_api["API client<br/>[api_client.py]"]
  node_client_gui["Tool interface<br/>[gui.py]"]
end

subgraph group_automation["Browser automation"]
  node_main["Automation entry<br/>[main.py]"]
  node_flows["Registration flows<br/>[flows.py]"]
  node_special_flows["Payout flows<br/>[special_flows.py]"]
  node_actions["Browser actions<br/>[actions.py]"]
  node_utils["Browser utilities<br/>[utils.py]"]
end

subgraph group_server["API and accounts"]
  node_api["HTTP API<br/>[main_api.py]"]
  node_db_logic["Account and config logic<br/>[db.py]"]
end

subgraph group_operations["Configuration and admin"]
  node_upload_config["Site configuration<br/>[upload_db.py]"]
  node_admin["Admin panel<br/>[admin_gui.py]"]
end

node_operator(("Tool operator"))
node_sites(("Registration sites"))
node_hidemium["Hidemium browser"]
node_mongo[("MongoDB")]
node_smtp["Email service"]

node_operator -->|"uses"| node_auth_gui
node_auth_gui -->|"requests account actions"| node_client_api
node_client_api -->|"HTTP requests"| node_api
node_operator -->|"starts automation"| node_main
node_main -->|"fetches config"| node_client_api
node_main -->|"finds browser endpoint"| node_utils
node_main -->|"connects via Playwright"| node_hidemium
node_main -->|"runs site flows"| node_flows
node_flows -->|"automates registration"| node_sites
node_special_flows -->|"uses click helper"| node_actions
node_api -->|"dispatches operations"| node_db_logic
node_db_logic -->|"reads and writes"| node_mongo
node_db_logic -->|"sends OTP email"| node_smtp
node_upload_config -->|"stores configuration"| node_mongo
node_admin -->|"manages users"| node_mongo
node_operator -->|"administers accounts"| node_admin
node_operator -->|"uses"| node_client_gui

click node_auth_gui "https://github.com/tranminhhieu20/regov/blob/main/CLIENT_TOOL/auth_gui.py"
click node_client_api "https://github.com/tranminhhieu20/regov/blob/main/CLIENT_TOOL/api_client.py"
click node_main "https://github.com/tranminhhieu20/regov/blob/main/CLIENT_TOOL/main.py"
click node_flows "https://github.com/tranminhhieu20/regov/blob/main/CLIENT_TOOL/flows.py"
click node_special_flows "https://github.com/tranminhhieu20/regov/blob/main/CLIENT_TOOL/special_flows.py"
click node_actions "https://github.com/tranminhhieu20/regov/blob/main/CLIENT_TOOL/actions.py"
click node_utils "https://github.com/tranminhhieu20/regov/blob/main/CLIENT_TOOL/utils.py"
click node_api "https://github.com/tranminhhieu20/regov/blob/main/SERVER_API/main_api.py"
click node_db_logic "https://github.com/tranminhhieu20/regov/blob/main/SERVER_API/db.py"
click node_upload_config "https://github.com/tranminhhieu20/regov/blob/main/SERVER_API/upload_db.py"
click node_admin "https://github.com/tranminhhieu20/regov/blob/main/admin_gui.py"
click node_client_gui "https://github.com/tranminhhieu20/regov/blob/main/CLIENT_TOOL/gui.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_auth_gui,node_client_api,node_client_gui,node_hidemium toneBlue
class node_main,node_flows,node_special_flows,node_actions,node_utils,node_mongo toneAmber
class node_api,node_db_logic toneMint
class node_upload_config,node_admin toneRose
class node_operator,node_sites,node_smtp toneIndigo
```

## Components

### Desktop client

- [Authentication UI](https://github.com/tranminhhieu20/regov/blob/main/CLIENT_TOOL/auth_gui.py): `CLIENT_TOOL/auth_gui.py`
- [API client](https://github.com/tranminhhieu20/regov/blob/main/CLIENT_TOOL/api_client.py): `CLIENT_TOOL/api_client.py`
- [Tool interface](https://github.com/tranminhhieu20/regov/blob/main/CLIENT_TOOL/gui.py): `CLIENT_TOOL/gui.py`

### Browser automation

- [Automation entry](https://github.com/tranminhhieu20/regov/blob/main/CLIENT_TOOL/main.py): `CLIENT_TOOL/main.py`
- [Registration flows](https://github.com/tranminhhieu20/regov/blob/main/CLIENT_TOOL/flows.py): `CLIENT_TOOL/flows.py`
- [Payout flows](https://github.com/tranminhhieu20/regov/blob/main/CLIENT_TOOL/special_flows.py): `CLIENT_TOOL/special_flows.py`
- [Browser actions](https://github.com/tranminhhieu20/regov/blob/main/CLIENT_TOOL/actions.py): `CLIENT_TOOL/actions.py`
- [Browser utilities](https://github.com/tranminhhieu20/regov/blob/main/CLIENT_TOOL/utils.py): `CLIENT_TOOL/utils.py`

### API and accounts

- [HTTP API](https://github.com/tranminhhieu20/regov/blob/main/SERVER_API/main_api.py): `SERVER_API/main_api.py`
- [Account and config logic](https://github.com/tranminhhieu20/regov/blob/main/SERVER_API/db.py): `SERVER_API/db.py`

### Configuration and admin

- [Site configuration](https://github.com/tranminhhieu20/regov/blob/main/SERVER_API/upload_db.py): `SERVER_API/upload_db.py`
- [Admin panel](https://github.com/tranminhhieu20/regov/blob/main/admin_gui.py): `admin_gui.py`

### Other components

- **Tool operator**
- **Registration sites**
- **Hidemium browser**
- **MongoDB**
- **Email service**

## Connections

- Tool operator → Authentication UI: uses
- Authentication UI → API client: requests account actions
- API client → HTTP API: HTTP requests
- Tool operator → Automation entry: starts automation
- Automation entry → API client: fetches config
- Automation entry → Browser utilities: finds browser endpoint
- Automation entry → Hidemium browser: connects via Playwright
- Automation entry → Registration flows: runs site flows
- Registration flows → Registration sites: automates registration
- Payout flows → Browser actions: uses click helper
- HTTP API → Account and config logic: dispatches operations
- Account and config logic → MongoDB: reads and writes
- Account and config logic → Email service: sends OTP email
- Site configuration → MongoDB: stores configuration
- Admin panel → MongoDB: manages users
- Tool operator → Admin panel: administers accounts
- Tool operator → Tool interface: uses
