# hongyime/unifiedcollector architecture

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

- Interactive diagram: https://gitdiagram.com/hongyime/unifiedcollector
- Repository: https://github.com/hongyime/unifiedcollector

## Overview

UnifiedCollector is a read-only, multi-platform social-data ingestion service. Its principal workflow is platform collection—through native collectors or the logged-in-browser extension—followed by ingestion and persistence in shared PostgreSQL; operators inspect collection and media status in the dashboard. The repository also includes scheduled operations, Telegram control/notifications, and WhatsApp and Instagram/browser bridges. The README establishes the product-level workflow and capabilities; source excerpts clarify the browser-ingest path. Several internal links are omitted or marked unverified where implementation wiring was not shown.

Main entry points: [`src/db/connection.py`](https://github.com/hongyime/unifiedcollector/blob/main/src/db/connection.py) (PostgreSQL), [`src/collectors`](https://github.com/hongyime/unifiedcollector/tree/main/src/collectors) (Platform collectors), [`src/dashboard/api`](https://github.com/hongyime/unifiedcollector/tree/main/src/dashboard/api) (Dashboard API), [`src/scheduler/startup.py`](https://github.com/hongyime/unifiedcollector/blob/main/src/scheduler/startup.py) (Scheduler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_collection["Collection"]
  node_worker["Collection worker<br/>[__init__.py]"]
  node_collectors["Platform collectors"]
  node_browser["Browser extension<br/>[content.ts]"]
end

subgraph group_ingest["Ingestion bridges"]
  node_igbridge["Social ingest bridge<br/>[app.py]"]
  node_wa_bridge["WhatsApp bridge<br/>[index.ts]"]
  node_ingest_handlers["Browser ingest handlers<br/>[_browser_ingest.py]"]
end

subgraph group_platform["Operations and integrations"]
  node_scheduler["Scheduler<br/>[startup.py]"]
  node_control_bot["Control bot<br/>[collector_bot.py]"]
  node_realtime["Realtime feeds<br/>[realtime_feed.py]"]
end

subgraph group_observe["Storage and dashboard"]
  node_db[("PostgreSQL<br/>[connection.py]")]
  node_migrations["Schema migrations<br/>[migrate.py]"]
  node_dashboard_api["Dashboard API"]
  node_dashboard_ui["Dashboard UI<br/>[App.tsx]"]
end

node_operator(("Operator"))
node_platforms(("Social platforms"))

node_operator -->|"inspects status"| node_dashboard_ui
node_platforms -->|"provides source data"| node_collectors
node_worker -.->|"runs collection"| node_collectors
node_collectors -->|"writes collected data"| node_db
node_platforms -->|"logged-in access"| node_browser
node_browser -->|"sends scraped data"| node_igbridge
node_igbridge -->|"routes ingest"| node_ingest_handlers
node_ingest_handlers -->|"persists media"| node_db
node_wa_bridge -.->|"forwards collected data"| node_db
node_scheduler -.->|"dispatches work"| node_worker
node_scheduler -.->|"runs scheduled operations"| node_db
node_control_bot -->|"uses control routes"| node_dashboard_api
node_realtime -.->|"reads feed data"| node_db
node_migrations -->|"applies schema"| node_db
node_dashboard_ui -.->|"requests dashboard data"| node_dashboard_api
node_dashboard_api -.->|"queries status and records"| node_db

click node_worker "https://github.com/hongyime/unifiedcollector/blob/main/src/worker/__init__.py"
click node_collectors "https://github.com/hongyime/unifiedcollector/tree/main/src/collectors"
click node_browser "https://github.com/hongyime/unifiedcollector/blob/main/extension/src/content.ts"
click node_igbridge "https://github.com/hongyime/unifiedcollector/blob/main/src/bridges/ig_ingest/app.py"
click node_wa_bridge "https://github.com/hongyime/unifiedcollector/blob/main/src/bridges/whatsapp/src/index.ts"
click node_ingest_handlers "https://github.com/hongyime/unifiedcollector/blob/main/src/bridges/ig_ingest/_browser_ingest.py"
click node_scheduler "https://github.com/hongyime/unifiedcollector/blob/main/src/scheduler/startup.py"
click node_control_bot "https://github.com/hongyime/unifiedcollector/blob/main/src/notifications/collector_bot.py"
click node_realtime "https://github.com/hongyime/unifiedcollector/blob/main/src/notifications/realtime_feed.py"
click node_db "https://github.com/hongyime/unifiedcollector/blob/main/src/db/connection.py"
click node_migrations "https://github.com/hongyime/unifiedcollector/blob/main/src/db/migrate.py"
click node_dashboard_api "https://github.com/hongyime/unifiedcollector/tree/main/src/dashboard/api"
click node_dashboard_ui "https://github.com/hongyime/unifiedcollector/blob/main/src/dashboard/frontend/src/App.tsx"

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_worker,node_collectors,node_browser toneBlue
class node_igbridge,node_wa_bridge,node_ingest_handlers toneAmber
class node_scheduler,node_control_bot,node_realtime toneMint
class node_db,node_migrations,node_dashboard_api,node_dashboard_ui toneRose
class node_operator,node_platforms toneIndigo
```

## Components

### Collection

- [Collection worker](https://github.com/hongyime/unifiedcollector/blob/main/src/worker/__init__.py): `src/worker/__init__.py`
- [Platform collectors](https://github.com/hongyime/unifiedcollector/tree/main/src/collectors): `src/collectors`
- [Browser extension](https://github.com/hongyime/unifiedcollector/blob/main/extension/src/content.ts): `extension/src/content.ts`

### Ingestion bridges

- [Social ingest bridge](https://github.com/hongyime/unifiedcollector/blob/main/src/bridges/ig_ingest/app.py): `src/bridges/ig_ingest/app.py`
- [WhatsApp bridge](https://github.com/hongyime/unifiedcollector/blob/main/src/bridges/whatsapp/src/index.ts): `src/bridges/whatsapp/src/index.ts`
- [Browser ingest handlers](https://github.com/hongyime/unifiedcollector/blob/main/src/bridges/ig_ingest/_browser_ingest.py): `src/bridges/ig_ingest/_browser_ingest.py`

### Operations and integrations

- [Scheduler](https://github.com/hongyime/unifiedcollector/blob/main/src/scheduler/startup.py): `src/scheduler/startup.py`
- [Control bot](https://github.com/hongyime/unifiedcollector/blob/main/src/notifications/collector_bot.py): `src/notifications/collector_bot.py`
- [Realtime feeds](https://github.com/hongyime/unifiedcollector/blob/main/src/notifications/realtime_feed.py): `src/notifications/realtime_feed.py`

### Storage and dashboard

- [PostgreSQL](https://github.com/hongyime/unifiedcollector/blob/main/src/db/connection.py): `src/db/connection.py`
- [Schema migrations](https://github.com/hongyime/unifiedcollector/blob/main/src/db/migrate.py): `src/db/migrate.py`
- [Dashboard API](https://github.com/hongyime/unifiedcollector/tree/main/src/dashboard/api): `src/dashboard/api`
- [Dashboard UI](https://github.com/hongyime/unifiedcollector/blob/main/src/dashboard/frontend/src/App.tsx): `src/dashboard/frontend/src/App.tsx`

### Other components

- **Operator**
- **Social platforms**

## Connections

- Operator → Dashboard UI: inspects status (evidence: `README.md`)
- Social platforms → Platform collectors: provides source data (evidence: `README.md`)
- Collection worker → Platform collectors: runs collection (evidence: `src/worker/__init__.py`)
- Platform collectors → PostgreSQL: writes collected data (evidence: `README.md`)
- Social platforms → Browser extension: logged-in access (evidence: `README.md`)
- Browser extension → Social ingest bridge: sends scraped data (evidence: `README.md`)
- Social ingest bridge → Browser ingest handlers: routes ingest (evidence: `src/bridges/ig_ingest/app.py`)
- Browser ingest handlers → PostgreSQL: persists media (evidence: `src/bridges/ig_ingest/_browser_ingest.py`)
- WhatsApp bridge → PostgreSQL: forwards collected data
- Scheduler → Collection worker: dispatches work
- Scheduler → PostgreSQL: runs scheduled operations
- Control bot → Dashboard API: uses control routes (evidence: `src/notifications/collector_bot.py`)
- Realtime feeds → PostgreSQL: reads feed data
- Schema migrations → PostgreSQL: applies schema
- Dashboard UI → Dashboard API: requests dashboard data
- Dashboard API → PostgreSQL: queries status and records (evidence: `src/dashboard/api/ingestion.py`)
