# 525815266/yyb-go-enhanced architecture

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

- Interactive diagram: https://gitdiagram.com/525815266/yyb-go-enhanced
- Repository: https://github.com/525815266/yyb-go-enhanced

## Overview

YYB Go Enhanced is a self-hosted WeChat account-management and AppB protocol service. A browser user logs in, scans a QR code, and the service exchanges the authorization result for account credentials, stores the account, and exposes account and protocol operations. Separate branches cover per-account proxy and credential renewal, automation-panel task management, and the curated script collection. The sampled source confirms the server entry point, QR-to-login-buffer use, panel driver delegation, and persistence responsibilities; several feature links are based on README descriptions rather than inspected handlers.

Main entry points: [`internal/httpapi/app.go`](https://github.com/525815266/yyb-go-enhanced/blob/main/internal/httpapi/app.go) (HTTP API), [`internal/httpapi/panel_manager.go`](https://github.com/525815266/yyb-go-enhanced/blob/main/internal/httpapi/panel_manager.go) (Panel drivers), [`internal/httpapi/runs.go`](https://github.com/525815266/yyb-go-enhanced/blob/main/internal/httpapi/runs.go) (Run management), [`cmd/yyb-go/main.go`](https://github.com/525815266/yyb-go-enhanced/blob/main/cmd/yyb-go/main.go) (HTTP server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Web service"]
  node_server["HTTP server<br/>[main.go]"]
  node_api["HTTP API<br/>[app.go]"]
end

subgraph group_accounts["Accounts and auth"]
  node_account_handlers["Account APIs<br/>[account_status.go]"]
  node_auth_api["Login and users<br/>[auth.go]"]
  node_auth_store[("User sessions<br/>[store.go]")]
  node_account_store[("Account store<br/>[store.go]")]
  node_qr["QR login<br/>[qr.go]"]
  node_proxy_api["Proxy settings<br/>[proxy_profiles.go]"]
  node_proxy_store[("Proxy profiles<br/>[proxy_profiles.go]")]
  node_keepalive["Credential renewal<br/>[keepalive.go]"]
end

subgraph group_protocol["WeChat protocol"]
  node_oauth["OAuth URL<br/>[authorize.go]"]
  node_protocol_api["Protocol endpoints<br/>[app.go]"]
  node_login_buffer["Login buffers<br/>[loginbuffer.go]"]
  node_mmtls["MMTLS transport<br/>[mmtls_client.go]"]
end

subgraph group_automation["Automation and panels"]
  node_panel_api["Panel integration<br/>[panel.go]"]
  node_panel_manager["Panel drivers<br/>[panel_manager.go]"]
  node_scripts["Account scripts"]
  node_runs["Run management<br/>[runs.go]"]
  node_run_store[("Run records<br/>[runs.go]")]
end

subgraph group_operations["Operations"]
  node_maintenance["Maintenance API<br/>[maintenance.go]"]
  node_maint_agent["Host maintenance agent<br/>[agent.py]"]
  node_version["Version checks<br/>[version.go]"]
end

node_operator(("Browser user"))
node_wechat(("WeChat services"))
node_external_panel(("QL / Daidai / Arcadia"))

node_operator -->|"uses console"| node_server
node_server -->|"creates app"| node_api
node_api -->|"starts QR login"| node_qr
node_qr -->|"fetches credentials"| node_login_buffer
node_login_buffer -->|"uses transport"| node_mmtls
node_mmtls -->|"sends protocol"| node_wechat
node_api -->|"serves protocol calls"| node_wechat
node_api -->|"builds OAuth URL"| node_oauth
node_api -->|"routes account requests"| node_account_handlers
node_account_handlers -->|"reads and writes accounts"| node_account_store
node_api -->|"routes auth requests"| node_auth_api
node_auth_api -->|"manages users and sessions"| node_auth_store
node_proxy_api -->|"stores proxy settings"| node_proxy_store
node_keepalive -->|"renews account credentials"| node_account_store
node_panel_api -->|"delegates panel actions"| node_panel_manager
node_panel_manager -->|"calls panel API"| node_external_panel
node_external_panel -.->|"pulls scripts"| node_scripts
node_runs -->|"manages panel tasks"| node_panel_manager
node_runs -->|"stores run data"| node_run_store
node_maintenance -.->|"submits maintenance jobs"| node_maint_agent
node_api -->|"serves version checks"| node_version

click node_server "https://github.com/525815266/yyb-go-enhanced/blob/main/cmd/yyb-go/main.go"
click node_api "https://github.com/525815266/yyb-go-enhanced/blob/main/internal/httpapi/app.go"
click node_account_handlers "https://github.com/525815266/yyb-go-enhanced/blob/main/internal/httpapi/account_status.go"
click node_auth_api "https://github.com/525815266/yyb-go-enhanced/blob/main/internal/httpapi/auth.go"
click node_auth_store "https://github.com/525815266/yyb-go-enhanced/blob/main/internal/auth/store.go"
click node_account_store "https://github.com/525815266/yyb-go-enhanced/blob/main/internal/store/store.go"
click node_qr "https://github.com/525815266/yyb-go-enhanced/blob/main/internal/qr/qr.go"
click node_oauth "https://github.com/525815266/yyb-go-enhanced/blob/main/internal/oauth/authorize.go"
click node_protocol_api "https://github.com/525815266/yyb-go-enhanced/blob/main/internal/httpapi/app.go"
click node_login_buffer "https://github.com/525815266/yyb-go-enhanced/blob/main/internal/protocol/loginbuffer.go"
click node_mmtls "https://github.com/525815266/yyb-go-enhanced/blob/main/internal/protocol/mmtls_client.go"
click node_proxy_api "https://github.com/525815266/yyb-go-enhanced/blob/main/internal/httpapi/proxy_profiles.go"
click node_proxy_store "https://github.com/525815266/yyb-go-enhanced/blob/main/internal/store/proxy_profiles.go"
click node_keepalive "https://github.com/525815266/yyb-go-enhanced/blob/main/internal/httpapi/keepalive.go"
click node_panel_api "https://github.com/525815266/yyb-go-enhanced/blob/main/internal/httpapi/panel.go"
click node_panel_manager "https://github.com/525815266/yyb-go-enhanced/blob/main/internal/httpapi/panel_manager.go"
click node_scripts "https://github.com/525815266/yyb-go-enhanced/tree/main/scripts"
click node_runs "https://github.com/525815266/yyb-go-enhanced/blob/main/internal/httpapi/runs.go"
click node_run_store "https://github.com/525815266/yyb-go-enhanced/blob/main/internal/store/runs.go"
click node_maintenance "https://github.com/525815266/yyb-go-enhanced/blob/main/internal/httpapi/maintenance.go"
click node_maint_agent "https://github.com/525815266/yyb-go-enhanced/blob/main/packaging/maintenance/agent.py"
click node_version "https://github.com/525815266/yyb-go-enhanced/blob/main/internal/httpapi/version.go"

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_server,node_api,node_operator toneBlue
class node_account_handlers,node_auth_api,node_auth_store,node_account_store,node_qr,node_proxy_api,node_proxy_store,node_keepalive toneAmber
class node_oauth,node_protocol_api,node_login_buffer,node_mmtls toneMint
class node_panel_api,node_panel_manager,node_scripts,node_runs,node_run_store toneRose
class node_maintenance,node_maint_agent,node_version,node_wechat,node_external_panel toneIndigo
```

## Components

### Web service

- [HTTP server](https://github.com/525815266/yyb-go-enhanced/blob/main/cmd/yyb-go/main.go): `cmd/yyb-go/main.go`
- [HTTP API](https://github.com/525815266/yyb-go-enhanced/blob/main/internal/httpapi/app.go): `internal/httpapi/app.go`

### Accounts and auth

- [Account APIs](https://github.com/525815266/yyb-go-enhanced/blob/main/internal/httpapi/account_status.go): `internal/httpapi/account_status.go`
- [Login and users](https://github.com/525815266/yyb-go-enhanced/blob/main/internal/httpapi/auth.go): `internal/httpapi/auth.go`
- [User sessions](https://github.com/525815266/yyb-go-enhanced/blob/main/internal/auth/store.go): `internal/auth/store.go`
- [Account store](https://github.com/525815266/yyb-go-enhanced/blob/main/internal/store/store.go): `internal/store/store.go`
- [QR login](https://github.com/525815266/yyb-go-enhanced/blob/main/internal/qr/qr.go): `internal/qr/qr.go`
- [Proxy settings](https://github.com/525815266/yyb-go-enhanced/blob/main/internal/httpapi/proxy_profiles.go): `internal/httpapi/proxy_profiles.go`
- [Proxy profiles](https://github.com/525815266/yyb-go-enhanced/blob/main/internal/store/proxy_profiles.go): `internal/store/proxy_profiles.go`
- [Credential renewal](https://github.com/525815266/yyb-go-enhanced/blob/main/internal/httpapi/keepalive.go): `internal/httpapi/keepalive.go`

### WeChat protocol

- [OAuth URL](https://github.com/525815266/yyb-go-enhanced/blob/main/internal/oauth/authorize.go): `internal/oauth/authorize.go`
- [Protocol endpoints](https://github.com/525815266/yyb-go-enhanced/blob/main/internal/httpapi/app.go): `internal/httpapi/app.go`
- [Login buffers](https://github.com/525815266/yyb-go-enhanced/blob/main/internal/protocol/loginbuffer.go): `internal/protocol/loginbuffer.go`
- [MMTLS transport](https://github.com/525815266/yyb-go-enhanced/blob/main/internal/protocol/mmtls_client.go): `internal/protocol/mmtls_client.go`

### Automation and panels

- [Panel integration](https://github.com/525815266/yyb-go-enhanced/blob/main/internal/httpapi/panel.go): `internal/httpapi/panel.go`
- [Panel drivers](https://github.com/525815266/yyb-go-enhanced/blob/main/internal/httpapi/panel_manager.go): `internal/httpapi/panel_manager.go`
- [Account scripts](https://github.com/525815266/yyb-go-enhanced/tree/main/scripts): `scripts`
- [Run management](https://github.com/525815266/yyb-go-enhanced/blob/main/internal/httpapi/runs.go): `internal/httpapi/runs.go`
- [Run records](https://github.com/525815266/yyb-go-enhanced/blob/main/internal/store/runs.go): `internal/store/runs.go`

### Operations

- [Maintenance API](https://github.com/525815266/yyb-go-enhanced/blob/main/internal/httpapi/maintenance.go): `internal/httpapi/maintenance.go`
- [Host maintenance agent](https://github.com/525815266/yyb-go-enhanced/blob/main/packaging/maintenance/agent.py): `packaging/maintenance/agent.py`
- [Version checks](https://github.com/525815266/yyb-go-enhanced/blob/main/internal/httpapi/version.go): `internal/httpapi/version.go`

### Other components

- **Browser user**
- **WeChat services**
- **QL / Daidai / Arcadia**

## Connections

- Browser user → HTTP server: uses console
- HTTP server → HTTP API: creates app
- HTTP API → QR login: starts QR login
- QR login → Login buffers: fetches credentials
- Login buffers → MMTLS transport: uses transport
- MMTLS transport → WeChat services: sends protocol
- HTTP API → WeChat services: serves protocol calls
- HTTP API → OAuth URL: builds OAuth URL
- HTTP API → Account APIs: routes account requests
- Account APIs → Account store: reads and writes accounts
- HTTP API → Login and users: routes auth requests
- Login and users → User sessions: manages users and sessions
- Proxy settings → Proxy profiles: stores proxy settings
- Credential renewal → Account store: renews account credentials
- Panel integration → Panel drivers: delegates panel actions
- Panel drivers → QL / Daidai / Arcadia: calls panel API
- QL / Daidai / Arcadia → Account scripts: pulls scripts
- Run management → Panel drivers: manages panel tasks
- Run management → Run records: stores run data
- Maintenance API → Host maintenance agent: submits maintenance jobs
- HTTP API → Version checks: serves version checks
