# broshchak/projectmanagement architecture

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

- Interactive diagram: https://gitdiagram.com/broshchak/projectmanagement
- Repository: https://github.com/broshchak/projectmanagement

## Overview

ProjectManagement is an order-management system with a WPF desktop client, ASP.NET API, PostgreSQL-backed application services, and a Telegram bot. Users sign in, manage customers/products and orders, then advance orders through configurable workflows; administrators manage access and workflow rules. Users can also generate reports and PDFs in WPF or Telegram. The graph preserves these documented capabilities, while sampled source provides detail for order workflow, authentication, reporting, and bot startup; unsampled service and controller internals are represented at subsystem level.

Main entry points: [`WebApi/Program.cs`](https://github.com/broshchak/projectmanagement/blob/main/WebApi/Program.cs) (ASP.NET API), [`Application/Services/ReportPdfService.cs`](https://github.com/broshchak/projectmanagement/blob/main/Application/Services/ReportPdfService.cs) (PDF generation), [`WebApi/Controllers/OrdersController.cs`](https://github.com/broshchak/projectmanagement/blob/main/WebApi/Controllers/OrdersController.cs) (Orders endpoints), [`TelegramBot/bot/api.py`](https://github.com/broshchak/projectmanagement/blob/main/TelegramBot/bot/api.py) (Backend API adapter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["User clients"]
  node_wpf["WPF client<br/>[MainWindow.xaml.cs]"]
  node_wpf_api["HTTP API client"]
  node_bot["Telegram bot<br/>[main.py]"]
  node_bot_handlers["Bot handlers<br/>[handlers.py]"]
  node_bot_api["Backend API adapter<br/>[api.py]"]
end

subgraph group_api["Web API"]
  node_webapi["ASP.NET API<br/>[Program.cs]"]
  node_orders_api["Orders endpoints"]
  node_reports_api["Reports endpoints"]
  node_admin_api["Management endpoints<br/>[RolesController.cs]"]
end

subgraph group_application["Application services"]
  node_auth["Authentication<br/>[AuthService.cs]"]
  node_order_workflow["Order workflow"]
  node_order_services["Order services<br/>[OrderService.cs]"]
  node_catalog["Customer and product services<br/>[CustomerService.cs]"]
  node_management["Users and roles"]
  node_reporting["Report services<br/>[ReportService.cs]"]
  node_pdf["PDF generation"]
  node_telegram_services["Telegram services<br/>[BotService.cs]"]
  node_permissions["Permission rules<br/>[Permissions.cs]"]
end

subgraph group_infrastructure["Persistence and integrations"]
  node_orders_repo["Order repository<br/>[OrderRepository.cs]"]
  node_queries["Report queries<br/>[ReportQueries.cs]"]
  node_database[("PostgreSQL<br/>[AppDbContext.cs]")]
  node_pdf_renderer["QuestPDF renderer"]
end

subgraph group_domain["Domain model"]
  node_order_entities["Order and workflow data<br/>[OrderEntity.cs]"]
  node_identity_entities["Users and roles<br/>[AppUserEntity.cs]"]
  node_report_templates["Report templates"]
end

node_operator(("Staff user"))
node_telegram_service(("Telegram platform"))

node_operator -->|"uses"| node_wpf
node_wpf -->|"invokes"| node_wpf_api
node_wpf_api -->|"HTTP requests"| node_webapi
node_bot -->|"registers"| node_bot_handlers
node_bot -->|"creates"| node_bot_api
node_bot_handlers -->|"uses"| node_bot_api
node_bot_api -->|"requests"| node_webapi
node_telegram_service -->|"messages"| node_bot
node_webapi -.->|"routes"| node_orders_api
node_orders_api -->|"calls"| node_order_services
node_orders_api -->|"dispatches transitions"| node_order_workflow
node_orders_api -->|"checks access"| node_permissions
node_webapi -.->|"routes"| node_reports_api
node_reports_api -->|"calls"| node_reporting
node_reports_api -->|"requests PDFs"| node_pdf
node_webapi -.->|"routes"| node_admin_api
node_admin_api -.->|"delegates"| node_management
node_auth -->|"authenticates"| node_identity_entities
node_order_workflow -->|"reads and updates"| node_orders_repo
node_order_services -.->|"uses"| node_orders_repo
node_orders_repo -->|"queries"| node_database
node_orders_repo -->|"reads and writes"| node_order_entities
node_reporting -.->|"loads report data"| node_queries
node_pdf -->|"loads report data"| node_queries
node_pdf -->|"renders document"| node_pdf_renderer
node_queries -.->|"queries"| node_database
node_pdf -.->|"uses templates"| node_report_templates
node_telegram_services -.->|"delivers reports"| node_pdf
node_bot_api -->|"sends PDF"| node_telegram_service
node_management -.->|"manages access"| node_permissions

click node_wpf "https://github.com/broshchak/projectmanagement/blob/main/WpfClient/MainWindow.xaml.cs"
click node_wpf_api "https://github.com/broshchak/projectmanagement/blob/main/WpfClient/Services/HttpOrdersApiClient.cs"
click node_bot "https://github.com/broshchak/projectmanagement/blob/main/TelegramBot/bot/main.py"
click node_bot_handlers "https://github.com/broshchak/projectmanagement/blob/main/TelegramBot/bot/handlers.py"
click node_bot_api "https://github.com/broshchak/projectmanagement/blob/main/TelegramBot/bot/api.py"
click node_webapi "https://github.com/broshchak/projectmanagement/blob/main/WebApi/Program.cs"
click node_orders_api "https://github.com/broshchak/projectmanagement/blob/main/WebApi/Controllers/OrdersController.cs"
click node_reports_api "https://github.com/broshchak/projectmanagement/blob/main/WebApi/Controllers/ReportsController.cs"
click node_admin_api "https://github.com/broshchak/projectmanagement/blob/main/WebApi/Controllers/RolesController.cs"
click node_auth "https://github.com/broshchak/projectmanagement/blob/main/Application/Services/AuthService.cs"
click node_order_workflow "https://github.com/broshchak/projectmanagement/blob/main/Application/Services/OrderWorkflowService.cs"
click node_order_services "https://github.com/broshchak/projectmanagement/blob/main/Application/Services/OrderService.cs"
click node_catalog "https://github.com/broshchak/projectmanagement/blob/main/Application/Services/CustomerService.cs"
click node_management "https://github.com/broshchak/projectmanagement/blob/main/Application/Services/UserManagementService.cs"
click node_reporting "https://github.com/broshchak/projectmanagement/blob/main/Application/Services/ReportService.cs"
click node_pdf "https://github.com/broshchak/projectmanagement/blob/main/Application/Services/ReportPdfService.cs"
click node_telegram_services "https://github.com/broshchak/projectmanagement/blob/main/Application/Services/BotService.cs"
click node_permissions "https://github.com/broshchak/projectmanagement/blob/main/Application/Security/Permissions.cs"
click node_orders_repo "https://github.com/broshchak/projectmanagement/blob/main/Infrastructure/Persistence/Repositories/OrderRepository.cs"
click node_queries "https://github.com/broshchak/projectmanagement/blob/main/Infrastructure/Persistence/Repositories/ReportQueries.cs"
click node_database "https://github.com/broshchak/projectmanagement/blob/main/Infrastructure/Persistence/AppDbContext.cs"
click node_pdf_renderer "https://github.com/broshchak/projectmanagement/blob/main/Infrastructure/Reports/QuestReportPdfRenderer.cs"
click node_order_entities "https://github.com/broshchak/projectmanagement/blob/main/Domain/Entities/OrderEntity.cs"
click node_identity_entities "https://github.com/broshchak/projectmanagement/blob/main/Domain/Entities/AppUserEntity.cs"
click node_report_templates "https://github.com/broshchak/projectmanagement/blob/main/Domain/Entities/ReportTemplateEntity.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_wpf,node_wpf_api,node_bot,node_bot_handlers,node_bot_api,node_operator toneBlue
class node_webapi,node_orders_api,node_reports_api,node_admin_api toneAmber
class node_auth,node_order_workflow,node_order_services,node_catalog,node_management,node_reporting,node_pdf,node_telegram_services,node_permissions toneMint
class node_orders_repo,node_queries,node_database,node_pdf_renderer toneRose
class node_order_entities,node_identity_entities,node_report_templates,node_telegram_service toneIndigo
```

## Components

### User clients

- [WPF client](https://github.com/broshchak/projectmanagement/blob/main/WpfClient/MainWindow.xaml.cs): `WpfClient/MainWindow.xaml.cs`
- [HTTP API client](https://github.com/broshchak/projectmanagement/blob/main/WpfClient/Services/HttpOrdersApiClient.cs): `WpfClient/Services/HttpOrdersApiClient.cs`
- [Telegram bot](https://github.com/broshchak/projectmanagement/blob/main/TelegramBot/bot/main.py): `TelegramBot/bot/main.py`
- [Bot handlers](https://github.com/broshchak/projectmanagement/blob/main/TelegramBot/bot/handlers.py): `TelegramBot/bot/handlers.py`
- [Backend API adapter](https://github.com/broshchak/projectmanagement/blob/main/TelegramBot/bot/api.py): `TelegramBot/bot/api.py`

### Web API

- [ASP.NET API](https://github.com/broshchak/projectmanagement/blob/main/WebApi/Program.cs): `WebApi/Program.cs`
- [Orders endpoints](https://github.com/broshchak/projectmanagement/blob/main/WebApi/Controllers/OrdersController.cs): `WebApi/Controllers/OrdersController.cs`
- [Reports endpoints](https://github.com/broshchak/projectmanagement/blob/main/WebApi/Controllers/ReportsController.cs): `WebApi/Controllers/ReportsController.cs`
- [Management endpoints](https://github.com/broshchak/projectmanagement/blob/main/WebApi/Controllers/RolesController.cs): `WebApi/Controllers/RolesController.cs`

### Application services

- [Authentication](https://github.com/broshchak/projectmanagement/blob/main/Application/Services/AuthService.cs): `Application/Services/AuthService.cs`
- [Order workflow](https://github.com/broshchak/projectmanagement/blob/main/Application/Services/OrderWorkflowService.cs): `Application/Services/OrderWorkflowService.cs`
- [Order services](https://github.com/broshchak/projectmanagement/blob/main/Application/Services/OrderService.cs): `Application/Services/OrderService.cs`
- [Customer and product services](https://github.com/broshchak/projectmanagement/blob/main/Application/Services/CustomerService.cs): `Application/Services/CustomerService.cs`
- [Users and roles](https://github.com/broshchak/projectmanagement/blob/main/Application/Services/UserManagementService.cs): `Application/Services/UserManagementService.cs`
- [Report services](https://github.com/broshchak/projectmanagement/blob/main/Application/Services/ReportService.cs): `Application/Services/ReportService.cs`
- [PDF generation](https://github.com/broshchak/projectmanagement/blob/main/Application/Services/ReportPdfService.cs): `Application/Services/ReportPdfService.cs`
- [Telegram services](https://github.com/broshchak/projectmanagement/blob/main/Application/Services/BotService.cs): `Application/Services/BotService.cs`
- [Permission rules](https://github.com/broshchak/projectmanagement/blob/main/Application/Security/Permissions.cs): `Application/Security/Permissions.cs`

### Persistence and integrations

- [Order repository](https://github.com/broshchak/projectmanagement/blob/main/Infrastructure/Persistence/Repositories/OrderRepository.cs): `Infrastructure/Persistence/Repositories/OrderRepository.cs`
- [Report queries](https://github.com/broshchak/projectmanagement/blob/main/Infrastructure/Persistence/Repositories/ReportQueries.cs): `Infrastructure/Persistence/Repositories/ReportQueries.cs`
- [PostgreSQL](https://github.com/broshchak/projectmanagement/blob/main/Infrastructure/Persistence/AppDbContext.cs): `Infrastructure/Persistence/AppDbContext.cs`
- [QuestPDF renderer](https://github.com/broshchak/projectmanagement/blob/main/Infrastructure/Reports/QuestReportPdfRenderer.cs): `Infrastructure/Reports/QuestReportPdfRenderer.cs`

### Domain model

- [Order and workflow data](https://github.com/broshchak/projectmanagement/blob/main/Domain/Entities/OrderEntity.cs): `Domain/Entities/OrderEntity.cs`
- [Users and roles](https://github.com/broshchak/projectmanagement/blob/main/Domain/Entities/AppUserEntity.cs): `Domain/Entities/AppUserEntity.cs`
- [Report templates](https://github.com/broshchak/projectmanagement/blob/main/Domain/Entities/ReportTemplateEntity.cs): `Domain/Entities/ReportTemplateEntity.cs`

### Other components

- **Staff user**
- **Telegram platform**

## Connections

- Staff user → WPF client: uses (evidence: `README.md`)
- WPF client → HTTP API client: invokes (evidence: `WpfClient/Services/HttpOrdersApiClient.cs`)
- HTTP API client → ASP.NET API: HTTP requests (evidence: `README.md`)
- Telegram bot → Bot handlers: registers (evidence: `TelegramBot/bot/main.py`)
- Telegram bot → Backend API adapter: creates (evidence: `TelegramBot/bot/main.py`)
- Bot handlers → Backend API adapter: uses (evidence: `TelegramBot/bot/handlers.py`)
- Backend API adapter → ASP.NET API: requests (evidence: `README.md`)
- Telegram platform → Telegram bot: messages (evidence: `TelegramBot/bot/main.py`)
- ASP.NET API → Orders endpoints: routes
- Orders endpoints → Order services: calls (evidence: `WebApi/Controllers/OrdersController.cs`)
- Orders endpoints → Order workflow: dispatches transitions (evidence: `WebApi/Controllers/OrdersController.cs`)
- Orders endpoints → Permission rules: checks access (evidence: `WebApi/Controllers/OrdersController.cs`)
- ASP.NET API → Reports endpoints: routes
- Reports endpoints → Report services: calls (evidence: `WebApi/Controllers/ReportsController.cs`)
- Reports endpoints → PDF generation: requests PDFs (evidence: `WebApi/Controllers/ReportsController.cs`)
- ASP.NET API → Management endpoints: routes
- Management endpoints → Users and roles: delegates
- Authentication → Users and roles: authenticates (evidence: `Application/Services/AuthService.cs`)
- Order workflow → Order repository: reads and updates (evidence: `Application/Services/OrderWorkflowService.cs`)
- Order services → Order repository: uses
- Order repository → PostgreSQL: queries (evidence: `Infrastructure/Persistence/Repositories/OrderRepository.cs`)
- Order repository → Order and workflow data: reads and writes (evidence: `Infrastructure/Persistence/Repositories/OrderRepository.cs`)
- Report services → Report queries: loads report data
- PDF generation → Report queries: loads report data (evidence: `Application/Services/ReportPdfService.cs`)
- PDF generation → QuestPDF renderer: renders document (evidence: `Application/Services/ReportPdfService.cs`)
- Report queries → PostgreSQL: queries
- PDF generation → Report templates: uses templates
- Telegram services → PDF generation: delivers reports (evidence: `README.md`)
- Backend API adapter → Telegram platform: sends PDF (evidence: `README.md`)
- Users and roles → Permission rules: manages access (evidence: `README.md`)
