# bonfacegabriel/inventory-management architecture

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

## Overview

This is a payment and inventory management system with a React client and Django API. Its principal workflow turns incoming payment messages into transactions, then exposes transaction status to users through the API and real-time updates. Separate workflows cover manual payments, order fulfillment and stock movements, reconciliation and reporting, and analytics. The README documents these capabilities; source excerpts and the SOURCE INDEX support selected internal links. Several frontend pages and backend services are indexed but unsampled, so their implementation details and unshown calls are not inferred.

Main entry points: [`frontend/src/services/api.ts`](https://github.com/bonfacegabriel/inventory-management/blob/main/frontend/src/services/api.ts) (API client), [`backend/payments/models.py`](https://github.com/bonfacegabriel/inventory-management/blob/main/backend/payments/models.py) (Transactions and products), [`frontend/src/App.tsx`](https://github.com/bonfacegabriel/inventory-management/blob/main/frontend/src/App.tsx) (React application), [`backend/payments/tasks.py`](https://github.com/bonfacegabriel/inventory-management/blob/main/backend/payments/tasks.py) (Message processing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_app["React application<br/>[App.tsx]"]
  node_auth["Authentication<br/>[AuthContext.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
  node_transactions_ui["Transactions UI"]
  node_reports_ui["Reports UI<br/>[ReportsPage.tsx]"]
  node_stock_ui["Stock reporting"]
  node_fulfillment_ui["Fulfillment UI"]
  node_frontend_ws["WebSocket client"]
end

subgraph group_ingest["Payment processing"]
  node_api["REST API"]
  node_gateway["Payment gateways<br/>[models.py]"]
  node_parser["SMS parser<br/>[parsers.py]"]
  node_worker["Message processing<br/>[tasks.py]"]
  node_manual["Manual payments"]
  node_celery["Async task queue<br/>[tasks.py]"]
end

subgraph group_commerce["Orders and inventory"]
  node_domain[("Transactions and products<br/>[models.py]")]
  node_orders["Order fulfillment"]
  node_merch["Merchandise services"]
end

subgraph group_reporting["Reporting and insights"]
  node_recon["Reconciliation"]
  node_analytics["Analytics services<br/>[bi_core_service.py]"]
  node_bi_bot["BI assistant<br/>[bi_telegram_bot.py]"]
end

subgraph group_realtime["Real-time delivery"]
  node_ws["WebSocket updates<br/>[consumers.py]"]
end

node_user(("System user"))
node_sms["Payment SMS"]

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_transactions_ui
node_app -->|"routes to"| node_reports_ui
node_app -->|"routes to"| node_stock_ui
node_app -->|"routes to"| node_fulfillment_ui
node_auth -->|"requests profile"| node_api_client
node_transactions_ui -.->|"loads transactions"| node_api_client
node_reports_ui -.->|"requests reports"| node_api_client
node_stock_ui -.->|"requests stock data"| node_api_client
node_fulfillment_ui -.->|"requests fulfillment"| node_api_client
node_api_client -->|"HTTP requests"| node_api
node_sms -->|"parsed by"| node_parser
node_worker -->|"parses message"| node_parser
node_worker -->|"creates transactions"| node_domain
node_worker -.->|"runs asynchronously"| node_celery
node_api -.->|"supports entry"| node_manual
node_manual -.->|"records payment"| node_domain
node_orders -->|"updates stock"| node_domain
node_orders -->|"applies promotions"| node_merch
node_recon -->|"queries transactions"| node_domain
node_analytics -->|"aggregates sales"| node_domain
node_bi_bot -->|"requests insights"| node_analytics
node_worker -->|"broadcasts updates"| node_ws
node_ws -->|"serializes transactions"| node_domain
node_frontend_ws -.->|"receives updates"| node_ws

click node_app "https://github.com/bonfacegabriel/inventory-management/blob/main/frontend/src/App.tsx"
click node_auth "https://github.com/bonfacegabriel/inventory-management/blob/main/frontend/src/contexts/AuthContext.tsx"
click node_api_client "https://github.com/bonfacegabriel/inventory-management/blob/main/frontend/src/services/api.ts"
click node_transactions_ui "https://github.com/bonfacegabriel/inventory-management/blob/main/frontend/src/pages/TransactionsPage.tsx"
click node_reports_ui "https://github.com/bonfacegabriel/inventory-management/blob/main/frontend/src/pages/ReportsPage.tsx"
click node_stock_ui "https://github.com/bonfacegabriel/inventory-management/blob/main/frontend/src/pages/StockReportPage.tsx"
click node_fulfillment_ui "https://github.com/bonfacegabriel/inventory-management/blob/main/frontend/src/pages/MerchandiseFulfillmentPage.tsx"
click node_api "https://github.com/bonfacegabriel/inventory-management/tree/main/backend/payments"
click node_gateway "https://github.com/bonfacegabriel/inventory-management/blob/main/backend/payments/models.py"
click node_parser "https://github.com/bonfacegabriel/inventory-management/blob/main/backend/payments/parsers.py"
click node_worker "https://github.com/bonfacegabriel/inventory-management/blob/main/backend/payments/tasks.py"
click node_domain "https://github.com/bonfacegabriel/inventory-management/blob/main/backend/payments/models.py"
click node_manual "https://github.com/bonfacegabriel/inventory-management/blob/main/backend/payments/services/manual_payment_service.py"
click node_orders "https://github.com/bonfacegabriel/inventory-management/blob/main/backend/payments/services/fulfillment_service.py"
click node_merch "https://github.com/bonfacegabriel/inventory-management/blob/main/backend/payments/services/merchandise_service.py"
click node_recon "https://github.com/bonfacegabriel/inventory-management/blob/main/backend/payments/services/reconciliation_v2_service.py"
click node_analytics "https://github.com/bonfacegabriel/inventory-management/blob/main/backend/payments/services/bi_core_service.py"
click node_bi_bot "https://github.com/bonfacegabriel/inventory-management/blob/main/backend/payments/bi_telegram_bot.py"
click node_celery "https://github.com/bonfacegabriel/inventory-management/blob/main/backend/payments/tasks.py"
click node_ws "https://github.com/bonfacegabriel/inventory-management/blob/main/backend/payments/consumers.py"
click node_frontend_ws "https://github.com/bonfacegabriel/inventory-management/blob/main/frontend/src/contexts/WebSocketContext.tsx"

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_app,node_auth,node_api_client,node_transactions_ui,node_reports_ui,node_stock_ui,node_fulfillment_ui,node_frontend_ws,node_user toneBlue
class node_api,node_gateway,node_parser,node_worker,node_manual,node_celery toneAmber
class node_domain,node_orders,node_merch toneMint
class node_recon,node_analytics,node_bi_bot toneRose
class node_ws,node_sms toneIndigo
```

## Components

### Web client

- [React application](https://github.com/bonfacegabriel/inventory-management/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Authentication](https://github.com/bonfacegabriel/inventory-management/blob/main/frontend/src/contexts/AuthContext.tsx): `frontend/src/contexts/AuthContext.tsx`
- [API client](https://github.com/bonfacegabriel/inventory-management/blob/main/frontend/src/services/api.ts): `frontend/src/services/api.ts`
- [Transactions UI](https://github.com/bonfacegabriel/inventory-management/blob/main/frontend/src/pages/TransactionsPage.tsx): `frontend/src/pages/TransactionsPage.tsx`
- [Reports UI](https://github.com/bonfacegabriel/inventory-management/blob/main/frontend/src/pages/ReportsPage.tsx): `frontend/src/pages/ReportsPage.tsx`
- [Stock reporting](https://github.com/bonfacegabriel/inventory-management/blob/main/frontend/src/pages/StockReportPage.tsx): `frontend/src/pages/StockReportPage.tsx`
- [Fulfillment UI](https://github.com/bonfacegabriel/inventory-management/blob/main/frontend/src/pages/MerchandiseFulfillmentPage.tsx): `frontend/src/pages/MerchandiseFulfillmentPage.tsx`
- [WebSocket client](https://github.com/bonfacegabriel/inventory-management/blob/main/frontend/src/contexts/WebSocketContext.tsx): `frontend/src/contexts/WebSocketContext.tsx`

### Payment processing

- [REST API](https://github.com/bonfacegabriel/inventory-management/tree/main/backend/payments): `backend/payments`
- [Payment gateways](https://github.com/bonfacegabriel/inventory-management/blob/main/backend/payments/models.py): `backend/payments/models.py`
- [SMS parser](https://github.com/bonfacegabriel/inventory-management/blob/main/backend/payments/parsers.py): `backend/payments/parsers.py`
- [Message processing](https://github.com/bonfacegabriel/inventory-management/blob/main/backend/payments/tasks.py): `backend/payments/tasks.py`
- [Manual payments](https://github.com/bonfacegabriel/inventory-management/blob/main/backend/payments/services/manual_payment_service.py): `backend/payments/services/manual_payment_service.py`
- [Async task queue](https://github.com/bonfacegabriel/inventory-management/blob/main/backend/payments/tasks.py): `backend/payments/tasks.py`

### Orders and inventory

- [Transactions and products](https://github.com/bonfacegabriel/inventory-management/blob/main/backend/payments/models.py): `backend/payments/models.py`
- [Order fulfillment](https://github.com/bonfacegabriel/inventory-management/blob/main/backend/payments/services/fulfillment_service.py): `backend/payments/services/fulfillment_service.py`
- [Merchandise services](https://github.com/bonfacegabriel/inventory-management/blob/main/backend/payments/services/merchandise_service.py): `backend/payments/services/merchandise_service.py`

### Reporting and insights

- [Reconciliation](https://github.com/bonfacegabriel/inventory-management/blob/main/backend/payments/services/reconciliation_v2_service.py): `backend/payments/services/reconciliation_v2_service.py`
- [Analytics services](https://github.com/bonfacegabriel/inventory-management/blob/main/backend/payments/services/bi_core_service.py): `backend/payments/services/bi_core_service.py`
- [BI assistant](https://github.com/bonfacegabriel/inventory-management/blob/main/backend/payments/bi_telegram_bot.py): `backend/payments/bi_telegram_bot.py`

### Real-time delivery

- [WebSocket updates](https://github.com/bonfacegabriel/inventory-management/blob/main/backend/payments/consumers.py): `backend/payments/consumers.py`

### Other components

- **System user**
- **Payment SMS**

## Connections

- System user → React application: uses
- React application → Transactions UI: routes to (evidence: `frontend/src/App.tsx`)
- React application → Reports UI: routes to (evidence: `frontend/src/App.tsx`)
- React application → Stock reporting: routes to (evidence: `frontend/src/App.tsx`)
- React application → Fulfillment UI: routes to (evidence: `frontend/src/App.tsx`)
- Authentication → API client: requests profile (evidence: `frontend/src/contexts/AuthContext.tsx`)
- Transactions UI → API client: loads transactions
- Reports UI → API client: requests reports
- Stock reporting → API client: requests stock data
- Fulfillment UI → API client: requests fulfillment
- API client → REST API: HTTP requests
- Payment SMS → SMS parser: parsed by
- Message processing → SMS parser: parses message (evidence: `backend/payments/tasks.py`)
- Message processing → Transactions and products: creates transactions (evidence: `backend/payments/tasks.py`)
- Message processing → Async task queue: runs asynchronously (evidence: `backend/payments/tasks.py`)
- REST API → Manual payments: supports entry
- Manual payments → Transactions and products: records payment
- Order fulfillment → Transactions and products: updates stock (evidence: `backend/payments/services/fulfillment_service.py`)
- Order fulfillment → Merchandise services: applies promotions (evidence: `backend/payments/services/fulfillment_service.py`)
- Reconciliation → Transactions and products: queries transactions (evidence: `backend/payments/services/reconciliation_v2_service.py`)
- Analytics services → Transactions and products: aggregates sales (evidence: `backend/payments/services/bi_core_service.py`)
- BI assistant → Analytics services: requests insights (evidence: `backend/payments/bi_telegram_bot.py`)
- Message processing → WebSocket updates: broadcasts updates (evidence: `backend/payments/tasks.py`)
- WebSocket updates → Transactions and products: serializes transactions (evidence: `backend/payments/consumers.py`)
- WebSocket client → WebSocket updates: receives updates
