# rahulshamra/bizmind-ai- architecture

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

- Interactive diagram: https://gitdiagram.com/rahulshamra/bizmind-ai-
- Repository: https://github.com/rahulshamra/bizmind-ai-

## Overview

BizMind AI is a business-intelligence dashboard for customer risk segmentation, demand/revenue forecasting, analytics, and AI chat. Users enter through the dashboard’s routed pages: views load dashboard or prediction data, customers can browse risk segments or submit an individual prediction, and forecasts expose product-level demand and history. The sampled code confirms customer and demand API/model paths and frontend calls; chat, analytics services, and RAG internals are present in the tree but unsampled, so their internal links are omitted or shown as unverified.

Main entry points: [`frontend/src/App.jsx`](https://github.com/rahulshamra/bizmind-ai-/blob/main/frontend/src/App.jsx) (Page router), [`backend/app/api/routes/customer_routes.py`](https://github.com/rahulshamra/bizmind-ai-/blob/main/backend/app/api/routes/customer_routes.py) (Customer endpoints), [`frontend/src/pages/Predictions.jsx`](https://github.com/rahulshamra/bizmind-ai-/blob/main/frontend/src/pages/Predictions.jsx) (Forecast view), [`backend/app/api/routes/demand_routes.py`](https://github.com/rahulshamra/bizmind-ai-/blob/main/backend/app/api/routes/demand_routes.py) (Demand endpoints)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Web dashboard"]
  node_app["Page router<br/>[App.jsx]"]
  node_dashboard["Overview<br/>[Dashboard.jsx]"]
  node_customers["Customer view<br/>[Customers.jsx]"]
  node_predictions["Forecast view<br/>[Predictions.jsx]"]
  node_analytics["Analytics view<br/>[Analytics.jsx]"]
  node_chatview["Chat view<br/>[Chat.jsx]"]
  node_customerchart["Risk chart"]
  node_segmentform["Segment predictor"]
  node_api_client["API client<br/>[api.js]"]
  node_mock["Mock responses<br/>[mockData.js]"]
end

subgraph group_api["API application"]
  node_backend["FastAPI app<br/>[main.py]"]
  node_customer_api["Customer endpoints<br/>[customer_routes.py]"]
  node_demand_api["Demand endpoints<br/>[demand_routes.py]"]
end

subgraph group_ml["Prediction models"]
  node_customer_ml["Customer segmentation"]
  node_demand_ml["Demand forecasting"]
  node_model_loader["Model loading<br/>[model_loader.py]"]
  node_revenue_ml["30-day prediction"]
end

subgraph group_ai["AI assistance"]
  node_chat_ai["AI agent and chains<br/>[agent.py]"]
  node_chat_service["Chat service<br/>[chat_service.py]"]
  node_rag["RAG retrieval<br/>[retriever.py]"]
  node_embeddings["Embeddings<br/>[embeddings.py]"]
  node_ingestion["Knowledge ingestion<br/>[ingestion.py]"]
end

subgraph group_data["Data services"]
  node_vector_store[("Vector store<br/>[vector_store.py]")]
  node_database[("Database setup<br/>[database.py]")]
  node_analytics_service["Analytics service"]
end

node_user(("Business user"))

node_user -->|"opens"| node_app
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_customers
node_app -->|"routes to"| node_predictions
node_app -->|"routes to"| node_analytics
node_app -->|"routes to"| node_chatview
node_customers -->|"renders"| node_customerchart
node_customers -->|"renders"| node_segmentform
node_dashboard -->|"requests data"| node_api_client
node_predictions -->|"requests forecast"| node_api_client
node_api_client -->|"uses fallback"| node_mock
node_customerchart -->|"fetches graph"| node_customer_api
node_segmentform -->|"submits prediction"| node_customer_api
node_predictions -->|"fetches forecasts"| node_demand_api
node_backend -->|"registers routes"| node_customer_api
node_backend -->|"registers routes"| node_demand_api
node_backend -->|"loads models"| node_model_loader
node_customer_api -->|"calls predictions"| node_customer_ml
node_demand_api -->|"calls forecasts"| node_demand_ml
node_customer_api -.->|"reads loaded model"| node_model_loader
node_demand_api -.->|"reads loaded model"| node_model_loader
node_chatview -.->|"uses chat"| node_chat_ai
node_chat_ai -.->|"delegates"| node_chat_service
node_chat_service -.->|"retrieves context"| node_rag
node_rag -.->|"embeds queries"| node_embeddings
node_ingestion -.->|"creates vectors"| node_embeddings
node_ingestion -.->|"stores vectors"| node_vector_store
node_rag -.->|"searches vectors"| node_vector_store
node_predictions -.->|"offers 30-day forecast"| node_revenue_ml
node_analytics -.->|"loads analytics"| node_analytics_service

click node_app "https://github.com/rahulshamra/bizmind-ai-/blob/main/frontend/src/App.jsx"
click node_dashboard "https://github.com/rahulshamra/bizmind-ai-/blob/main/frontend/src/pages/Dashboard.jsx"
click node_customers "https://github.com/rahulshamra/bizmind-ai-/blob/main/frontend/src/pages/Customers.jsx"
click node_predictions "https://github.com/rahulshamra/bizmind-ai-/blob/main/frontend/src/pages/Predictions.jsx"
click node_analytics "https://github.com/rahulshamra/bizmind-ai-/blob/main/frontend/src/pages/Analytics.jsx"
click node_chatview "https://github.com/rahulshamra/bizmind-ai-/blob/main/frontend/src/pages/Chat.jsx"
click node_customerchart "https://github.com/rahulshamra/bizmind-ai-/blob/main/frontend/src/components/CustomerSegmentChart.jsx"
click node_segmentform "https://github.com/rahulshamra/bizmind-ai-/blob/main/frontend/src/components/SegmentPredictor.jsx"
click node_api_client "https://github.com/rahulshamra/bizmind-ai-/blob/main/frontend/src/services/api.js"
click node_mock "https://github.com/rahulshamra/bizmind-ai-/blob/main/frontend/src/data/mockData.js"
click node_backend "https://github.com/rahulshamra/bizmind-ai-/blob/main/backend/app/main.py"
click node_customer_api "https://github.com/rahulshamra/bizmind-ai-/blob/main/backend/app/api/routes/customer_routes.py"
click node_demand_api "https://github.com/rahulshamra/bizmind-ai-/blob/main/backend/app/api/routes/demand_routes.py"
click node_customer_ml "https://github.com/rahulshamra/bizmind-ai-/blob/main/backend/app/ml/customer_segmentation.py"
click node_demand_ml "https://github.com/rahulshamra/bizmind-ai-/blob/main/backend/app/ml/demand_forecasting.py"
click node_model_loader "https://github.com/rahulshamra/bizmind-ai-/blob/main/backend/app/ml/model_loader.py"
click node_revenue_ml "https://github.com/rahulshamra/bizmind-ai-/blob/main/backend/app/ml/next30_predection.py"
click node_chat_ai "https://github.com/rahulshamra/bizmind-ai-/blob/main/backend/app/ai/agent.py"
click node_chat_service "https://github.com/rahulshamra/bizmind-ai-/blob/main/backend/app/services/chat_service.py"
click node_rag "https://github.com/rahulshamra/bizmind-ai-/blob/main/backend/app/rag/retriever.py"
click node_embeddings "https://github.com/rahulshamra/bizmind-ai-/blob/main/backend/app/rag/embeddings.py"
click node_ingestion "https://github.com/rahulshamra/bizmind-ai-/blob/main/backend/app/rag/ingestion.py"
click node_vector_store "https://github.com/rahulshamra/bizmind-ai-/blob/main/backend/app/rag/vector_store.py"
click node_database "https://github.com/rahulshamra/bizmind-ai-/blob/main/backend/app/database.py"
click node_analytics_service "https://github.com/rahulshamra/bizmind-ai-/blob/main/backend/app/services/analytics_service.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_app,node_dashboard,node_customers,node_predictions,node_analytics,node_chatview,node_customerchart,node_segmentform,node_api_client,node_mock,node_user toneBlue
class node_backend,node_customer_api,node_demand_api toneAmber
class node_customer_ml,node_demand_ml,node_model_loader,node_revenue_ml toneMint
class node_chat_ai,node_chat_service,node_rag,node_embeddings,node_ingestion toneRose
class node_vector_store,node_database,node_analytics_service toneIndigo
```

## Components

### Web dashboard

- [Page router](https://github.com/rahulshamra/bizmind-ai-/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Overview](https://github.com/rahulshamra/bizmind-ai-/blob/main/frontend/src/pages/Dashboard.jsx): `frontend/src/pages/Dashboard.jsx`
- [Customer view](https://github.com/rahulshamra/bizmind-ai-/blob/main/frontend/src/pages/Customers.jsx): `frontend/src/pages/Customers.jsx`
- [Forecast view](https://github.com/rahulshamra/bizmind-ai-/blob/main/frontend/src/pages/Predictions.jsx): `frontend/src/pages/Predictions.jsx`
- [Analytics view](https://github.com/rahulshamra/bizmind-ai-/blob/main/frontend/src/pages/Analytics.jsx): `frontend/src/pages/Analytics.jsx`
- [Chat view](https://github.com/rahulshamra/bizmind-ai-/blob/main/frontend/src/pages/Chat.jsx): `frontend/src/pages/Chat.jsx`
- [Risk chart](https://github.com/rahulshamra/bizmind-ai-/blob/main/frontend/src/components/CustomerSegmentChart.jsx): `frontend/src/components/CustomerSegmentChart.jsx`
- [Segment predictor](https://github.com/rahulshamra/bizmind-ai-/blob/main/frontend/src/components/SegmentPredictor.jsx): `frontend/src/components/SegmentPredictor.jsx`
- [API client](https://github.com/rahulshamra/bizmind-ai-/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`
- [Mock responses](https://github.com/rahulshamra/bizmind-ai-/blob/main/frontend/src/data/mockData.js): `frontend/src/data/mockData.js`

### API application

- [FastAPI app](https://github.com/rahulshamra/bizmind-ai-/blob/main/backend/app/main.py): `backend/app/main.py`
- [Customer endpoints](https://github.com/rahulshamra/bizmind-ai-/blob/main/backend/app/api/routes/customer_routes.py): `backend/app/api/routes/customer_routes.py`
- [Demand endpoints](https://github.com/rahulshamra/bizmind-ai-/blob/main/backend/app/api/routes/demand_routes.py): `backend/app/api/routes/demand_routes.py`

### Prediction models

- [Customer segmentation](https://github.com/rahulshamra/bizmind-ai-/blob/main/backend/app/ml/customer_segmentation.py): `backend/app/ml/customer_segmentation.py`
- [Demand forecasting](https://github.com/rahulshamra/bizmind-ai-/blob/main/backend/app/ml/demand_forecasting.py): `backend/app/ml/demand_forecasting.py`
- [Model loading](https://github.com/rahulshamra/bizmind-ai-/blob/main/backend/app/ml/model_loader.py): `backend/app/ml/model_loader.py`
- [30-day prediction](https://github.com/rahulshamra/bizmind-ai-/blob/main/backend/app/ml/next30_predection.py): `backend/app/ml/next30_predection.py`

### AI assistance

- [AI agent and chains](https://github.com/rahulshamra/bizmind-ai-/blob/main/backend/app/ai/agent.py): `backend/app/ai/agent.py`
- [Chat service](https://github.com/rahulshamra/bizmind-ai-/blob/main/backend/app/services/chat_service.py): `backend/app/services/chat_service.py`
- [RAG retrieval](https://github.com/rahulshamra/bizmind-ai-/blob/main/backend/app/rag/retriever.py): `backend/app/rag/retriever.py`
- [Embeddings](https://github.com/rahulshamra/bizmind-ai-/blob/main/backend/app/rag/embeddings.py): `backend/app/rag/embeddings.py`
- [Knowledge ingestion](https://github.com/rahulshamra/bizmind-ai-/blob/main/backend/app/rag/ingestion.py): `backend/app/rag/ingestion.py`

### Data services

- [Vector store](https://github.com/rahulshamra/bizmind-ai-/blob/main/backend/app/rag/vector_store.py): `backend/app/rag/vector_store.py`
- [Database setup](https://github.com/rahulshamra/bizmind-ai-/blob/main/backend/app/database.py): `backend/app/database.py`
- [Analytics service](https://github.com/rahulshamra/bizmind-ai-/blob/main/backend/app/services/analytics_service.py): `backend/app/services/analytics_service.py`

### Other components

- **Business user**

## Connections

- Business user → Page router: opens
- Page router → Overview: routes to (evidence: `frontend/src/App.jsx`)
- Page router → Customer view: routes to (evidence: `frontend/src/App.jsx`)
- Page router → Forecast view: routes to (evidence: `frontend/src/App.jsx`)
- Page router → Analytics view: routes to (evidence: `frontend/src/App.jsx`)
- Page router → Chat view: routes to (evidence: `frontend/src/App.jsx`)
- Customer view → Risk chart: renders (evidence: `frontend/src/pages/Customers.jsx`)
- Customer view → Segment predictor: renders (evidence: `frontend/src/pages/Customers.jsx`)
- Overview → API client: requests data (evidence: `frontend/src/pages/Dashboard.jsx`)
- Forecast view → API client: requests forecast (evidence: `frontend/src/pages/Predictions.jsx`)
- API client → Mock responses: uses fallback (evidence: `frontend/src/services/api.js`)
- Risk chart → Customer endpoints: fetches graph (evidence: `frontend/src/components/CustomerSegmentChart.jsx`)
- Segment predictor → Customer endpoints: submits prediction (evidence: `frontend/src/components/SegmentPredictor.jsx`)
- Forecast view → Demand endpoints: fetches forecasts (evidence: `frontend/src/pages/Predictions.jsx`)
- FastAPI app → Customer endpoints: registers routes (evidence: `backend/app/main.py`)
- FastAPI app → Demand endpoints: registers routes (evidence: `backend/app/main.py`)
- FastAPI app → Model loading: loads models (evidence: `backend/app/main.py`)
- Customer endpoints → Customer segmentation: calls predictions (evidence: `backend/app/api/routes/customer_routes.py`)
- Demand endpoints → Demand forecasting: calls forecasts (evidence: `backend/app/api/routes/demand_routes.py`)
- Customer endpoints → Model loading: reads loaded model
- Demand endpoints → Model loading: reads loaded model
- Chat view → AI agent and chains: uses chat
- AI agent and chains → Chat service: delegates
- Chat service → RAG retrieval: retrieves context
- RAG retrieval → Embeddings: embeds queries
- Knowledge ingestion → Embeddings: creates vectors
- Knowledge ingestion → Vector store: stores vectors
- RAG retrieval → Vector store: searches vectors
- Forecast view → 30-day prediction: offers 30-day forecast
- Analytics view → Analytics service: loads analytics
