# salievyt/my_exchange architecture

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

## Overview

My Exchange is a Django backend for currency exchange operations and cash management, with a Telegram bot and registration-request intake. The main workflow is an authenticated cashier creating an exchange operation: the API validates the request, checks cash availability, and persists the operation; cash-management endpoints handle balances and shifts, while reports and analytics expose operational results. The graph also includes user, currency, notification, and audit capabilities. Source excerpts confirm only selected links; major unsampled app routes are represented without speculative call edges.

Main entry points: [`backend/config/urls.py`](https://github.com/salievyt/my_exchange/blob/main/backend/config/urls.py) (API routing), [`backend/apps/analytics/views.py`](https://github.com/salievyt/my_exchange/blob/main/backend/apps/analytics/views.py) (Analytics), [`backend/apps/reports/views.py`](https://github.com/salievyt/my_exchange/blob/main/backend/apps/reports/views.py) (Reports and exports), [`backend/apps/notifications/views.py`](https://github.com/salievyt/my_exchange/blob/main/backend/apps/notifications/views.py) (Notifications)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Users and access"]
  node_user_api["User API<br/>[views.py]"]
  node_users[("Users and roles<br/>[models.py]")]
end

subgraph group_exchange["Exchange operations"]
  node_currency_api["Currency API<br/>[views.py]"]
  node_currencies[("Currencies and rates<br/>[models.py]")]
  node_operation_api["Operation API<br/>[views.py]"]
  node_operations[("Exchange operations<br/>[models.py]")]
end

subgraph group_cash["Cash management"]
  node_cash_api["Cash API<br/>[views.py]"]
  node_cash_store[("Balances and shifts<br/>[models.py]")]
end

subgraph group_insight["Reporting and audit"]
  node_analytics["Analytics<br/>[views.py]"]
  node_reports["Reports and exports<br/>[views.py]"]
  node_logs["Request audit logs<br/>[middleware.py]"]
  node_log_store[("Log records<br/>[models.py]")]
end

subgraph group_intake["Requests and bot"]
  node_request_api["Registration requests<br/>[views.py]"]
  node_request_store[("Request records<br/>[models.py]")]
  node_request_signals["Request receivers<br/>[receivers.py]"]
  node_notifier["Telegram notifier<br/>[notifier.py]"]
  node_bot_webhook["Bot webhook<br/>[views_webhook.py]"]
  node_bot_store[("Bot configuration<br/>[models.py]")]
  node_notifications["Notifications<br/>[views.py]"]
  node_notification_store[("Notification records<br/>[models.py]")]
end

node_cashier(("Cashier"))
node_api["API routing<br/>[urls.py]"]
node_telegram{{"Telegram"}}

node_cashier -->|"uses API"| node_api
node_api -->|"routes to"| node_user_api
node_api -.->|"routes to"| node_currency_api
node_api -.->|"routes to"| node_operation_api
node_api -.->|"routes to"| node_cash_api
node_api -.->|"routes to"| node_request_api
node_api -.->|"routes to"| node_analytics
node_api -.->|"routes to"| node_reports
node_api -.->|"routes to"| node_notifications
node_user_api -->|"reads and writes"| node_users
node_currency_api -->|"reads and writes"| node_currencies
node_operation_api -->|"reads and writes"| node_operations
node_operation_api -->|"checks balance"| node_cash_store
node_operation_api -->|"uses currency"| node_currencies
node_cash_api -->|"reads and writes"| node_cash_store
node_cash_api -->|"summarizes activity"| node_operations
node_analytics -->|"queries"| node_operations
node_analytics -->|"queries"| node_cash_store
node_analytics -->|"queries"| node_currencies
node_analytics -->|"queries"| node_users
node_reports -->|"queries"| node_operations
node_reports -->|"queries"| node_cash_store
node_reports -->|"queries"| node_currencies
node_reports -->|"queries"| node_users
node_logs -->|"records requests"| node_log_store
node_request_api -.->|"creates requests"| node_request_store
node_request_signals -->|"notifies"| node_notifier
node_notifier -->|"reads admin config"| node_bot_store
node_notifier -->|"sends messages"| node_telegram
node_telegram -->|"posts updates"| node_bot_webhook
node_bot_webhook -->|"reads configuration"| node_bot_store
node_bot_webhook -->|"reads requests"| node_request_store
node_notifications -->|"reads and writes"| node_notification_store
node_notifications -->|"queries"| node_cash_store
node_notifications -->|"queries"| node_operations
node_notifications -->|"queries"| node_users

click node_api "https://github.com/salievyt/my_exchange/blob/main/backend/config/urls.py"
click node_user_api "https://github.com/salievyt/my_exchange/blob/main/backend/apps/users/views.py"
click node_users "https://github.com/salievyt/my_exchange/blob/main/backend/apps/users/models.py"
click node_currency_api "https://github.com/salievyt/my_exchange/blob/main/backend/apps/currencies/views.py"
click node_currencies "https://github.com/salievyt/my_exchange/blob/main/backend/apps/currencies/models.py"
click node_operation_api "https://github.com/salievyt/my_exchange/blob/main/backend/apps/operations/views.py"
click node_operations "https://github.com/salievyt/my_exchange/blob/main/backend/apps/operations/models.py"
click node_cash_api "https://github.com/salievyt/my_exchange/blob/main/backend/apps/cash/views.py"
click node_cash_store "https://github.com/salievyt/my_exchange/blob/main/backend/apps/cash/models.py"
click node_analytics "https://github.com/salievyt/my_exchange/blob/main/backend/apps/analytics/views.py"
click node_reports "https://github.com/salievyt/my_exchange/blob/main/backend/apps/reports/views.py"
click node_logs "https://github.com/salievyt/my_exchange/blob/main/backend/apps/logs/middleware.py"
click node_log_store "https://github.com/salievyt/my_exchange/blob/main/backend/apps/logs/models.py"
click node_request_api "https://github.com/salievyt/my_exchange/blob/main/backend/apps/requests/views.py"
click node_request_store "https://github.com/salievyt/my_exchange/blob/main/backend/apps/requests/models.py"
click node_request_signals "https://github.com/salievyt/my_exchange/blob/main/backend/apps/requests/receivers.py"
click node_notifier "https://github.com/salievyt/my_exchange/blob/main/backend/bot_service/notifier.py"
click node_bot_webhook "https://github.com/salievyt/my_exchange/blob/main/backend/apps/bot/views_webhook.py"
click node_bot_store "https://github.com/salievyt/my_exchange/blob/main/backend/apps/bot/models.py"
click node_notifications "https://github.com/salievyt/my_exchange/blob/main/backend/apps/notifications/views.py"
click node_notification_store "https://github.com/salievyt/my_exchange/blob/main/backend/apps/notifications/models.py"

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_user_api,node_users toneBlue
class node_currency_api,node_currencies,node_operation_api,node_operations toneAmber
class node_cash_api,node_cash_store,node_api toneMint
class node_analytics,node_reports,node_logs,node_log_store toneRose
class node_request_api,node_request_store,node_request_signals,node_notifier,node_bot_webhook,node_bot_store,node_notifications,node_notification_store,node_cashier,node_telegram toneIndigo
```

## Components

### Users and access

- [User API](https://github.com/salievyt/my_exchange/blob/main/backend/apps/users/views.py): `backend/apps/users/views.py`
- [Users and roles](https://github.com/salievyt/my_exchange/blob/main/backend/apps/users/models.py): `backend/apps/users/models.py`

### Exchange operations

- [Currency API](https://github.com/salievyt/my_exchange/blob/main/backend/apps/currencies/views.py): `backend/apps/currencies/views.py`
- [Currencies and rates](https://github.com/salievyt/my_exchange/blob/main/backend/apps/currencies/models.py): `backend/apps/currencies/models.py`
- [Operation API](https://github.com/salievyt/my_exchange/blob/main/backend/apps/operations/views.py): `backend/apps/operations/views.py`
- [Exchange operations](https://github.com/salievyt/my_exchange/blob/main/backend/apps/operations/models.py): `backend/apps/operations/models.py`

### Cash management

- [Cash API](https://github.com/salievyt/my_exchange/blob/main/backend/apps/cash/views.py): `backend/apps/cash/views.py`
- [Balances and shifts](https://github.com/salievyt/my_exchange/blob/main/backend/apps/cash/models.py): `backend/apps/cash/models.py`

### Reporting and audit

- [Analytics](https://github.com/salievyt/my_exchange/blob/main/backend/apps/analytics/views.py): `backend/apps/analytics/views.py`
- [Reports and exports](https://github.com/salievyt/my_exchange/blob/main/backend/apps/reports/views.py): `backend/apps/reports/views.py`
- [Request audit logs](https://github.com/salievyt/my_exchange/blob/main/backend/apps/logs/middleware.py): `backend/apps/logs/middleware.py`
- [Log records](https://github.com/salievyt/my_exchange/blob/main/backend/apps/logs/models.py): `backend/apps/logs/models.py`

### Requests and bot

- [Registration requests](https://github.com/salievyt/my_exchange/blob/main/backend/apps/requests/views.py): `backend/apps/requests/views.py`
- [Request records](https://github.com/salievyt/my_exchange/blob/main/backend/apps/requests/models.py): `backend/apps/requests/models.py`
- [Request receivers](https://github.com/salievyt/my_exchange/blob/main/backend/apps/requests/receivers.py): `backend/apps/requests/receivers.py`
- [Telegram notifier](https://github.com/salievyt/my_exchange/blob/main/backend/bot_service/notifier.py): `backend/bot_service/notifier.py`
- [Bot webhook](https://github.com/salievyt/my_exchange/blob/main/backend/apps/bot/views_webhook.py): `backend/apps/bot/views_webhook.py`
- [Bot configuration](https://github.com/salievyt/my_exchange/blob/main/backend/apps/bot/models.py): `backend/apps/bot/models.py`
- [Notifications](https://github.com/salievyt/my_exchange/blob/main/backend/apps/notifications/views.py): `backend/apps/notifications/views.py`
- [Notification records](https://github.com/salievyt/my_exchange/blob/main/backend/apps/notifications/models.py): `backend/apps/notifications/models.py`

### Other components

- **Cashier**
- [API routing](https://github.com/salievyt/my_exchange/blob/main/backend/config/urls.py): `backend/config/urls.py`
- **Telegram**

## Connections

- Cashier → API routing: uses API (evidence: `backend/config/urls.py`)
- API routing → User API: routes to (evidence: `backend/config/urls.py`)
- API routing → Currency API: routes to
- API routing → Operation API: routes to
- API routing → Cash API: routes to
- API routing → Registration requests: routes to
- API routing → Analytics: routes to
- API routing → Reports and exports: routes to
- API routing → Notifications: routes to
- User API → Users and roles: reads and writes (evidence: `backend/apps/users/views.py`)
- Currency API → Currencies and rates: reads and writes (evidence: `backend/apps/currencies/views.py`)
- Operation API → Exchange operations: reads and writes (evidence: `backend/apps/operations/views.py`)
- Operation API → Balances and shifts: checks balance (evidence: `backend/apps/operations/views.py`)
- Operation API → Currencies and rates: uses currency (evidence: `backend/apps/operations/views.py`)
- Cash API → Balances and shifts: reads and writes (evidence: `backend/apps/cash/views.py`)
- Cash API → Exchange operations: summarizes activity (evidence: `backend/apps/cash/views.py`)
- Analytics → Exchange operations: queries (evidence: `backend/apps/analytics/views.py`)
- Analytics → Balances and shifts: queries (evidence: `backend/apps/analytics/views.py`)
- Analytics → Currencies and rates: queries (evidence: `backend/apps/analytics/views.py`)
- Analytics → Users and roles: queries (evidence: `backend/apps/analytics/views.py`)
- Reports and exports → Exchange operations: queries (evidence: `backend/apps/reports/views.py`)
- Reports and exports → Balances and shifts: queries (evidence: `backend/apps/reports/views.py`)
- Reports and exports → Currencies and rates: queries (evidence: `backend/apps/reports/views.py`)
- Reports and exports → Users and roles: queries (evidence: `backend/apps/reports/views.py`)
- Request audit logs → Log records: records requests (evidence: `backend/apps/logs/middleware.py`)
- Registration requests → Request records: creates requests
- Request receivers → Telegram notifier: notifies (evidence: `backend/apps/requests/receivers.py`)
- Telegram notifier → Bot configuration: reads admin config (evidence: `backend/bot_service/notifier.py`)
- Telegram notifier → Telegram: sends messages (evidence: `backend/bot_service/notifier.py`)
- Telegram → Bot webhook: posts updates (evidence: `backend/apps/bot/views_webhook.py`)
- Bot webhook → Bot configuration: reads configuration (evidence: `backend/apps/bot/views_webhook.py`)
- Bot webhook → Request records: reads requests (evidence: `backend/apps/bot/views_webhook.py`)
- Notifications → Notification records: reads and writes (evidence: `backend/apps/notifications/views.py`)
- Notifications → Balances and shifts: queries (evidence: `backend/apps/notifications/views.py`)
- Notifications → Exchange operations: queries (evidence: `backend/apps/notifications/views.py`)
- Notifications → Users and roles: queries (evidence: `backend/apps/notifications/views.py`)
