# jrdheeraj/razorgrowth-ai architecture

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

- Interactive diagram: https://gitdiagram.com/jrdheeraj/razorgrowth-ai
- Repository: https://github.com/jrdheeraj/razorgrowth-ai

## Overview

RazorGrowth AI turns merchant commerce data into debated, ranked growth opportunities and human-approved, auditable actions; it also supports an AI Buyer checkout. The principal flow is merchant sign-in, Razorpay TEST-data ingestion, radar and agent analysis, debate and recommendation, then approval-gated execution. The graph includes documented dashboard, marketing-agent, experiment, customer-intelligence, RAG, and checkout capabilities. Edges are limited to relationships shown in excerpts, the SOURCE INDEX, or README; unsampled wiring is omitted.

Main entry points: [`backend/app/main.py`](https://github.com/jrdheeraj/razorgrowth-ai/blob/main/backend/app/main.py) (HTTP API), [`frontend/src/App.tsx`](https://github.com/jrdheeraj/razorgrowth-ai/blob/main/frontend/src/App.tsx) (Growth workspace), [`backend/app/agents/orchestrator.py`](https://github.com/jrdheeraj/razorgrowth-ai/blob/main/backend/app/agents/orchestrator.py) (Agent orchestration), [`backend/app/models/order.py`](https://github.com/jrdheeraj/razorgrowth-ai/blob/main/backend/app/models/order.py) (Merchant commerce records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Merchant experience"]
  node_web["Growth workspace<br/>[App.tsx]"]
  node_radarui["Growth Radar<br/>[GrowthRadar.tsx]"]
  node_agentsui["Agent dashboard<br/>[AgentsPage.tsx]"]
  node_agiui["Marketing workstation"]
  node_debateui["Debate view<br/>[DebatePage.tsx]"]
  node_actionsui["Approval console<br/>[ActionsPage.tsx]"]
  node_checkoutui["AI Buyer checkout<br/>[Checkout.tsx]"]
end

subgraph group_commerce["Commerce data"]
  node_commerce[("Merchant commerce records<br/>[order.py]")]
  node_razorpay["Razorpay client<br/>[razorpay.py]"]
  node_ingestion["Commerce ingestion"]
  node_webhook["Payment webhooks<br/>[webhooks.py]"]
  node_buyer["Razorpay TEST payments<br/>[razorpay.py]"]
end

subgraph group_intelligence["Growth intelligence"]
  node_radar["Growth signals<br/>[radar.py]"]
  node_rag["RAG context<br/>[rag_context.py]"]
  node_ragpipeline["Agentic retrieval<br/>[pipeline.py]"]
  node_llm["LLM providers<br/>[provider.py]"]
  node_agents["Specialist agents"]
end

subgraph group_decision["Debate and action"]
  node_manager["Growth manager<br/>[manager_agent.py]"]
  node_orchestrator["Agent orchestration<br/>[orchestrator.py]"]
  node_debate[("Structured debate")]
  node_opportunity["Opportunity ranking"]
  node_approval["Action approval and execution<br/>[action_service.py]"]
  node_audit[("Audit trail<br/>[audit_event.py]")]
end

subgraph group_platform["Runtime and integrations"]
  node_api["HTTP API<br/>[main.py]"]
  node_auth["Tenant security<br/>[security.py]"]
end

node_merchant(("Merchant"))
node_llmservice["LLM service"]

node_merchant -->|"uses"| node_web
node_web -->|"routes to"| node_radarui
node_web -->|"routes to"| node_agentsui
node_web -->|"routes to"| node_agiui
node_web -->|"routes to"| node_debateui
node_web -->|"routes to"| node_actionsui
node_web -->|"routes to"| node_checkoutui
node_radarui -.->|"requests data"| node_api
node_agentsui -->|"fetches runs"| node_api
node_agiui -.->|"requests analysis"| node_api
node_debateui -.->|"requests debate"| node_api
node_actionsui -.->|"submits decisions"| node_api
node_checkoutui -.->|"starts checkout"| node_api
node_api -->|"applies security"| node_auth
node_api -.->|"routes requests"| node_ingestion
node_api -.->|"routes requests"| node_radar
node_api -.->|"routes analysis"| node_orchestrator
node_razorpay -->|"fetches commerce data"| node_ingestion
node_ingestion -->|"upserts records"| node_commerce
node_commerce -->|"supplies business data"| node_radar
node_commerce -->|"supplies merchant context"| node_rag
node_rag -->|"uses retrieval"| node_ragpipeline
node_ragpipeline -->|"selects tools"| node_llm
node_llm -.->|"calls provider"| node_llmservice
node_orchestrator -->|"builds context"| node_rag
node_orchestrator -->|"dispatches agents"| node_agents
node_orchestrator -->|"starts debate"| node_debate
node_manager -->|"detects signals"| node_radar
node_manager -->|"loads opportunities"| node_opportunity
node_manager -->|"coordinates findings"| node_debate
node_debate -.->|"synthesizes recommendation"| node_opportunity
node_opportunity -.->|"proposes action"| node_approval
node_approval -.->|"records actions"| node_audit
node_merchant -.->|"approves or rejects"| node_approval
node_webhook -->|"verifies signature"| node_razorpay
node_webhook -->|"syncs payment state"| node_commerce
node_checkoutui -.->|"initiates purchase"| node_buyer
node_buyer -.->|"creates TEST payment"| node_razorpay

click node_web "https://github.com/jrdheeraj/razorgrowth-ai/blob/main/frontend/src/App.tsx"
click node_radarui "https://github.com/jrdheeraj/razorgrowth-ai/blob/main/frontend/src/pages/GrowthRadar.tsx"
click node_agentsui "https://github.com/jrdheeraj/razorgrowth-ai/blob/main/frontend/src/pages/AgentsPage.tsx"
click node_agiui "https://github.com/jrdheeraj/razorgrowth-ai/blob/main/frontend/src/pages/MarketingAGIPage.tsx"
click node_debateui "https://github.com/jrdheeraj/razorgrowth-ai/blob/main/frontend/src/pages/DebatePage.tsx"
click node_actionsui "https://github.com/jrdheeraj/razorgrowth-ai/blob/main/frontend/src/pages/ActionsPage.tsx"
click node_checkoutui "https://github.com/jrdheeraj/razorgrowth-ai/blob/main/frontend/src/pages/Checkout.tsx"
click node_api "https://github.com/jrdheeraj/razorgrowth-ai/blob/main/backend/app/main.py"
click node_auth "https://github.com/jrdheeraj/razorgrowth-ai/blob/main/backend/app/core/security.py"
click node_commerce "https://github.com/jrdheeraj/razorgrowth-ai/blob/main/backend/app/models/order.py"
click node_razorpay "https://github.com/jrdheeraj/razorgrowth-ai/blob/main/backend/app/integrations/razorpay.py"
click node_ingestion "https://github.com/jrdheeraj/razorgrowth-ai/blob/main/backend/app/services/razorpay_ingestion.py"
click node_webhook "https://github.com/jrdheeraj/razorgrowth-ai/blob/main/backend/app/api/routes/webhooks.py"
click node_radar "https://github.com/jrdheeraj/razorgrowth-ai/blob/main/backend/app/services/radar.py"
click node_rag "https://github.com/jrdheeraj/razorgrowth-ai/blob/main/backend/app/services/rag_context.py"
click node_ragpipeline "https://github.com/jrdheeraj/razorgrowth-ai/blob/main/backend/app/ai/rag/pipeline.py"
click node_llm "https://github.com/jrdheeraj/razorgrowth-ai/blob/main/backend/app/ai/llm/provider.py"
click node_agents "https://github.com/jrdheeraj/razorgrowth-ai/tree/main/backend/app/agents"
click node_manager "https://github.com/jrdheeraj/razorgrowth-ai/blob/main/backend/app/agents/manager_agent.py"
click node_orchestrator "https://github.com/jrdheeraj/razorgrowth-ai/blob/main/backend/app/agents/orchestrator.py"
click node_debate "https://github.com/jrdheeraj/razorgrowth-ai/blob/main/backend/app/services/agent_debate_service.py"
click node_opportunity "https://github.com/jrdheeraj/razorgrowth-ai/blob/main/backend/app/services/opportunity_service.py"
click node_approval "https://github.com/jrdheeraj/razorgrowth-ai/blob/main/backend/app/services/action_service.py"
click node_audit "https://github.com/jrdheeraj/razorgrowth-ai/blob/main/backend/app/models/audit_event.py"
click node_buyer "https://github.com/jrdheeraj/razorgrowth-ai/blob/main/backend/app/integrations/razorpay.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_web,node_radarui,node_agentsui,node_agiui,node_debateui,node_actionsui,node_checkoutui toneBlue
class node_commerce,node_razorpay,node_ingestion,node_webhook,node_buyer toneAmber
class node_radar,node_rag,node_ragpipeline,node_llm,node_agents toneMint
class node_manager,node_orchestrator,node_debate,node_opportunity,node_approval,node_audit toneRose
class node_api,node_auth,node_merchant,node_llmservice toneIndigo
```

## Components

### Merchant experience

- [Growth workspace](https://github.com/jrdheeraj/razorgrowth-ai/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Growth Radar](https://github.com/jrdheeraj/razorgrowth-ai/blob/main/frontend/src/pages/GrowthRadar.tsx): `frontend/src/pages/GrowthRadar.tsx`
- [Agent dashboard](https://github.com/jrdheeraj/razorgrowth-ai/blob/main/frontend/src/pages/AgentsPage.tsx): `frontend/src/pages/AgentsPage.tsx`
- [Marketing workstation](https://github.com/jrdheeraj/razorgrowth-ai/blob/main/frontend/src/pages/MarketingAGIPage.tsx): `frontend/src/pages/MarketingAGIPage.tsx`
- [Debate view](https://github.com/jrdheeraj/razorgrowth-ai/blob/main/frontend/src/pages/DebatePage.tsx): `frontend/src/pages/DebatePage.tsx`
- [Approval console](https://github.com/jrdheeraj/razorgrowth-ai/blob/main/frontend/src/pages/ActionsPage.tsx): `frontend/src/pages/ActionsPage.tsx`
- [AI Buyer checkout](https://github.com/jrdheeraj/razorgrowth-ai/blob/main/frontend/src/pages/Checkout.tsx): `frontend/src/pages/Checkout.tsx`

### Commerce data

- [Merchant commerce records](https://github.com/jrdheeraj/razorgrowth-ai/blob/main/backend/app/models/order.py): `backend/app/models/order.py`
- [Razorpay client](https://github.com/jrdheeraj/razorgrowth-ai/blob/main/backend/app/integrations/razorpay.py): `backend/app/integrations/razorpay.py`
- [Commerce ingestion](https://github.com/jrdheeraj/razorgrowth-ai/blob/main/backend/app/services/razorpay_ingestion.py): `backend/app/services/razorpay_ingestion.py`
- [Payment webhooks](https://github.com/jrdheeraj/razorgrowth-ai/blob/main/backend/app/api/routes/webhooks.py): `backend/app/api/routes/webhooks.py`
- [Razorpay TEST payments](https://github.com/jrdheeraj/razorgrowth-ai/blob/main/backend/app/integrations/razorpay.py): `backend/app/integrations/razorpay.py`

### Growth intelligence

- [Growth signals](https://github.com/jrdheeraj/razorgrowth-ai/blob/main/backend/app/services/radar.py): `backend/app/services/radar.py`
- [RAG context](https://github.com/jrdheeraj/razorgrowth-ai/blob/main/backend/app/services/rag_context.py): `backend/app/services/rag_context.py`
- [Agentic retrieval](https://github.com/jrdheeraj/razorgrowth-ai/blob/main/backend/app/ai/rag/pipeline.py): `backend/app/ai/rag/pipeline.py`
- [LLM providers](https://github.com/jrdheeraj/razorgrowth-ai/blob/main/backend/app/ai/llm/provider.py): `backend/app/ai/llm/provider.py`
- [Specialist agents](https://github.com/jrdheeraj/razorgrowth-ai/tree/main/backend/app/agents): `backend/app/agents`

### Debate and action

- [Growth manager](https://github.com/jrdheeraj/razorgrowth-ai/blob/main/backend/app/agents/manager_agent.py): `backend/app/agents/manager_agent.py`
- [Agent orchestration](https://github.com/jrdheeraj/razorgrowth-ai/blob/main/backend/app/agents/orchestrator.py): `backend/app/agents/orchestrator.py`
- [Structured debate](https://github.com/jrdheeraj/razorgrowth-ai/blob/main/backend/app/services/agent_debate_service.py): `backend/app/services/agent_debate_service.py`
- [Opportunity ranking](https://github.com/jrdheeraj/razorgrowth-ai/blob/main/backend/app/services/opportunity_service.py): `backend/app/services/opportunity_service.py`
- [Action approval and execution](https://github.com/jrdheeraj/razorgrowth-ai/blob/main/backend/app/services/action_service.py): `backend/app/services/action_service.py`
- [Audit trail](https://github.com/jrdheeraj/razorgrowth-ai/blob/main/backend/app/models/audit_event.py): `backend/app/models/audit_event.py`

### Runtime and integrations

- [HTTP API](https://github.com/jrdheeraj/razorgrowth-ai/blob/main/backend/app/main.py): `backend/app/main.py`
- [Tenant security](https://github.com/jrdheeraj/razorgrowth-ai/blob/main/backend/app/core/security.py): `backend/app/core/security.py`

### Other components

- **Merchant**
- **LLM service**

## Connections

- Merchant → Growth workspace: uses (evidence: `frontend/src/App.tsx`)
- Growth workspace → Growth Radar: routes to (evidence: `frontend/src/App.tsx`)
- Growth workspace → Agent dashboard: routes to (evidence: `frontend/src/App.tsx`)
- Growth workspace → Marketing workstation: routes to (evidence: `frontend/src/App.tsx`)
- Growth workspace → Debate view: routes to (evidence: `frontend/src/App.tsx`)
- Growth workspace → Approval console: routes to (evidence: `frontend/src/App.tsx`)
- Growth workspace → AI Buyer checkout: routes to (evidence: `frontend/src/App.tsx`)
- Growth Radar → HTTP API: requests data
- Agent dashboard → HTTP API: fetches runs (evidence: `frontend/src/pages/AgentsPage.tsx`)
- Marketing workstation → HTTP API: requests analysis
- Debate view → HTTP API: requests debate
- Approval console → HTTP API: submits decisions
- AI Buyer checkout → HTTP API: starts checkout
- HTTP API → Tenant security: applies security (evidence: `backend/app/main.py`)
- HTTP API → Commerce ingestion: routes requests
- HTTP API → Growth signals: routes requests
- HTTP API → Agent orchestration: routes analysis
- Razorpay client → Commerce ingestion: fetches commerce data (evidence: `backend/app/services/razorpay_ingestion.py`)
- Commerce ingestion → Merchant commerce records: upserts records (evidence: `backend/app/services/razorpay_ingestion.py`)
- Merchant commerce records → Growth signals: supplies business data (evidence: `backend/app/services/radar.py`)
- Merchant commerce records → RAG context: supplies merchant context (evidence: `backend/app/services/rag_context.py`)
- RAG context → Agentic retrieval: uses retrieval (evidence: `backend/app/services/rag_context.py`)
- Agentic retrieval → LLM providers: selects tools (evidence: `backend/app/ai/rag/pipeline.py`)
- LLM providers → LLM service: calls provider
- Agent orchestration → RAG context: builds context (evidence: `backend/app/agents/orchestrator.py`)
- Agent orchestration → Specialist agents: dispatches agents (evidence: `backend/app/agents/orchestrator.py`)
- Agent orchestration → Structured debate: starts debate (evidence: `backend/app/agents/orchestrator.py`)
- Growth manager → Growth signals: detects signals (evidence: `backend/app/agents/manager_agent.py`)
- Growth manager → Opportunity ranking: loads opportunities (evidence: `backend/app/agents/manager_agent.py`)
- Growth manager → Structured debate: coordinates findings (evidence: `backend/app/agents/manager_agent.py`)
- Structured debate → Opportunity ranking: synthesizes recommendation
- Opportunity ranking → Action approval and execution: proposes action
- Action approval and execution → Audit trail: records actions
- Merchant → Action approval and execution: approves or rejects
- Payment webhooks → Razorpay client: verifies signature (evidence: `backend/app/api/routes/webhooks.py`)
- Payment webhooks → Merchant commerce records: syncs payment state (evidence: `backend/app/api/routes/webhooks.py`)
- AI Buyer checkout → Razorpay TEST payments: initiates purchase
- Razorpay TEST payments → Razorpay client: creates TEST payment (evidence: `backend/app/integrations/razorpay.py`)
