# otb2124/workgreg architecture

> Architecture diagram of the GitHub repository otb2124/workgreg, 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/otb2124/workgreg
- Repository: https://github.com/otb2124/workgreg

## Overview

WorkGreg is a Telegram-based vacancy watcher: users configure keyword profiles, filters, and job-board sources; scheduled or manual checks fetch vacancies, persist them, filter per profile, and deliver new matches. The bot uses a client abstraction to reach the core through the HTTP API (or in-process); the core also owns profile and settings operations, polling, and retention. Fetcher details and some runtime wiring are not shown, so uncertain links are omitted or marked dashed.

Main entry points: [`src/WorkGreg.Core/Data/AppDb.cs`](https://github.com/otb2124/workgreg/blob/master/src/WorkGreg.Core/Data/AppDb.cs) (Application database), [`src/WorkGreg.Host/Api/ApiEndpoints.cs`](https://github.com/otb2124/workgreg/blob/master/src/WorkGreg.Host/Api/ApiEndpoints.cs) (API endpoints), [`src/WorkGreg.Core/Services/SourceSyncService.cs`](https://github.com/otb2124/workgreg/blob/master/src/WorkGreg.Core/Services/SourceSyncService.cs) (Source sync), [`src/WorkGreg.Core/Services/DeliveryService.cs`](https://github.com/otb2124/workgreg/blob/master/src/WorkGreg.Core/Services/DeliveryService.cs) (Delivery service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_bot["Telegram bot"]
  node_updates["Update dispatcher"]
  node_botui["Commands and menus<br/>[Commands]"]
  node_botservice["Bot service<br/>[BotService.cs]"]
end

subgraph group_api["Client and API"]
  node_clientcontract["Client contract<br/>[IWorkGregClient.cs]"]
  node_httpclient["HTTP client"]
  node_endpoints["API endpoints<br/>[ApiEndpoints.cs]"]
end

subgraph group_management["Profile management"]
  node_profiles["Profile service<br/>[ProfileService.cs]"]
  node_sources["Source service<br/>[SourceService.cs]"]
  node_settings["Settings service<br/>[SettingsService.cs]"]
  node_catalog["Source catalog<br/>[SourceCatalog.cs]"]
end

subgraph group_polling["Vacancy polling"]
  node_pollrunner["Poll runner<br/>[PollRunner.cs]"]
  node_sourcesync["Source sync"]
  node_fetchpipeline["Fetch pipeline<br/>[FetchPipeline.cs]"]
  node_fetchers["Feed and API fetchers<br/>[Fetching]"]
  node_jobfilter["Profile filtering<br/>[ProfileCriteria.cs]"]
end

subgraph group_state["Persistence and delivery"]
  node_database[("Application database<br/>[AppDb.cs]")]
  node_delivery["Delivery service<br/>[DeliveryService.cs]"]
  node_notifier["Telegram notifier<br/>[INotifier.cs]"]
  node_retention["Job retention"]
end

node_user(("Telegram user"))
node_boards(("Job boards"))
node_telegram(("Telegram"))

node_user -->|"sends updates"| node_updates
node_updates -->|"dispatches to"| node_botui
node_botui -->|"requests core operations"| node_clientcontract
node_httpclient -->|"implements"| node_clientcontract
node_httpclient -.->|"calls over HTTP"| node_endpoints
node_endpoints -->|"routes profile operations"| node_profiles
node_endpoints -->|"routes source operations"| node_sources
node_endpoints -->|"routes settings operations"| node_settings
node_profiles -->|"reads and writes"| node_database
node_sources -->|"validates provider"| node_catalog
node_sources -->|"reads and writes"| node_database
node_settings -->|"reads and writes"| node_database
node_pollrunner -->|"syncs sources"| node_sourcesync
node_sourcesync -->|"requests fetch results"| node_fetchpipeline
node_fetchpipeline -->|"dispatches fetch"| node_fetchers
node_boards -.->|"provides vacancies"| node_fetchers
node_sourcesync -->|"stores jobs"| node_database
node_sourcesync -->|"applies profile criteria"| node_jobfilter
node_pollrunner -->|"delivers matches"| node_delivery
node_delivery -->|"evaluates criteria"| node_jobfilter
node_delivery -->|"reads and updates"| node_database
node_delivery -->|"sends messages"| node_notifier
node_notifier -->|"sends vacancy messages"| node_telegram
node_retention -->|"deletes expired jobs"| node_database
node_botservice -->|"processes updates"| node_updates

click node_updates "https://github.com/otb2124/workgreg/blob/master/src/WorkGreg.Bot/Telegram/UpdateDispatcher.cs"
click node_botui "https://github.com/otb2124/workgreg/tree/master/src/WorkGreg.Bot/Telegram/Commands"
click node_botservice "https://github.com/otb2124/workgreg/blob/master/src/WorkGreg.Bot/Telegram/BotService.cs"
click node_clientcontract "https://github.com/otb2124/workgreg/blob/master/src/WorkGreg.Contracts/IWorkGregClient.cs"
click node_httpclient "https://github.com/otb2124/workgreg/blob/master/src/WorkGreg.Bot/Client/HttpWorkGregClient.cs"
click node_endpoints "https://github.com/otb2124/workgreg/blob/master/src/WorkGreg.Host/Api/ApiEndpoints.cs"
click node_profiles "https://github.com/otb2124/workgreg/blob/master/src/WorkGreg.Core/Services/ProfileService.cs"
click node_sources "https://github.com/otb2124/workgreg/blob/master/src/WorkGreg.Core/Services/SourceService.cs"
click node_settings "https://github.com/otb2124/workgreg/blob/master/src/WorkGreg.Core/Services/SettingsService.cs"
click node_catalog "https://github.com/otb2124/workgreg/blob/master/src/WorkGreg.Core/Domain/SourceCatalog.cs"
click node_pollrunner "https://github.com/otb2124/workgreg/blob/master/src/WorkGreg.Core/Services/PollRunner.cs"
click node_sourcesync "https://github.com/otb2124/workgreg/blob/master/src/WorkGreg.Core/Services/SourceSyncService.cs"
click node_fetchpipeline "https://github.com/otb2124/workgreg/blob/master/src/WorkGreg.Core/Fetching/FetchPipeline.cs"
click node_fetchers "https://github.com/otb2124/workgreg/tree/master/src/WorkGreg.Core/Fetching"
click node_jobfilter "https://github.com/otb2124/workgreg/blob/master/src/WorkGreg.Core/Filtering/ProfileCriteria.cs"
click node_database "https://github.com/otb2124/workgreg/blob/master/src/WorkGreg.Core/Data/AppDb.cs"
click node_delivery "https://github.com/otb2124/workgreg/blob/master/src/WorkGreg.Core/Services/DeliveryService.cs"
click node_notifier "https://github.com/otb2124/workgreg/blob/master/src/WorkGreg.Core/Services/INotifier.cs"
click node_retention "https://github.com/otb2124/workgreg/blob/master/src/WorkGreg.Core/Services/RetentionService.cs"

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_updates,node_botui,node_botservice,node_user toneBlue
class node_clientcontract,node_httpclient,node_endpoints toneAmber
class node_profiles,node_sources,node_settings,node_catalog toneMint
class node_pollrunner,node_sourcesync,node_fetchpipeline,node_fetchers,node_jobfilter toneRose
class node_database,node_delivery,node_notifier,node_retention,node_boards,node_telegram toneIndigo
```

## Components

### Telegram bot

- [Update dispatcher](https://github.com/otb2124/workgreg/blob/master/src/WorkGreg.Bot/Telegram/UpdateDispatcher.cs): `src/WorkGreg.Bot/Telegram/UpdateDispatcher.cs`
- [Commands and menus](https://github.com/otb2124/workgreg/tree/master/src/WorkGreg.Bot/Telegram/Commands): `src/WorkGreg.Bot/Telegram/Commands`
- [Bot service](https://github.com/otb2124/workgreg/blob/master/src/WorkGreg.Bot/Telegram/BotService.cs): `src/WorkGreg.Bot/Telegram/BotService.cs`

### Client and API

- [Client contract](https://github.com/otb2124/workgreg/blob/master/src/WorkGreg.Contracts/IWorkGregClient.cs): `src/WorkGreg.Contracts/IWorkGregClient.cs`
- [HTTP client](https://github.com/otb2124/workgreg/blob/master/src/WorkGreg.Bot/Client/HttpWorkGregClient.cs): `src/WorkGreg.Bot/Client/HttpWorkGregClient.cs`
- [API endpoints](https://github.com/otb2124/workgreg/blob/master/src/WorkGreg.Host/Api/ApiEndpoints.cs): `src/WorkGreg.Host/Api/ApiEndpoints.cs`

### Profile management

- [Profile service](https://github.com/otb2124/workgreg/blob/master/src/WorkGreg.Core/Services/ProfileService.cs): `src/WorkGreg.Core/Services/ProfileService.cs`
- [Source service](https://github.com/otb2124/workgreg/blob/master/src/WorkGreg.Core/Services/SourceService.cs): `src/WorkGreg.Core/Services/SourceService.cs`
- [Settings service](https://github.com/otb2124/workgreg/blob/master/src/WorkGreg.Core/Services/SettingsService.cs): `src/WorkGreg.Core/Services/SettingsService.cs`
- [Source catalog](https://github.com/otb2124/workgreg/blob/master/src/WorkGreg.Core/Domain/SourceCatalog.cs): `src/WorkGreg.Core/Domain/SourceCatalog.cs`

### Vacancy polling

- [Poll runner](https://github.com/otb2124/workgreg/blob/master/src/WorkGreg.Core/Services/PollRunner.cs): `src/WorkGreg.Core/Services/PollRunner.cs`
- [Source sync](https://github.com/otb2124/workgreg/blob/master/src/WorkGreg.Core/Services/SourceSyncService.cs): `src/WorkGreg.Core/Services/SourceSyncService.cs`
- [Fetch pipeline](https://github.com/otb2124/workgreg/blob/master/src/WorkGreg.Core/Fetching/FetchPipeline.cs): `src/WorkGreg.Core/Fetching/FetchPipeline.cs`
- [Feed and API fetchers](https://github.com/otb2124/workgreg/tree/master/src/WorkGreg.Core/Fetching): `src/WorkGreg.Core/Fetching`
- [Profile filtering](https://github.com/otb2124/workgreg/blob/master/src/WorkGreg.Core/Filtering/ProfileCriteria.cs): `src/WorkGreg.Core/Filtering/ProfileCriteria.cs`

### Persistence and delivery

- [Application database](https://github.com/otb2124/workgreg/blob/master/src/WorkGreg.Core/Data/AppDb.cs): `src/WorkGreg.Core/Data/AppDb.cs`
- [Delivery service](https://github.com/otb2124/workgreg/blob/master/src/WorkGreg.Core/Services/DeliveryService.cs): `src/WorkGreg.Core/Services/DeliveryService.cs`
- [Telegram notifier](https://github.com/otb2124/workgreg/blob/master/src/WorkGreg.Core/Services/INotifier.cs): `src/WorkGreg.Core/Services/INotifier.cs`
- [Job retention](https://github.com/otb2124/workgreg/blob/master/src/WorkGreg.Core/Services/RetentionService.cs): `src/WorkGreg.Core/Services/RetentionService.cs`

### Other components

- **Telegram user**
- **Job boards**
- **Telegram**

## Connections

- Telegram user → Update dispatcher: sends updates (evidence: `README.md`)
- Update dispatcher → Commands and menus: dispatches to (evidence: `src/WorkGreg.Bot/Telegram/UpdateDispatcher.cs`)
- Commands and menus → Client contract: requests core operations
- HTTP client → Client contract: implements (evidence: `src/WorkGreg.Bot/Client/HttpWorkGregClient.cs`)
- HTTP client → API endpoints: calls over HTTP
- API endpoints → Profile service: routes profile operations (evidence: `src/WorkGreg.Host/Api/ApiEndpoints.cs`)
- API endpoints → Source service: routes source operations (evidence: `src/WorkGreg.Host/Api/ApiEndpoints.cs`)
- API endpoints → Settings service: routes settings operations (evidence: `src/WorkGreg.Host/Api/ApiEndpoints.cs`)
- Profile service → Application database: reads and writes (evidence: `src/WorkGreg.Core/Services/ProfileService.cs`)
- Source service → Source catalog: validates provider (evidence: `src/WorkGreg.Core/Services/SourceService.cs`)
- Source service → Application database: reads and writes (evidence: `src/WorkGreg.Core/Services/SourceService.cs`)
- Settings service → Application database: reads and writes (evidence: `src/WorkGreg.Core/Services/SettingsService.cs`)
- Poll runner → Source sync: syncs sources (evidence: `src/WorkGreg.Core/Services/PollRunner.cs`)
- Source sync → Fetch pipeline: requests fetch results (evidence: `src/WorkGreg.Core/Services/SourceSyncService.cs`)
- Fetch pipeline → Feed and API fetchers: dispatches fetch (evidence: `src/WorkGreg.Core/Fetching/FetchPipeline.cs`)
- Job boards → Feed and API fetchers: provides vacancies
- Source sync → Application database: stores jobs (evidence: `src/WorkGreg.Core/Services/SourceSyncService.cs`)
- Source sync → Profile filtering: applies profile criteria (evidence: `src/WorkGreg.Core/Services/SourceSyncService.cs`)
- Poll runner → Delivery service: delivers matches (evidence: `src/WorkGreg.Core/Services/PollRunner.cs`)
- Delivery service → Profile filtering: evaluates criteria (evidence: `src/WorkGreg.Core/Services/DeliveryService.cs`)
- Delivery service → Application database: reads and updates (evidence: `src/WorkGreg.Core/Services/DeliveryService.cs`)
- Delivery service → Telegram notifier: sends messages (evidence: `src/WorkGreg.Core/Services/DeliveryService.cs`)
- Telegram notifier → Telegram: sends vacancy messages (evidence: `src/WorkGreg.Core/Services/INotifier.cs`)
- Job retention → Application database: deletes expired jobs (evidence: `src/WorkGreg.Core/Services/RetentionService.cs`)
- Bot service → Update dispatcher: processes updates (evidence: `src/WorkGreg.Bot/Telegram/BotService.cs`)
