# suyancc/gpt-upi-tool architecture

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

- Interactive diagram: https://gitdiagram.com/suyancc/gpt-upi-tool
- Repository: https://github.com/suyancc/gpt-upi-tool

## Overview

The repository combines a Python ChatGPT account-creation and session-management application with a separate Rust Telegram UPI bot. The main user workflow is configuring and launching signup jobs through the local web UI, which coordinates signup, mail, MFA and optional payment work, then exposes job results. Additional documented capabilities include iCloud Hide My Email profile pooling and AutoReg, session login, and UPI QR generation. The excerpts show selected orchestration and persistence details; other connections are included only where the README or source index documents them.

Main entry points: [`web/manager.py`](https://github.com/suyancc/gpt-upi-tool/blob/master/web/manager.py) (Signup jobs), [`autoreg/runner.py`](https://github.com/suyancc/gpt-upi-tool/blob/master/autoreg/runner.py) (AutoReg loop), [`signup.py`](https://github.com/suyancc/gpt-upi-tool/blob/master/signup.py) (Signup pipeline), [`web/server.py`](https://github.com/suyancc/gpt-upi-tool/blob/master/web/server.py) (FastAPI server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_signup["Signup workflow"]
  node_jobmgr["Signup jobs<br/>[manager.py]"]
  node_signup["Signup pipeline<br/>[signup.py]"]
  node_request["Request signup<br/>[request_phase.py]"]
  node_browser["Browser signup<br/>[browser_phase.py]"]
  node_session["Session login<br/>[session_phase.py]"]
end

subgraph group_account["Account services"]
  node_mail["Mail providers<br/>[mail_providers.py]"]
  node_mfa["MFA and TOTP<br/>[mfa_phase.py]"]
  node_payment["Payment links<br/>[payment_link.py]"]
  node_autoreg["AutoReg loop<br/>[runner.py]"]
  node_hme["iCloud HME pool<br/>[manager.py]"]
end

subgraph group_web["Web interface"]
  node_webui["Web UI<br/>[app.js]"]
  node_server["FastAPI server<br/>[server.py]"]
  node_hmeapi["HME routes<br/>[icloud_routes.py]"]
end

subgraph group_storage["Persistence"]
  node_dbrepo["Repositories<br/>[repositories.py]"]
  node_dbengine[("SQLite engine<br/>[engine.py]")]
end

subgraph group_upi["UPI services"]
  node_rustbot["Telegram UPI bot<br/>[main.rs]"]
  node_upiflow["UPI QR flow<br/>[runner.rs]"]
end

node_user(("Operator"))
node_telegram(("Telegram user"))
node_chatgpt{{"ChatGPT services"}}
node_apple{{"Apple HME"}}

node_user -->|"configures jobs"| node_webui
node_webui -->|"uses API"| node_server
node_server -->|"routes jobs"| node_jobmgr
node_jobmgr -->|"runs signup"| node_signup
node_jobmgr -->|"runs login"| node_session
node_jobmgr -->|"selects mail"| node_mail
node_jobmgr -->|"runs MFA"| node_mfa
node_jobmgr -->|"creates payment links"| node_payment
node_signup -->|"supports request mode"| node_request
node_signup -->|"supports browser mode"| node_browser
node_request -.->|"requests signup"| node_chatgpt
node_browser -.->|"automates signup"| node_chatgpt
node_session -->|"authenticates"| node_chatgpt
node_autoreg -->|"polls mail"| node_mail
node_autoreg -->|"enables MFA"| node_mfa
node_autoreg -->|"persists accounts"| node_dbrepo
node_server -->|"mounts routes"| node_hmeapi
node_hmeapi -->|"manages profiles"| node_hme
node_hme -.->|"manages HME"| node_apple
node_jobmgr -->|"reads and writes jobs"| node_dbrepo
node_dbrepo -->|"uses engine"| node_dbengine
node_telegram -->|"uploads session"| node_rustbot
node_rustbot -->|"queues UPI work"| node_upiflow
node_upiflow -.->|"uses account session"| node_chatgpt
node_upiflow -->|"sends QR result"| node_telegram

click node_webui "https://github.com/suyancc/gpt-upi-tool/blob/master/web/static/app.js"
click node_server "https://github.com/suyancc/gpt-upi-tool/blob/master/web/server.py"
click node_jobmgr "https://github.com/suyancc/gpt-upi-tool/blob/master/web/manager.py"
click node_signup "https://github.com/suyancc/gpt-upi-tool/blob/master/signup.py"
click node_request "https://github.com/suyancc/gpt-upi-tool/blob/master/request_phase.py"
click node_browser "https://github.com/suyancc/gpt-upi-tool/blob/master/browser_phase.py"
click node_session "https://github.com/suyancc/gpt-upi-tool/blob/master/session_phase.py"
click node_mail "https://github.com/suyancc/gpt-upi-tool/blob/master/mail_providers.py"
click node_mfa "https://github.com/suyancc/gpt-upi-tool/blob/master/mfa_phase.py"
click node_payment "https://github.com/suyancc/gpt-upi-tool/blob/master/payment_link.py"
click node_autoreg "https://github.com/suyancc/gpt-upi-tool/blob/master/autoreg/runner.py"
click node_hme "https://github.com/suyancc/gpt-upi-tool/blob/master/icloud_hme/manager.py"
click node_hmeapi "https://github.com/suyancc/gpt-upi-tool/blob/master/web/icloud_routes.py"
click node_dbrepo "https://github.com/suyancc/gpt-upi-tool/blob/master/db/repositories.py"
click node_dbengine "https://github.com/suyancc/gpt-upi-tool/blob/master/db/engine.py"
click node_rustbot "https://github.com/suyancc/gpt-upi-tool/blob/master/rust_upi_bot/src/main.rs"
click node_upiflow "https://github.com/suyancc/gpt-upi-tool/blob/master/rust_upi_bot/src/upi/runner.rs"

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_jobmgr,node_signup,node_request,node_browser,node_session,node_telegram toneBlue
class node_mail,node_mfa,node_payment,node_autoreg,node_hme toneAmber
class node_webui,node_server,node_hmeapi toneMint
class node_dbrepo,node_dbengine toneRose
class node_rustbot,node_upiflow,node_user,node_chatgpt,node_apple toneIndigo
```

## Components

### Signup workflow

- [Signup jobs](https://github.com/suyancc/gpt-upi-tool/blob/master/web/manager.py): `web/manager.py`
- [Signup pipeline](https://github.com/suyancc/gpt-upi-tool/blob/master/signup.py): `signup.py`
- [Request signup](https://github.com/suyancc/gpt-upi-tool/blob/master/request_phase.py): `request_phase.py`
- [Browser signup](https://github.com/suyancc/gpt-upi-tool/blob/master/browser_phase.py): `browser_phase.py`
- [Session login](https://github.com/suyancc/gpt-upi-tool/blob/master/session_phase.py): `session_phase.py`

### Account services

- [Mail providers](https://github.com/suyancc/gpt-upi-tool/blob/master/mail_providers.py): `mail_providers.py`
- [MFA and TOTP](https://github.com/suyancc/gpt-upi-tool/blob/master/mfa_phase.py): `mfa_phase.py`
- [Payment links](https://github.com/suyancc/gpt-upi-tool/blob/master/payment_link.py): `payment_link.py`
- [AutoReg loop](https://github.com/suyancc/gpt-upi-tool/blob/master/autoreg/runner.py): `autoreg/runner.py`
- [iCloud HME pool](https://github.com/suyancc/gpt-upi-tool/blob/master/icloud_hme/manager.py): `icloud_hme/manager.py`

### Web interface

- [Web UI](https://github.com/suyancc/gpt-upi-tool/blob/master/web/static/app.js): `web/static/app.js`
- [FastAPI server](https://github.com/suyancc/gpt-upi-tool/blob/master/web/server.py): `web/server.py`
- [HME routes](https://github.com/suyancc/gpt-upi-tool/blob/master/web/icloud_routes.py): `web/icloud_routes.py`

### Persistence

- [Repositories](https://github.com/suyancc/gpt-upi-tool/blob/master/db/repositories.py): `db/repositories.py`
- [SQLite engine](https://github.com/suyancc/gpt-upi-tool/blob/master/db/engine.py): `db/engine.py`

### UPI services

- [Telegram UPI bot](https://github.com/suyancc/gpt-upi-tool/blob/master/rust_upi_bot/src/main.rs): `rust_upi_bot/src/main.rs`
- [UPI QR flow](https://github.com/suyancc/gpt-upi-tool/blob/master/rust_upi_bot/src/upi/runner.rs): `rust_upi_bot/src/upi/runner.rs`

### Other components

- **Operator**
- **Telegram user**
- **ChatGPT services**
- **Apple HME**

## Connections

- Operator → Web UI: configures jobs (evidence: `README.md`)
- Web UI → FastAPI server: uses API (evidence: `README.md`)
- FastAPI server → Signup jobs: routes jobs (evidence: `web/server.py`)
- Signup jobs → Signup pipeline: runs signup (evidence: `web/manager.py`)
- Signup jobs → Session login: runs login (evidence: `web/manager.py`)
- Signup jobs → Mail providers: selects mail (evidence: `web/manager.py`)
- Signup jobs → MFA and TOTP: runs MFA (evidence: `web/manager.py`)
- Signup jobs → Payment links: creates payment links (evidence: `web/manager.py`)
- Signup pipeline → Request signup: supports request mode (evidence: `README.md`)
- Signup pipeline → Browser signup: supports browser mode (evidence: `README.md`)
- Request signup → ChatGPT services: requests signup
- Browser signup → ChatGPT services: automates signup
- Session login → ChatGPT services: authenticates (evidence: `session_phase.py`)
- AutoReg loop → Mail providers: polls mail (evidence: `autoreg/runner.py`)
- AutoReg loop → MFA and TOTP: enables MFA (evidence: `autoreg/runner.py`)
- AutoReg loop → Repositories: persists accounts (evidence: `autoreg/runner.py`)
- FastAPI server → HME routes: mounts routes (evidence: `web/server.py`)
- HME routes → iCloud HME pool: manages profiles (evidence: `web/icloud_routes.py`)
- iCloud HME pool → Apple HME: manages HME
- Signup jobs → Repositories: reads and writes jobs (evidence: `web/manager.py`)
- Repositories → SQLite engine: uses engine (evidence: `db/repositories.py`)
- Telegram user → Telegram UPI bot: uploads session (evidence: `rust_upi_bot/src/main.rs`)
- Telegram UPI bot → UPI QR flow: queues UPI work (evidence: `rust_upi_bot/src/main.rs`)
- UPI QR flow → ChatGPT services: uses account session
- UPI QR flow → Telegram user: sends QR result (evidence: `README.md`)
