# corced/pacar-cina architecture

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

- Interactive diagram: https://gitdiagram.com/corced/pacar-cina
- Repository: https://github.com/corced/pacar-cina

## Overview

This is a zero-dependency browser minter and API hub: partners sign in, keep the minter page open, and return captcha solutions to a shared pool; other roles inspect status or use the chat API. The graph preserves the documented people/key administration, token donation, and address-reporting capabilities. Several hub internals and page scripts were not sampled, so relationships for those features rely on README statements rather than claims of source inspection.

Main entry points: [`server/hub.mjs`](https://github.com/corced/pacar-cina/blob/main/server/hub.mjs) (HTTP hub), [`public/minter.js`](https://github.com/corced/pacar-cina/blob/main/public/minter.js) (Captcha minter), [`public/glm-client.js`](https://github.com/corced/pacar-cina/blob/main/public/glm-client.js) (Captcha client), [`public/admin.js`](https://github.com/corced/pacar-cina/blob/main/public/admin.js) (Admin panel)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_browser["Browser pages"]
  node_login["Role sign-in<br/>[roles.js]"]
  node_minter["Captcha minter<br/>[minter.js]"]
  node_captcha_client["Captcha client<br/>[glm-client.js]"]
  node_partner_page["Partner page<br/>[partner.html]"]
  node_admin_panel["Admin panel<br/>[admin.js]"]
  node_user_report["Address report<br/>[user.js]"]
  node_chat_page["Chat page<br/>[chat.js]"]
  node_repos_page["Reference review<br/>[repos.html]"]
end

subgraph group_hub["Hub runtime"]
  node_hub["HTTP hub<br/>[hub.mjs]"]
  node_websocket["WebSocket transport<br/>[ws.mjs]"]
  node_identity["Identity and sessions<br/>[hub.mjs]"]
end

subgraph group_state["Hub state"]
  node_mint_pool[("Mint job pool<br/>[hub.mjs]")]
  node_token_pool[("Token ledger<br/>[hub.mjs]")]
  node_people_directory[("People directory<br/>[hub.mjs]")]
  node_chat_ledger[("Conversation ledger<br/>[hub.mjs]")]
end

subgraph group_external["External services"]
  node_aliyun{{"Aliyun captcha"}}
  node_glm_upstream{{"GLM upstream"}}
end

node_partner(("Partner"))
node_operator(("Operator"))
node_signed_user(("Signed-in user"))

node_partner -->|"signs in"| node_login
node_operator -->|"signs in"| node_login
node_login -->|"submits credentials"| node_hub
node_hub -->|"checks roles"| node_identity
node_identity -->|"checks keys"| node_people_directory
node_hub -->|"uses transport"| node_websocket
node_partner -->|"opens"| node_partner_page
node_partner -->|"opens"| node_minter
node_minter -->|"opens mint socket"| node_hub
node_minter -->|"requests mint"| node_captcha_client
node_captcha_client -->|"loads settings"| node_hub
node_captcha_client -->|"runs widget"| node_aliyun
node_hub -->|"dispatches jobs"| node_mint_pool
node_mint_pool -->|"tracks contributions"| node_partner_page
node_hub -->|"records donations"| node_token_pool
node_partner_page -->|"submits tokens"| node_hub
node_hub -->|"verifies tokens"| node_aliyun
node_operator -->|"operates"| node_admin_panel
node_admin_panel -->|"polls and configures"| node_hub
node_admin_panel -->|"manages people"| node_people_directory
node_signed_user -->|"views address"| node_user_report
node_user_report -->|"requests status"| node_hub
node_signed_user -->|"sends turns"| node_chat_page
node_chat_page -->|"requests chat"| node_hub
node_hub -->|"continues conversations"| node_chat_ledger
node_hub -->|"forwards completions"| node_glm_upstream
node_signed_user -->|"reviews references"| node_repos_page

click node_login "https://github.com/corced/pacar-cina/blob/main/public/roles.js"
click node_minter "https://github.com/corced/pacar-cina/blob/main/public/minter.js"
click node_captcha_client "https://github.com/corced/pacar-cina/blob/main/public/glm-client.js"
click node_partner_page "https://github.com/corced/pacar-cina/blob/main/public/partner.html"
click node_admin_panel "https://github.com/corced/pacar-cina/blob/main/public/admin.js"
click node_user_report "https://github.com/corced/pacar-cina/blob/main/public/user.js"
click node_chat_page "https://github.com/corced/pacar-cina/blob/main/public/chat.js"
click node_repos_page "https://github.com/corced/pacar-cina/blob/main/public/repos.html"
click node_hub "https://github.com/corced/pacar-cina/blob/main/server/hub.mjs"
click node_websocket "https://github.com/corced/pacar-cina/blob/main/server/ws.mjs"
click node_identity "https://github.com/corced/pacar-cina/blob/main/server/hub.mjs"
click node_mint_pool "https://github.com/corced/pacar-cina/blob/main/server/hub.mjs"
click node_token_pool "https://github.com/corced/pacar-cina/blob/main/server/hub.mjs"
click node_people_directory "https://github.com/corced/pacar-cina/blob/main/server/hub.mjs"
click node_chat_ledger "https://github.com/corced/pacar-cina/blob/main/server/hub.mjs"

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_login,node_minter,node_captcha_client,node_partner_page,node_admin_panel,node_user_report,node_chat_page,node_repos_page,node_signed_user toneBlue
class node_hub,node_websocket,node_identity toneAmber
class node_mint_pool,node_token_pool,node_people_directory,node_chat_ledger toneMint
class node_aliyun,node_glm_upstream toneRose
class node_partner,node_operator toneIndigo
```

## Components

### Browser pages

- [Role sign-in](https://github.com/corced/pacar-cina/blob/main/public/roles.js): `public/roles.js`
- [Captcha minter](https://github.com/corced/pacar-cina/blob/main/public/minter.js): `public/minter.js`
- [Captcha client](https://github.com/corced/pacar-cina/blob/main/public/glm-client.js): `public/glm-client.js`
- [Partner page](https://github.com/corced/pacar-cina/blob/main/public/partner.html): `public/partner.html`
- [Admin panel](https://github.com/corced/pacar-cina/blob/main/public/admin.js): `public/admin.js`
- [Address report](https://github.com/corced/pacar-cina/blob/main/public/user.js): `public/user.js`
- [Chat page](https://github.com/corced/pacar-cina/blob/main/public/chat.js): `public/chat.js`
- [Reference review](https://github.com/corced/pacar-cina/blob/main/public/repos.html): `public/repos.html`

### Hub runtime

- [HTTP hub](https://github.com/corced/pacar-cina/blob/main/server/hub.mjs): `server/hub.mjs`
- [WebSocket transport](https://github.com/corced/pacar-cina/blob/main/server/ws.mjs): `server/ws.mjs`
- [Identity and sessions](https://github.com/corced/pacar-cina/blob/main/server/hub.mjs): `server/hub.mjs`

### Hub state

- [Mint job pool](https://github.com/corced/pacar-cina/blob/main/server/hub.mjs): `server/hub.mjs`
- [Token ledger](https://github.com/corced/pacar-cina/blob/main/server/hub.mjs): `server/hub.mjs`
- [People directory](https://github.com/corced/pacar-cina/blob/main/server/hub.mjs): `server/hub.mjs`
- [Conversation ledger](https://github.com/corced/pacar-cina/blob/main/server/hub.mjs): `server/hub.mjs`

### External services

- **Aliyun captcha**
- **GLM upstream**

### Other components

- **Partner**
- **Operator**
- **Signed-in user**

## Connections

- Partner → Role sign-in: signs in (evidence: `README.md`)
- Operator → Role sign-in: signs in (evidence: `README.md`)
- Role sign-in → HTTP hub: submits credentials (evidence: `README.md`)
- HTTP hub → Identity and sessions: checks roles (evidence: `README.md`)
- Identity and sessions → People directory: checks keys (evidence: `README.md`)
- HTTP hub → WebSocket transport: uses transport (evidence: `server/hub.mjs`)
- Partner → Partner page: opens (evidence: `README.md`)
- Partner → Captcha minter: opens (evidence: `README.md`)
- Captcha minter → HTTP hub: opens mint socket (evidence: `README.md`)
- Captcha minter → Captcha client: requests mint (evidence: `README.md`)
- Captcha client → HTTP hub: loads settings (evidence: `public/glm-client.js`)
- Captcha client → Aliyun captcha: runs widget (evidence: `README.md`)
- HTTP hub → Mint job pool: dispatches jobs (evidence: `README.md`)
- Mint job pool → Partner page: tracks contributions (evidence: `README.md`)
- HTTP hub → Token ledger: records donations (evidence: `README.md`)
- Partner page → HTTP hub: submits tokens (evidence: `README.md`)
- HTTP hub → Aliyun captcha: verifies tokens (evidence: `README.md`)
- Operator → Admin panel: operates (evidence: `README.md`)
- Admin panel → HTTP hub: polls and configures (evidence: `README.md`)
- Admin panel → People directory: manages people (evidence: `README.md`)
- Signed-in user → Address report: views address (evidence: `README.md`)
- Address report → HTTP hub: requests status (evidence: `README.md`)
- Signed-in user → Chat page: sends turns (evidence: `README.md`)
- Chat page → HTTP hub: requests chat (evidence: `README.md`)
- HTTP hub → Conversation ledger: continues conversations (evidence: `README.md`)
- HTTP hub → GLM upstream: forwards completions (evidence: `README.md`)
- Signed-in user → Reference review: reviews references (evidence: `README.md`)
