# vcusnaya-gusyatina/financeapp architecture

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

- Interactive diagram: https://gitdiagram.com/vcusnaya-gusyatina/financeapp
- Repository: https://github.com/vcusnaya-gusyatina/financeapp

## Overview

FinanceApp is a Telegram bot that polls for updates, records each message update to avoid duplicate processing, and replies through Telegram. The documented product surface is minimal; the sampled code shows polling, update processing, persistence, message handling, and a bot-info endpoint. Finance-specific workflows are not present in the README or sampled implementation. Relationships are based on the excerpts; the polling service invokes the processor, which owns persistence and message-handler calls.

Main entry points: [`Application/TelegramUpdateProcessor.cs`](https://github.com/vcusnaya-gusyatina/financeapp/blob/main/Application/TelegramUpdateProcessor.cs) (Update processor), [`Infrastructure/FinanceDbContext.cs`](https://github.com/vcusnaya-gusyatina/financeapp/blob/main/Infrastructure/FinanceDbContext.cs) (Finance database context), [`BotUpdateService.cs`](https://github.com/vcusnaya-gusyatina/financeapp/blob/main/BotUpdateService.cs) (Update polling), [`MessageHandler.cs`](https://github.com/vcusnaya-gusyatina/financeapp/blob/main/MessageHandler.cs) (Message handler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Bot runtime"]
  node_poller["Update polling"]
end

subgraph group_processing["Update processing"]
  node_processor["Update processor"]
  node_message_handler["Message handler<br/>[MessageHandler.cs]"]
end

subgraph group_persistence["Persistence"]
  node_db_context["Finance database context"]
  node_processed_updates["Processed updates<br/>[ProcessedUpdate.cs]"]
  node_database[("PostgreSQL database")]
end

subgraph group_operations["Bot operations"]
  node_bot_info["Bot info endpoint<br/>[Program.cs]"]
end

node_telegram_user(("Telegram user"))
node_telegram{{"Telegram API"}}

node_telegram -->|"provides updates"| node_poller
node_poller -->|"dispatches updates"| node_processor
node_processor -->|"records update"| node_db_context
node_processor -->|"handles message"| node_message_handler
node_db_context -->|"maps records"| node_processed_updates
node_db_context -.->|"persists records"| node_database
node_message_handler -->|"sends reply"| node_telegram
node_telegram_user -.->|"sends message"| node_telegram
node_telegram -.->|"delivers reply"| node_telegram_user
node_bot_info -->|"requests bot info"| node_telegram

click node_poller "https://github.com/vcusnaya-gusyatina/financeapp/blob/main/BotUpdateService.cs"
click node_processor "https://github.com/vcusnaya-gusyatina/financeapp/blob/main/Application/TelegramUpdateProcessor.cs"
click node_message_handler "https://github.com/vcusnaya-gusyatina/financeapp/blob/main/MessageHandler.cs"
click node_db_context "https://github.com/vcusnaya-gusyatina/financeapp/blob/main/Infrastructure/FinanceDbContext.cs"
click node_processed_updates "https://github.com/vcusnaya-gusyatina/financeapp/blob/main/Infrastructure/ProcessedUpdate.cs"
click node_bot_info "https://github.com/vcusnaya-gusyatina/financeapp/blob/main/Program.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_poller,node_telegram_user toneBlue
class node_processor,node_message_handler toneAmber
class node_db_context,node_processed_updates,node_database,node_telegram toneMint
class node_bot_info toneRose
```

## Components

### Bot runtime

- [Update polling](https://github.com/vcusnaya-gusyatina/financeapp/blob/main/BotUpdateService.cs): `BotUpdateService.cs`

### Update processing

- [Update processor](https://github.com/vcusnaya-gusyatina/financeapp/blob/main/Application/TelegramUpdateProcessor.cs): `Application/TelegramUpdateProcessor.cs`
- [Message handler](https://github.com/vcusnaya-gusyatina/financeapp/blob/main/MessageHandler.cs): `MessageHandler.cs`

### Persistence

- [Finance database context](https://github.com/vcusnaya-gusyatina/financeapp/blob/main/Infrastructure/FinanceDbContext.cs): `Infrastructure/FinanceDbContext.cs`
- [Processed updates](https://github.com/vcusnaya-gusyatina/financeapp/blob/main/Infrastructure/ProcessedUpdate.cs): `Infrastructure/ProcessedUpdate.cs`
- **PostgreSQL database**

### Bot operations

- [Bot info endpoint](https://github.com/vcusnaya-gusyatina/financeapp/blob/main/Program.cs): `Program.cs`

### Other components

- **Telegram user**
- **Telegram API**

## Connections

- Telegram API → Update polling: provides updates (evidence: `BotUpdateService.cs`)
- Update polling → Update processor: dispatches updates (evidence: `BotUpdateService.cs`)
- Update processor → Finance database context: records update (evidence: `Application/TelegramUpdateProcessor.cs`)
- Update processor → Message handler: handles message (evidence: `Application/TelegramUpdateProcessor.cs`)
- Finance database context → Processed updates: maps records (evidence: `Infrastructure/FinanceDbContext.cs`)
- Finance database context → PostgreSQL database: persists records
- Message handler → Telegram API: sends reply (evidence: `MessageHandler.cs`)
- Telegram user → Telegram API: sends message
- Telegram API → Telegram user: delivers reply
- Bot info endpoint → Telegram API: requests bot info (evidence: `Program.cs`)
