# azhi-xinxin/tech-hub architecture

> Architecture diagram of the GitHub repository azhi-xinxin/tech-hub, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/azhi-xinxin/tech-hub
- Repository: https://github.com/azhi-xinxin/tech-hub

## Overview

tech-hub is a persistent collaboration bus and task ledger for humans and AI agents. The main workflow is a person posting chat or creating work, the hub recording events, agents being notified or claiming tasks, and results returning to the shared room or task view. The single-file hub also documents attachments, approvals, folding, and a browser UI; the Android app and MCP server are optional clients, while workers provide task execution. The hub source was read but not excerpted, so internal feature links rely on README documentation; unsampled implementation details are not inferred.

Main entry points: [`hub.py`](https://github.com/azhi-xinxin/tech-hub/blob/main/hub.py) (Hub API), [`tech-hub-apk/app/src/main/java/com/azhix/techhub/UnreadPollingService.kt`](https://github.com/azhi-xinxin/tech-hub/blob/main/tech-hub-apk/app/src/main/java/com/azhix/techhub/UnreadPollingService.kt) (Unread poller), [`tech-hub-apk/app/src/main/java/com/azhix/techhub/HubApi.kt`](https://github.com/azhi-xinxin/tech-hub/blob/main/tech-hub-apk/app/src/main/java/com/azhix/techhub/HubApi.kt) (Android API), [`tech-hub-apk/app/src/main/java/com/azhix/techhub/MainActivity.kt`](https://github.com/azhi-xinxin/tech-hub/blob/main/tech-hub-apk/app/src/main/java/com/azhix/techhub/MainActivity.kt) (Android shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_hub["Hub service"]
  node_api["Hub API<br/>[hub.py]"]
  node_store[("SQLite store<br/>[hub.py]")]
end

subgraph group_collab["Chat and inbox"]
  node_browser["Browser UI<br/>[hub.py]"]
  node_messages["Room messages<br/>[hub.py]"]
  node_sentinel["Doorbell poll<br/>[hub.py]"]
  node_attachments["Attachments<br/>[hub.py]"]
  node_folds["Fold history<br/>[hub.py]"]
end

subgraph group_ledger["Task ledger"]
  node_tasks["Task ledger<br/>[hub.py]"]
  node_approvals["Human approvals<br/>[hub.py]"]
end

subgraph group_clients["Agent clients"]
  node_codex["Codex worker<br/>[codex_worker.py]"]
  node_dsh["DSH worker<br/>[dsh_worker.py]"]
  node_mcp["MCP adapter<br/>[server.py]"]
end

subgraph group_android["Android app"]
  node_apk["Android shell<br/>[MainActivity.kt]"]
  node_poller["Unread poller"]
  node_android_api["Android API<br/>[HubApi.kt]"]
  node_config["Hub settings<br/>[HubConfig.kt]"]
  node_tokens["Token vault"]
  node_notifications["Notifications"]
  node_boot["Boot receiver<br/>[BootReceiver.kt]"]
end

node_human(("Human"))
node_agent(("AI agents"))

node_human -->|"uses"| node_browser
node_browser -->|"sends requests"| node_api
node_agent -->|"uses API"| node_api
node_api -->|"routes chat"| node_messages
node_api -->|"routes tasks"| node_tasks
node_api -->|"routes polls"| node_sentinel
node_api -->|"routes files"| node_attachments
node_api -->|"routes folds"| node_folds
node_api -->|"routes approvals"| node_approvals
node_api -->|"persists events"| node_store
node_codex -.->|"claims and reports"| node_api
node_dsh -->|"claims and reports"| node_api
node_mcp -->|"calls HTTP API"| node_api
node_apk -->|"authenticates and loads"| node_android_api
node_apk -->|"starts polling"| node_poller
node_poller -->|"fetches messages"| node_android_api
node_android_api -->|"calls HTTP API"| node_api
node_poller -->|"reads and saves cursor"| node_config
node_poller -->|"shows unread"| node_notifications
node_config -->|"stores token"| node_tokens
node_boot -->|"starts on boot"| node_poller

click node_browser "https://github.com/azhi-xinxin/tech-hub/blob/main/hub.py"
click node_api "https://github.com/azhi-xinxin/tech-hub/blob/main/hub.py"
click node_store "https://github.com/azhi-xinxin/tech-hub/blob/main/hub.py"
click node_messages "https://github.com/azhi-xinxin/tech-hub/blob/main/hub.py"
click node_sentinel "https://github.com/azhi-xinxin/tech-hub/blob/main/hub.py"
click node_attachments "https://github.com/azhi-xinxin/tech-hub/blob/main/hub.py"
click node_folds "https://github.com/azhi-xinxin/tech-hub/blob/main/hub.py"
click node_tasks "https://github.com/azhi-xinxin/tech-hub/blob/main/hub.py"
click node_approvals "https://github.com/azhi-xinxin/tech-hub/blob/main/hub.py"
click node_codex "https://github.com/azhi-xinxin/tech-hub/blob/main/tech-hub-worker/codex_worker.py"
click node_dsh "https://github.com/azhi-xinxin/tech-hub/blob/main/dsh_worker.py"
click node_mcp "https://github.com/azhi-xinxin/tech-hub/blob/main/tech-hub-mcp/server.py"
click node_apk "https://github.com/azhi-xinxin/tech-hub/blob/main/tech-hub-apk/app/src/main/java/com/azhix/techhub/MainActivity.kt"
click node_poller "https://github.com/azhi-xinxin/tech-hub/blob/main/tech-hub-apk/app/src/main/java/com/azhix/techhub/UnreadPollingService.kt"
click node_android_api "https://github.com/azhi-xinxin/tech-hub/blob/main/tech-hub-apk/app/src/main/java/com/azhix/techhub/HubApi.kt"
click node_config "https://github.com/azhi-xinxin/tech-hub/blob/main/tech-hub-apk/app/src/main/java/com/azhix/techhub/HubConfig.kt"
click node_tokens "https://github.com/azhi-xinxin/tech-hub/blob/main/tech-hub-apk/app/src/main/java/com/azhix/techhub/SecureTokenStore.kt"
click node_notifications "https://github.com/azhi-xinxin/tech-hub/blob/main/tech-hub-apk/app/src/main/java/com/azhix/techhub/NotificationHelper.kt"
click node_boot "https://github.com/azhi-xinxin/tech-hub/blob/main/tech-hub-apk/app/src/main/java/com/azhix/techhub/BootReceiver.kt"

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_api,node_store toneBlue
class node_browser,node_messages,node_sentinel,node_attachments,node_folds toneAmber
class node_tasks,node_approvals toneMint
class node_codex,node_dsh,node_mcp toneRose
class node_apk,node_poller,node_android_api,node_config,node_tokens,node_notifications,node_boot,node_human,node_agent toneIndigo
```

## Components

### Hub service

- [Hub API](https://github.com/azhi-xinxin/tech-hub/blob/main/hub.py): `hub.py`
- [SQLite store](https://github.com/azhi-xinxin/tech-hub/blob/main/hub.py): `hub.py`

### Chat and inbox

- [Browser UI](https://github.com/azhi-xinxin/tech-hub/blob/main/hub.py): `hub.py`
- [Room messages](https://github.com/azhi-xinxin/tech-hub/blob/main/hub.py): `hub.py`
- [Doorbell poll](https://github.com/azhi-xinxin/tech-hub/blob/main/hub.py): `hub.py`
- [Attachments](https://github.com/azhi-xinxin/tech-hub/blob/main/hub.py): `hub.py`
- [Fold history](https://github.com/azhi-xinxin/tech-hub/blob/main/hub.py): `hub.py`

### Task ledger

- [Task ledger](https://github.com/azhi-xinxin/tech-hub/blob/main/hub.py): `hub.py`
- [Human approvals](https://github.com/azhi-xinxin/tech-hub/blob/main/hub.py): `hub.py`

### Agent clients

- [Codex worker](https://github.com/azhi-xinxin/tech-hub/blob/main/tech-hub-worker/codex_worker.py): `tech-hub-worker/codex_worker.py`
- [DSH worker](https://github.com/azhi-xinxin/tech-hub/blob/main/dsh_worker.py): `dsh_worker.py`
- [MCP adapter](https://github.com/azhi-xinxin/tech-hub/blob/main/tech-hub-mcp/server.py): `tech-hub-mcp/server.py`

### Android app

- [Android shell](https://github.com/azhi-xinxin/tech-hub/blob/main/tech-hub-apk/app/src/main/java/com/azhix/techhub/MainActivity.kt): `tech-hub-apk/app/src/main/java/com/azhix/techhub/MainActivity.kt`
- [Unread poller](https://github.com/azhi-xinxin/tech-hub/blob/main/tech-hub-apk/app/src/main/java/com/azhix/techhub/UnreadPollingService.kt): `tech-hub-apk/app/src/main/java/com/azhix/techhub/UnreadPollingService.kt`
- [Android API](https://github.com/azhi-xinxin/tech-hub/blob/main/tech-hub-apk/app/src/main/java/com/azhix/techhub/HubApi.kt): `tech-hub-apk/app/src/main/java/com/azhix/techhub/HubApi.kt`
- [Hub settings](https://github.com/azhi-xinxin/tech-hub/blob/main/tech-hub-apk/app/src/main/java/com/azhix/techhub/HubConfig.kt): `tech-hub-apk/app/src/main/java/com/azhix/techhub/HubConfig.kt`
- [Token vault](https://github.com/azhi-xinxin/tech-hub/blob/main/tech-hub-apk/app/src/main/java/com/azhix/techhub/SecureTokenStore.kt): `tech-hub-apk/app/src/main/java/com/azhix/techhub/SecureTokenStore.kt`
- [Notifications](https://github.com/azhi-xinxin/tech-hub/blob/main/tech-hub-apk/app/src/main/java/com/azhix/techhub/NotificationHelper.kt): `tech-hub-apk/app/src/main/java/com/azhix/techhub/NotificationHelper.kt`
- [Boot receiver](https://github.com/azhi-xinxin/tech-hub/blob/main/tech-hub-apk/app/src/main/java/com/azhix/techhub/BootReceiver.kt): `tech-hub-apk/app/src/main/java/com/azhix/techhub/BootReceiver.kt`

### Other components

- **Human**
- **AI agents**

## Connections

- Human → Browser UI: uses (evidence: `README.md`)
- Browser UI → Hub API: sends requests (evidence: `README.md`)
- AI agents → Hub API: uses API (evidence: `README.md`)
- Hub API → Room messages: routes chat (evidence: `README.md`)
- Hub API → Task ledger: routes tasks (evidence: `README.md`)
- Hub API → Doorbell poll: routes polls (evidence: `README.md`)
- Hub API → Attachments: routes files (evidence: `README.md`)
- Hub API → Fold history: routes folds (evidence: `README.md`)
- Hub API → Human approvals: routes approvals (evidence: `README.md`)
- Hub API → SQLite store: persists events (evidence: `README.md`)
- Codex worker → Hub API: claims and reports
- DSH worker → Hub API: claims and reports (evidence: `dsh_worker.py`)
- MCP adapter → Hub API: calls HTTP API (evidence: `tech-hub-mcp/server.py`)
- Android shell → Android API: authenticates and loads (evidence: `tech-hub-apk/app/src/main/java/com/azhix/techhub/MainActivity.kt`)
- Android shell → Unread poller: starts polling (evidence: `tech-hub-apk/app/src/main/java/com/azhix/techhub/MainActivity.kt`)
- Unread poller → Android API: fetches messages (evidence: `tech-hub-apk/app/src/main/java/com/azhix/techhub/UnreadPollingService.kt`)
- Android API → Hub API: calls HTTP API (evidence: `README.md`)
- Unread poller → Hub settings: reads and saves cursor (evidence: `tech-hub-apk/app/src/main/java/com/azhix/techhub/UnreadPollingService.kt`)
- Unread poller → Notifications: shows unread (evidence: `tech-hub-apk/app/src/main/java/com/azhix/techhub/UnreadPollingService.kt`)
- Hub settings → Token vault: stores token (evidence: `tech-hub-apk/app/src/main/java/com/azhix/techhub/HubConfig.kt`)
- Boot receiver → Unread poller: starts on boot (evidence: `tech-hub-apk/app/src/main/java/com/azhix/techhub/BootReceiver.kt`)
