# txmmybxy/documentflowserver architecture

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

- Interactive diagram: https://gitdiagram.com/txmmybxy/documentflowserver
- Repository: https://github.com/txmmybxy/documentflowserver

## Overview

DocumentFlowServer is an ASP.NET Core document-generation backend. Its principal workflow is: a client manages templates through the API, a worker obtains generation work and template data, produces documents, then uploads results back to the API for storage and notification. The graph also preserves authentication, user/department administration, document handling, and notifications. Several controller and worker implementation details were not sampled; those links are shown only where the README or source index supports them.

Main entry points: [`DocumentFlowServer.Api/Program.cs`](https://github.com/txmmybxy/documentflowserver/blob/master/DocumentFlowServer.Api/Program.cs) (Web API), [`DocumentFlowServer.Infrastructure/Template/TemplateService.cs`](https://github.com/txmmybxy/documentflowserver/blob/master/DocumentFlowServer.Infrastructure/Template/TemplateService.cs) (Template service), [`DocumentFlowServer.Api/Controllers/WorkerController.cs`](https://github.com/txmmybxy/documentflowserver/blob/master/DocumentFlowServer.Api/Controllers/WorkerController.cs) (Worker API), [`DocumentFlowServer.Worker/Client/Api/ApiClient.cs`](https://github.com/txmmybxy/documentflowserver/blob/master/DocumentFlowServer.Worker/Client/Api/ApiClient.cs) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and access"]
  node_api["Web API<br/>[Program.cs]"]
  node_template_controller["Template API"]
  node_worker_controller["Worker API"]
end

subgraph group_domain["Business services"]
  node_auth["Account service<br/>[AccountService.cs]"]
  node_template_service["Template service<br/>[TemplateService.cs]"]
  node_user_service["User service<br/>[UserService.cs]"]
  node_department_service["Department service"]
  node_document_service["Document service<br/>[DocumentService.cs]"]
  node_worker_tasks["Worker task service"]
  node_notifications["Notification service"]
end

subgraph group_storage["Persistence and files"]
  node_database[("Application database")]
  node_file_storage["File storage"]
  node_redis[("Redis cache")]
end

subgraph group_worker["Document generation"]
  node_worker["Background worker<br/>[WorkerService.cs]"]
  node_generation["Template generation"]
  node_worker_api_client["API client<br/>[ApiClient.cs]"]
end

node_client(("Client"))
node_signalr(("Realtime clients"))

node_client -->|"sends requests"| node_api
node_api -->|"routes requests"| node_template_controller
node_template_controller -->|"calls"| node_template_service
node_client -.->|"requests work"| node_worker_controller
node_worker_controller -->|"dispatches tasks"| node_worker_tasks
node_worker_controller -->|"gets template data"| node_template_service
node_worker -->|"uses client"| node_worker_api_client
node_worker -.->|"runs generation"| node_generation
node_worker_api_client -.->|"reports over HTTP"| node_worker_controller
node_template_service -->|"saves files"| node_file_storage
node_template_service -->|"sends notices"| node_notifications
node_template_service -->|"caches results"| node_redis
node_user_service -->|"sends notices"| node_notifications
node_department_service -->|"sends notices"| node_notifications
node_document_service -->|"stores files"| node_file_storage
node_document_service -->|"notifies client"| node_signalr
node_api -->|"maps hubs"| node_signalr
node_auth -->|"loads user"| node_user_service
node_auth -.->|"uses account data"| node_database
node_worker_api_client -.->|"uploads results"| node_api
node_api -->|"configures context"| node_database

click node_api "https://github.com/txmmybxy/documentflowserver/blob/master/DocumentFlowServer.Api/Program.cs"
click node_template_controller "https://github.com/txmmybxy/documentflowserver/blob/master/DocumentFlowServer.Api/Controllers/TemplateController.cs"
click node_worker_controller "https://github.com/txmmybxy/documentflowserver/blob/master/DocumentFlowServer.Api/Controllers/WorkerController.cs"
click node_auth "https://github.com/txmmybxy/documentflowserver/blob/master/DocumentFlowServer.Infrastructure/Account/AccountService.cs"
click node_template_service "https://github.com/txmmybxy/documentflowserver/blob/master/DocumentFlowServer.Infrastructure/Template/TemplateService.cs"
click node_user_service "https://github.com/txmmybxy/documentflowserver/blob/master/DocumentFlowServer.Infrastructure/User/UserService.cs"
click node_department_service "https://github.com/txmmybxy/documentflowserver/blob/master/DocumentFlowServer.Infrastructure/Department/DepartmentService.cs"
click node_document_service "https://github.com/txmmybxy/documentflowserver/blob/master/DocumentFlowServer.Infrastructure/Document/DocumentService.cs"
click node_worker_tasks "https://github.com/txmmybxy/documentflowserver/blob/master/DocumentFlowServer.Infrastructure/Common/Services/WorkerTaskService.cs"
click node_notifications "https://github.com/txmmybxy/documentflowserver/blob/master/DocumentFlowServer.Infrastructure/Notification/NotificationService.cs"
click node_database "https://github.com/txmmybxy/documentflowserver/blob/master/DocumentFlowServer.Infrastructure/Data/ApplicationDbContext.cs"
click node_file_storage "https://github.com/txmmybxy/documentflowserver/blob/master/DocumentFlowServer.Infrastructure/Common/Services/FileStorageService.cs"
click node_worker "https://github.com/txmmybxy/documentflowserver/blob/master/DocumentFlowServer.Worker/Service/WorkerService.cs"
click node_generation "https://github.com/txmmybxy/documentflowserver/blob/master/DocumentFlowServer.Worker/Service/DocumentTemplateService.cs"
click node_worker_api_client "https://github.com/txmmybxy/documentflowserver/blob/master/DocumentFlowServer.Worker/Client/Api/ApiClient.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_api,node_template_controller,node_worker_controller,node_client,node_signalr toneBlue
class node_auth,node_template_service,node_user_service,node_department_service,node_document_service,node_worker_tasks,node_notifications toneAmber
class node_database,node_file_storage,node_redis toneMint
class node_worker,node_generation,node_worker_api_client toneRose
```

## Components

### API and access

- [Web API](https://github.com/txmmybxy/documentflowserver/blob/master/DocumentFlowServer.Api/Program.cs): `DocumentFlowServer.Api/Program.cs`
- [Template API](https://github.com/txmmybxy/documentflowserver/blob/master/DocumentFlowServer.Api/Controllers/TemplateController.cs): `DocumentFlowServer.Api/Controllers/TemplateController.cs`
- [Worker API](https://github.com/txmmybxy/documentflowserver/blob/master/DocumentFlowServer.Api/Controllers/WorkerController.cs): `DocumentFlowServer.Api/Controllers/WorkerController.cs`

### Business services

- [Account service](https://github.com/txmmybxy/documentflowserver/blob/master/DocumentFlowServer.Infrastructure/Account/AccountService.cs): `DocumentFlowServer.Infrastructure/Account/AccountService.cs`
- [Template service](https://github.com/txmmybxy/documentflowserver/blob/master/DocumentFlowServer.Infrastructure/Template/TemplateService.cs): `DocumentFlowServer.Infrastructure/Template/TemplateService.cs`
- [User service](https://github.com/txmmybxy/documentflowserver/blob/master/DocumentFlowServer.Infrastructure/User/UserService.cs): `DocumentFlowServer.Infrastructure/User/UserService.cs`
- [Department service](https://github.com/txmmybxy/documentflowserver/blob/master/DocumentFlowServer.Infrastructure/Department/DepartmentService.cs): `DocumentFlowServer.Infrastructure/Department/DepartmentService.cs`
- [Document service](https://github.com/txmmybxy/documentflowserver/blob/master/DocumentFlowServer.Infrastructure/Document/DocumentService.cs): `DocumentFlowServer.Infrastructure/Document/DocumentService.cs`
- [Worker task service](https://github.com/txmmybxy/documentflowserver/blob/master/DocumentFlowServer.Infrastructure/Common/Services/WorkerTaskService.cs): `DocumentFlowServer.Infrastructure/Common/Services/WorkerTaskService.cs`
- [Notification service](https://github.com/txmmybxy/documentflowserver/blob/master/DocumentFlowServer.Infrastructure/Notification/NotificationService.cs): `DocumentFlowServer.Infrastructure/Notification/NotificationService.cs`

### Persistence and files

- [Application database](https://github.com/txmmybxy/documentflowserver/blob/master/DocumentFlowServer.Infrastructure/Data/ApplicationDbContext.cs): `DocumentFlowServer.Infrastructure/Data/ApplicationDbContext.cs`
- [File storage](https://github.com/txmmybxy/documentflowserver/blob/master/DocumentFlowServer.Infrastructure/Common/Services/FileStorageService.cs): `DocumentFlowServer.Infrastructure/Common/Services/FileStorageService.cs`
- **Redis cache**

### Document generation

- [Background worker](https://github.com/txmmybxy/documentflowserver/blob/master/DocumentFlowServer.Worker/Service/WorkerService.cs): `DocumentFlowServer.Worker/Service/WorkerService.cs`
- [Template generation](https://github.com/txmmybxy/documentflowserver/blob/master/DocumentFlowServer.Worker/Service/DocumentTemplateService.cs): `DocumentFlowServer.Worker/Service/DocumentTemplateService.cs`
- [API client](https://github.com/txmmybxy/documentflowserver/blob/master/DocumentFlowServer.Worker/Client/Api/ApiClient.cs): `DocumentFlowServer.Worker/Client/Api/ApiClient.cs`

### Other components

- **Client**
- **Realtime clients**

## Connections

- Client → Web API: sends requests (evidence: `README.md`)
- Web API → Template API: routes requests (evidence: `DocumentFlowServer.Api/Program.cs`)
- Template API → Template service: calls (evidence: `DocumentFlowServer.Api/Controllers/TemplateController.cs`)
- Client → Worker API: requests work
- Worker API → Worker task service: dispatches tasks (evidence: `DocumentFlowServer.Api/Controllers/WorkerController.cs`)
- Worker API → Template service: gets template data (evidence: `DocumentFlowServer.Api/Controllers/WorkerController.cs`)
- Background worker → API client: uses client
- Background worker → Template generation: runs generation
- API client → Worker API: reports over HTTP (evidence: `README.md`)
- Template service → File storage: saves files (evidence: `DocumentFlowServer.Infrastructure/Template/TemplateService.cs`)
- Template service → Notification service: sends notices (evidence: `DocumentFlowServer.Infrastructure/Template/TemplateService.cs`)
- Template service → Redis cache: caches results (evidence: `DocumentFlowServer.Infrastructure/Template/TemplateService.cs`)
- User service → Notification service: sends notices (evidence: `DocumentFlowServer.Infrastructure/User/UserService.cs`)
- Department service → Notification service: sends notices (evidence: `DocumentFlowServer.Infrastructure/Department/DepartmentService.cs`)
- Document service → File storage: stores files (evidence: `DocumentFlowServer.Infrastructure/Document/DocumentService.cs`)
- Document service → Realtime clients: notifies client (evidence: `DocumentFlowServer.Infrastructure/Document/DocumentService.cs`)
- Web API → Realtime clients: maps hubs (evidence: `DocumentFlowServer.Api/Program.cs`)
- Account service → User service: loads user (evidence: `DocumentFlowServer.Infrastructure/Account/AccountService.cs`)
- Account service → Application database: uses account data
- API client → Web API: uploads results (evidence: `README.md`)
- Web API → Application database: configures context (evidence: `DocumentFlowServer.Api/Program.cs`)
