# yaroslav33-v/cafe architecture

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

- Interactive diagram: https://gitdiagram.com/yaroslav33-v/cafe
- Repository: https://github.com/yaroslav33-v/cafe

## Overview

Cafe is a customer-and-admin café ordering web app: customers browse food and offers, manage a cart, pay, and track orders; admins manage menu content, promotions, and orders. The repository also contains a card-payment API and a Telegram bot for offer/promo commands and background notifications. The graph preserves these separate runtime branches. Edges reflect shown calls, registrations, SQL access, or README claims; unsampled connections are omitted or marked unverified.

Main entry points: [`CafeWeb/Program.cs`](https://github.com/yaroslav33-v/cafe/blob/main/CafeWeb/Program.cs) (MVC application), [`CafeWeb/Controllers/CafeController.cs`](https://github.com/yaroslav33-v/cafe/blob/main/CafeWeb/Controllers/CafeController.cs) (Cafe actions), [`CafeWeb/Controllers/UserController.cs`](https://github.com/yaroslav33-v/cafe/blob/main/CafeWeb/Controllers/UserController.cs) (Account actions), [`TelegramBot/TelegramBot/Program.cs`](https://github.com/yaroslav33-v/cafe/blob/main/TelegramBot/TelegramBot/Program.cs) (Bot receiver)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Cafe web app"]
  node_webapp["MVC application<br/>[Program.cs]"]
  node_cafe_ctrl["Cafe actions<br/>[CafeController.cs]"]
  node_user_ctrl["Account actions<br/>[UserController.cs]"]
  node_admin_ctrl["Admin actions<br/>[AdminController.cs]"]
  node_catalog["Food catalog<br/>[CafeService.cs]"]
  node_user_service["Accounts and offers<br/>[UserService.cs]"]
  node_admin_service["Admin management<br/>[AdminService.cs]"]
  node_cafe_db[("Cafe PostgreSQL")]
end

subgraph group_order["Ordering and status"]
  node_cart["Session cart<br/>[CartService.cs]"]
  node_payment_ctrl["Checkout actions"]
  node_orders["Order service<br/>[OrderService.cs]"]
  node_status_worker["Order status updater"]
  node_live_hub["Live order updates<br/>[CafeHub.cs]"]
end

subgraph group_payment["Payment API"]
  node_payment_api["Payment API<br/>[Program.cs]"]
  node_card_auth["Card authentication<br/>[AuthService.cs]"]
  node_payment_service["Payment processing<br/>[PaymentService.cs]"]
  node_bank_db[("Bank PostgreSQL")]
end

subgraph group_bot["Telegram bot"]
  node_bot_app["Bot receiver<br/>[Program.cs]"]
  node_dispatcher["Command dispatcher"]
  node_bot_commands["Bot commands"]
  node_bot_db["Bot database access"]
  node_background["Notification worker"]
  node_notifications["Telegram notifications"]
end

node_customer(("Cafe customer"))
node_admin(("Cafe administrator"))
node_telegram(("Telegram user"))
node_telegram_api["Telegram API"]

node_customer -->|"uses"| node_webapp
node_admin -->|"uses"| node_webapp
node_webapp -.->|"routes to"| node_cafe_ctrl
node_webapp -.->|"routes to"| node_user_ctrl
node_webapp -.->|"routes to"| node_admin_ctrl
node_webapp -->|"maps hub"| node_live_hub
node_cafe_ctrl -->|"gets food"| node_catalog
node_cafe_ctrl -->|"updates cart"| node_cart
node_cafe_ctrl -->|"loads order"| node_orders
node_user_ctrl -->|"authenticates"| node_user_service
node_user_ctrl -->|"loads history"| node_orders
node_user_ctrl -->|"gets favorites"| node_catalog
node_admin_ctrl -->|"manages"| node_admin_service
node_catalog -->|"queries"| node_cafe_db
node_user_service -.->|"queries"| node_cafe_db
node_admin_service -->|"writes and reads"| node_cafe_db
node_payment_ctrl -->|"reads cart"| node_cart
node_payment_ctrl -->|"creates order"| node_orders
node_orders -->|"persists orders"| node_cafe_db
node_status_worker -.->|"pushes status"| node_live_hub
node_payment_ctrl -.->|"requests payment"| node_payment_api
node_payment_api -->|"registers service"| node_card_auth
node_payment_api -.->|"registers service"| node_payment_service
node_card_auth -->|"checks card token"| node_bank_db
node_payment_service -.->|"processes payment"| node_bank_db
node_telegram -->|"sends commands"| node_bot_app
node_bot_app -->|"dispatches updates"| node_dispatcher
node_bot_app -->|"creates processor"| node_bot_db
node_bot_app -->|"starts worker"| node_background
node_dispatcher -->|"dispatches command"| node_bot_commands
node_background -->|"uses notifications"| node_notifications
node_notifications -.->|"sends messages"| node_telegram_api

click node_webapp "https://github.com/yaroslav33-v/cafe/blob/main/CafeWeb/Program.cs"
click node_cafe_ctrl "https://github.com/yaroslav33-v/cafe/blob/main/CafeWeb/Controllers/CafeController.cs"
click node_user_ctrl "https://github.com/yaroslav33-v/cafe/blob/main/CafeWeb/Controllers/UserController.cs"
click node_admin_ctrl "https://github.com/yaroslav33-v/cafe/blob/main/CafeWeb/Controllers/AdminController.cs"
click node_catalog "https://github.com/yaroslav33-v/cafe/blob/main/CafeWeb/Services/CafeService.cs"
click node_user_service "https://github.com/yaroslav33-v/cafe/blob/main/CafeWeb/Services/UserService.cs"
click node_admin_service "https://github.com/yaroslav33-v/cafe/blob/main/CafeWeb/Services/AdminService.cs"
click node_cart "https://github.com/yaroslav33-v/cafe/blob/main/CafeWeb/Services/CartService.cs"
click node_payment_ctrl "https://github.com/yaroslav33-v/cafe/blob/main/CafeWeb/Controllers/PaymentController.cs"
click node_orders "https://github.com/yaroslav33-v/cafe/blob/main/CafeWeb/Services/OrderService.cs"
click node_status_worker "https://github.com/yaroslav33-v/cafe/blob/main/CafeWeb/Services/OrderStatusUpdaterService.cs"
click node_live_hub "https://github.com/yaroslav33-v/cafe/blob/main/CafeWeb/Hubs/CafeHub.cs"
click node_payment_api "https://github.com/yaroslav33-v/cafe/blob/main/PaymentApi/PaymentApi/Program.cs"
click node_card_auth "https://github.com/yaroslav33-v/cafe/blob/main/PaymentApi/PaymentApi/Services/AuthService.cs"
click node_payment_service "https://github.com/yaroslav33-v/cafe/blob/main/PaymentApi/PaymentApi/Services/PaymentService.cs"
click node_bot_app "https://github.com/yaroslav33-v/cafe/blob/main/TelegramBot/TelegramBot/Program.cs"
click node_dispatcher "https://github.com/yaroslav33-v/cafe/blob/main/TelegramBot/TelegramBot/Core/CommandDispatcher.cs"
click node_bot_commands "https://github.com/yaroslav33-v/cafe/tree/main/TelegramBot/TelegramBot/Commands"
click node_bot_db "https://github.com/yaroslav33-v/cafe/blob/main/TelegramBot/TelegramBot/Core/DatabaseProcessor.cs"
click node_background "https://github.com/yaroslav33-v/cafe/blob/main/TelegramBot/TelegramBot/Core/BackgroundWorker.cs"
click node_notifications "https://github.com/yaroslav33-v/cafe/blob/main/TelegramBot/TelegramBot/Core/NotificationService.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_webapp,node_cafe_ctrl,node_user_ctrl,node_admin_ctrl,node_catalog,node_user_service,node_admin_service,node_cafe_db,node_telegram toneBlue
class node_cart,node_payment_ctrl,node_orders,node_status_worker,node_live_hub toneAmber
class node_payment_api,node_card_auth,node_payment_service,node_bank_db,node_telegram_api toneMint
class node_bot_app,node_dispatcher,node_bot_commands,node_bot_db,node_background,node_notifications toneRose
class node_customer,node_admin toneIndigo
```

## Components

### Cafe web app

- [MVC application](https://github.com/yaroslav33-v/cafe/blob/main/CafeWeb/Program.cs): `CafeWeb/Program.cs`
- [Cafe actions](https://github.com/yaroslav33-v/cafe/blob/main/CafeWeb/Controllers/CafeController.cs): `CafeWeb/Controllers/CafeController.cs`
- [Account actions](https://github.com/yaroslav33-v/cafe/blob/main/CafeWeb/Controllers/UserController.cs): `CafeWeb/Controllers/UserController.cs`
- [Admin actions](https://github.com/yaroslav33-v/cafe/blob/main/CafeWeb/Controllers/AdminController.cs): `CafeWeb/Controllers/AdminController.cs`
- [Food catalog](https://github.com/yaroslav33-v/cafe/blob/main/CafeWeb/Services/CafeService.cs): `CafeWeb/Services/CafeService.cs`
- [Accounts and offers](https://github.com/yaroslav33-v/cafe/blob/main/CafeWeb/Services/UserService.cs): `CafeWeb/Services/UserService.cs`
- [Admin management](https://github.com/yaroslav33-v/cafe/blob/main/CafeWeb/Services/AdminService.cs): `CafeWeb/Services/AdminService.cs`
- **Cafe PostgreSQL**

### Ordering and status

- [Session cart](https://github.com/yaroslav33-v/cafe/blob/main/CafeWeb/Services/CartService.cs): `CafeWeb/Services/CartService.cs`
- [Checkout actions](https://github.com/yaroslav33-v/cafe/blob/main/CafeWeb/Controllers/PaymentController.cs): `CafeWeb/Controllers/PaymentController.cs`
- [Order service](https://github.com/yaroslav33-v/cafe/blob/main/CafeWeb/Services/OrderService.cs): `CafeWeb/Services/OrderService.cs`
- [Order status updater](https://github.com/yaroslav33-v/cafe/blob/main/CafeWeb/Services/OrderStatusUpdaterService.cs): `CafeWeb/Services/OrderStatusUpdaterService.cs`
- [Live order updates](https://github.com/yaroslav33-v/cafe/blob/main/CafeWeb/Hubs/CafeHub.cs): `CafeWeb/Hubs/CafeHub.cs`

### Payment API

- [Payment API](https://github.com/yaroslav33-v/cafe/blob/main/PaymentApi/PaymentApi/Program.cs): `PaymentApi/PaymentApi/Program.cs`
- [Card authentication](https://github.com/yaroslav33-v/cafe/blob/main/PaymentApi/PaymentApi/Services/AuthService.cs): `PaymentApi/PaymentApi/Services/AuthService.cs`
- [Payment processing](https://github.com/yaroslav33-v/cafe/blob/main/PaymentApi/PaymentApi/Services/PaymentService.cs): `PaymentApi/PaymentApi/Services/PaymentService.cs`
- **Bank PostgreSQL**

### Telegram bot

- [Bot receiver](https://github.com/yaroslav33-v/cafe/blob/main/TelegramBot/TelegramBot/Program.cs): `TelegramBot/TelegramBot/Program.cs`
- [Command dispatcher](https://github.com/yaroslav33-v/cafe/blob/main/TelegramBot/TelegramBot/Core/CommandDispatcher.cs): `TelegramBot/TelegramBot/Core/CommandDispatcher.cs`
- [Bot commands](https://github.com/yaroslav33-v/cafe/tree/main/TelegramBot/TelegramBot/Commands): `TelegramBot/TelegramBot/Commands`
- [Bot database access](https://github.com/yaroslav33-v/cafe/blob/main/TelegramBot/TelegramBot/Core/DatabaseProcessor.cs): `TelegramBot/TelegramBot/Core/DatabaseProcessor.cs`
- [Notification worker](https://github.com/yaroslav33-v/cafe/blob/main/TelegramBot/TelegramBot/Core/BackgroundWorker.cs): `TelegramBot/TelegramBot/Core/BackgroundWorker.cs`
- [Telegram notifications](https://github.com/yaroslav33-v/cafe/blob/main/TelegramBot/TelegramBot/Core/NotificationService.cs): `TelegramBot/TelegramBot/Core/NotificationService.cs`

### Other components

- **Cafe customer**
- **Cafe administrator**
- **Telegram user**
- **Telegram API**

## Connections

- Cafe customer → MVC application: uses
- Cafe administrator → MVC application: uses
- MVC application → Cafe actions: routes to
- MVC application → Account actions: routes to
- MVC application → Admin actions: routes to
- MVC application → Live order updates: maps hub (evidence: `CafeWeb/Program.cs`)
- Cafe actions → Food catalog: gets food (evidence: `CafeWeb/Controllers/CafeController.cs`)
- Cafe actions → Session cart: updates cart (evidence: `CafeWeb/Controllers/CafeController.cs`)
- Cafe actions → Order service: loads order (evidence: `CafeWeb/Controllers/CafeController.cs`)
- Account actions → Accounts and offers: authenticates (evidence: `CafeWeb/Controllers/UserController.cs`)
- Account actions → Order service: loads history (evidence: `CafeWeb/Controllers/UserController.cs`)
- Account actions → Food catalog: gets favorites (evidence: `CafeWeb/Controllers/UserController.cs`)
- Admin actions → Admin management: manages (evidence: `CafeWeb/Controllers/AdminController.cs`)
- Food catalog → Cafe PostgreSQL: queries (evidence: `CafeWeb/Services/CafeService.cs`)
- Accounts and offers → Cafe PostgreSQL: queries
- Admin management → Cafe PostgreSQL: writes and reads (evidence: `CafeWeb/Services/AdminService.cs`)
- Checkout actions → Session cart: reads cart (evidence: `CafeWeb/Controllers/PaymentController.cs`)
- Checkout actions → Order service: creates order (evidence: `CafeWeb/Controllers/PaymentController.cs`)
- Order service → Cafe PostgreSQL: persists orders (evidence: `CafeWeb/Services/OrderService.cs`)
- Order status updater → Live order updates: pushes status
- Checkout actions → Payment API: requests payment
- Payment API → Card authentication: registers service (evidence: `PaymentApi/PaymentApi/Program.cs`)
- Payment API → Payment processing: registers service
- Card authentication → Bank PostgreSQL: checks card token (evidence: `PaymentApi/PaymentApi/Services/AuthService.cs`)
- Payment processing → Bank PostgreSQL: processes payment
- Telegram user → Bot receiver: sends commands (evidence: `TelegramBot/TelegramBot/Program.cs`)
- Bot receiver → Command dispatcher: dispatches updates (evidence: `TelegramBot/TelegramBot/Program.cs`)
- Bot receiver → Bot database access: creates processor (evidence: `TelegramBot/TelegramBot/Program.cs`)
- Bot receiver → Notification worker: starts worker (evidence: `TelegramBot/TelegramBot/Program.cs`)
- Command dispatcher → Bot commands: dispatches command (evidence: `TelegramBot/TelegramBot/Program.cs`)
- Notification worker → Telegram notifications: uses notifications (evidence: `TelegramBot/TelegramBot/Core/BackgroundWorker.cs`)
- Telegram notifications → Telegram API: sends messages
