# derber-q/gamebat_crm architecture

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

- Interactive diagram: https://gitdiagram.com/derber-q/gamebat_crm
- Repository: https://github.com/derber-q/gamebat_crm

## Overview

ReSOURCE / GameBAT CRM is a Django-based internal retail and wholesale operations system, with server-rendered pages and JavaScript enhancements rather than a SPA. Its main operational flow covers product and partner records, purchasing and trip arrival, warehouse stock and consignment, then sales and separate cash or debt accounting. Distinct product branches include marketplace integrations, storefronts, digital commerce, Telegram workflows, backups, and remote printing. The README documents these capabilities and accounting rules; sampled source supports the storage-location and digital-commerce details, but many other implementations were not inspected.

Main entry points: [`sales/services.py`](https://github.com/derber-q/gamebat_crm/blob/main/sales/services.py) (Sales & Statistics), [`GameBAT_CRM/urls.py`](https://github.com/derber-q/gamebat_crm/blob/main/GameBAT_CRM/urls.py) (CRM Web), [`warehouse/models.py`](https://github.com/derber-q/gamebat_crm/blob/main/warehouse/models.py) (Warehouse Stock), [`digital_sales/services.py`](https://github.com/derber-q/gamebat_crm/blob/main/digital_sales/services.py) (Digital Sales)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_master_data["Catalog &amp; Partners"]
  node_catalog[("Product Catalog<br/>[models.py]")]
  node_partners[("Partners<br/>[models.py]")]
end

subgraph group_operations["Supply &amp; Inventory"]
  node_orders["Purchasing &amp; Trips<br/>[services.py]"]
  node_receipts["Supply Receiving<br/>[services.py]"]
  node_warehouse[("Warehouse Stock<br/>[models.py]")]
  node_storage["Storage Locations"]
  node_consignment["Consignment<br/>[services.py]"]
end

subgraph group_commerce["Sales &amp; Finance"]
  node_sales[("Sales &amp; Statistics<br/>[services.py]")]
  node_cash[("Cash &amp; Safes<br/>[services.py]")]
  node_creditors[("Partner Debts<br/>[services.py]")]
  node_pricing["Pricing &amp; FBS<br/>[services.py]"]
end

subgraph group_channels["Digital &amp; Channels"]
  node_storefront["Storefronts<br/>[retail_views.py]"]
  node_marketplace["Yandex Market<br/>[services.py]"]
  node_integrations["External Integrations<br/>[services.py]"]
  node_digital_prices["Digital Prices API<br/>[api.py]"]
  node_digital_shop[("Digital Shop<br/>[services.py]")]
  node_digital_sales[("Digital Sales<br/>[services.py]")]
  node_telegram["Telegram Bots<br/>[handlers.py]"]
  node_wholesale_bot["Wholesale Bot<br/>[handlers.py]"]
end

subgraph group_support["Operations Support"]
  node_backups["CRM Backups<br/>[snapshot.py]"]
  node_local_agent["Local Agent<br/>[runtime.py]"]
  node_print_agent["Print Agent<br/>[engine.py]"]
end

node_staff(("CRM Staff"))
node_crm["CRM Web<br/>[urls.py]"]

node_staff -->|"uses"| node_crm
node_crm -.->|"maintains"| node_catalog
node_crm -.->|"maintains"| node_partners
node_orders -->|"arrives as"| node_receipts
node_receipts -->|"records stock"| node_warehouse
node_warehouse -->|"tracks products"| node_catalog
node_storage -->|"assigns locations"| node_warehouse
node_sales -->|"deducts stock"| node_warehouse
node_sales -->|"tracks batches"| node_consignment
node_sales -->|"records cash"| node_cash
node_sales -->|"tracks debt"| node_creditors
node_pricing -.->|"sets FBS prices"| node_marketplace
node_integrations -->|"integrates"| node_marketplace
node_storefront -.->|"serves buyers"| node_partners
node_digital_prices -.->|"provides prices"| node_digital_shop
node_digital_shop -->|"reserves orders"| node_digital_sales
node_digital_sales -->|"creates sales"| node_sales
node_telegram -.->|"handles orders"| node_digital_sales
node_wholesale_bot -.->|"creates wholesale sales"| node_sales
node_crm -.->|"backs up data"| node_backups
node_print_agent -.->|"runs locally"| node_local_agent

click node_crm "https://github.com/derber-q/gamebat_crm/blob/main/GameBAT_CRM/urls.py"
click node_catalog "https://github.com/derber-q/gamebat_crm/blob/main/catalog/models.py"
click node_partners "https://github.com/derber-q/gamebat_crm/blob/main/partners/models.py"
click node_orders "https://github.com/derber-q/gamebat_crm/blob/main/orders/services.py"
click node_receipts "https://github.com/derber-q/gamebat_crm/blob/main/supplies/services.py"
click node_warehouse "https://github.com/derber-q/gamebat_crm/blob/main/warehouse/models.py"
click node_storage "https://github.com/derber-q/gamebat_crm/blob/main/warehouse/storage_services.py"
click node_consignment "https://github.com/derber-q/gamebat_crm/blob/main/consignment/services.py"
click node_sales "https://github.com/derber-q/gamebat_crm/blob/main/sales/services.py"
click node_cash "https://github.com/derber-q/gamebat_crm/blob/main/cash/services.py"
click node_creditors "https://github.com/derber-q/gamebat_crm/blob/main/creditors/services.py"
click node_pricing "https://github.com/derber-q/gamebat_crm/blob/main/pricing/services.py"
click node_storefront "https://github.com/derber-q/gamebat_crm/blob/main/resource_storefront/retail_views.py"
click node_marketplace "https://github.com/derber-q/gamebat_crm/blob/main/yandex_market/services.py"
click node_integrations "https://github.com/derber-q/gamebat_crm/blob/main/integrations/services.py"
click node_digital_prices "https://github.com/derber-q/gamebat_crm/blob/main/digital_prices/api.py"
click node_digital_shop "https://github.com/derber-q/gamebat_crm/blob/main/digital_shop/services.py"
click node_digital_sales "https://github.com/derber-q/gamebat_crm/blob/main/digital_sales/services.py"
click node_telegram "https://github.com/derber-q/gamebat_crm/blob/main/telegram_bots/handlers.py"
click node_wholesale_bot "https://github.com/derber-q/gamebat_crm/blob/main/wholesale_bot/handlers.py"
click node_backups "https://github.com/derber-q/gamebat_crm/blob/main/crm_backups/snapshot.py"
click node_local_agent "https://github.com/derber-q/gamebat_crm/blob/main/local_agent/runtime.py"
click node_print_agent "https://github.com/derber-q/gamebat_crm/blob/main/print_agent/engine.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_catalog,node_partners toneBlue
class node_orders,node_receipts,node_warehouse,node_storage,node_consignment toneAmber
class node_sales,node_cash,node_creditors,node_pricing toneMint
class node_storefront,node_marketplace,node_integrations,node_digital_prices,node_digital_shop,node_digital_sales,node_telegram,node_wholesale_bot toneRose
class node_backups,node_local_agent,node_print_agent,node_staff toneIndigo
class node_crm toneTeal
```

## Components

### Catalog & Partners

- [Product Catalog](https://github.com/derber-q/gamebat_crm/blob/main/catalog/models.py): `catalog/models.py`
- [Partners](https://github.com/derber-q/gamebat_crm/blob/main/partners/models.py): `partners/models.py`

### Supply & Inventory

- [Purchasing & Trips](https://github.com/derber-q/gamebat_crm/blob/main/orders/services.py): `orders/services.py`
- [Supply Receiving](https://github.com/derber-q/gamebat_crm/blob/main/supplies/services.py): `supplies/services.py`
- [Warehouse Stock](https://github.com/derber-q/gamebat_crm/blob/main/warehouse/models.py): `warehouse/models.py`
- [Storage Locations](https://github.com/derber-q/gamebat_crm/blob/main/warehouse/storage_services.py): `warehouse/storage_services.py`
- [Consignment](https://github.com/derber-q/gamebat_crm/blob/main/consignment/services.py): `consignment/services.py`

### Sales & Finance

- [Sales & Statistics](https://github.com/derber-q/gamebat_crm/blob/main/sales/services.py): `sales/services.py`
- [Cash & Safes](https://github.com/derber-q/gamebat_crm/blob/main/cash/services.py): `cash/services.py`
- [Partner Debts](https://github.com/derber-q/gamebat_crm/blob/main/creditors/services.py): `creditors/services.py`
- [Pricing & FBS](https://github.com/derber-q/gamebat_crm/blob/main/pricing/services.py): `pricing/services.py`

### Digital & Channels

- [Storefronts](https://github.com/derber-q/gamebat_crm/blob/main/resource_storefront/retail_views.py): `resource_storefront/retail_views.py`
- [Yandex Market](https://github.com/derber-q/gamebat_crm/blob/main/yandex_market/services.py): `yandex_market/services.py`
- [External Integrations](https://github.com/derber-q/gamebat_crm/blob/main/integrations/services.py): `integrations/services.py`
- [Digital Prices API](https://github.com/derber-q/gamebat_crm/blob/main/digital_prices/api.py): `digital_prices/api.py`
- [Digital Shop](https://github.com/derber-q/gamebat_crm/blob/main/digital_shop/services.py): `digital_shop/services.py`
- [Digital Sales](https://github.com/derber-q/gamebat_crm/blob/main/digital_sales/services.py): `digital_sales/services.py`
- [Telegram Bots](https://github.com/derber-q/gamebat_crm/blob/main/telegram_bots/handlers.py): `telegram_bots/handlers.py`
- [Wholesale Bot](https://github.com/derber-q/gamebat_crm/blob/main/wholesale_bot/handlers.py): `wholesale_bot/handlers.py`

### Operations Support

- [CRM Backups](https://github.com/derber-q/gamebat_crm/blob/main/crm_backups/snapshot.py): `crm_backups/snapshot.py`
- [Local Agent](https://github.com/derber-q/gamebat_crm/blob/main/local_agent/runtime.py): `local_agent/runtime.py`
- [Print Agent](https://github.com/derber-q/gamebat_crm/blob/main/print_agent/engine.py): `print_agent/engine.py`

### Other components

- **CRM Staff**
- [CRM Web](https://github.com/derber-q/gamebat_crm/blob/main/GameBAT_CRM/urls.py): `GameBAT_CRM/urls.py`

## Connections

- CRM Staff → CRM Web: uses (evidence: `README.md`)
- CRM Web → Product Catalog: maintains
- CRM Web → Partners: maintains
- Purchasing & Trips → Supply Receiving: arrives as (evidence: `README.md`)
- Supply Receiving → Warehouse Stock: records stock (evidence: `README.md`)
- Warehouse Stock → Product Catalog: tracks products (evidence: `catalog/models.py`)
- Storage Locations → Warehouse Stock: assigns locations (evidence: `warehouse/storage_services.py`)
- Sales & Statistics → Warehouse Stock: deducts stock (evidence: `README.md`)
- Sales & Statistics → Consignment: tracks batches (evidence: `README.md`)
- Sales & Statistics → Cash & Safes: records cash (evidence: `README.md`)
- Sales & Statistics → Partner Debts: tracks debt (evidence: `README.md`)
- Pricing & FBS → Yandex Market: sets FBS prices
- External Integrations → Yandex Market: integrates (evidence: `README.md`)
- Storefronts → Partners: serves buyers
- Digital Prices API → Digital Shop: provides prices (evidence: `digital_shop/services.py`)
- Digital Shop → Digital Sales: reserves orders (evidence: `digital_shop/services.py`)
- Digital Sales → Sales & Statistics: creates sales (evidence: `digital_sales/services.py`)
- Telegram Bots → Digital Sales: handles orders
- Wholesale Bot → Sales & Statistics: creates wholesale sales
- CRM Web → CRM Backups: backs up data
- Print Agent → Local Agent: runs locally
