# bhaskararamkarri/revivex architecture

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

- Interactive diagram: https://gitdiagram.com/bhaskararamkarri/revivex
- Repository: https://github.com/bhaskararamkarri/revivex

## Overview

ReviveX is a payment-failure recovery control center. Its documented workflow ingests gateway events, detects at-risk transactions, diagnoses failures, applies deterministic safety decisions, and executes authorized recovery; verified payment events ground recovered-revenue reporting. The graph preserves the major operational views and the simulation capability. Several backend imports are confirmed by the source index, but the frontend-to-API wiring and some route-level dispatch details were not shown, so those connections are omitted rather than inferred.

Main entry points: [`backend/app/main.py`](https://github.com/bhaskararamkarri/revivex/blob/main/backend/app/main.py) (API Routes), [`backend/app/services/orchestrator.py`](https://github.com/bhaskararamkarri/revivex/blob/main/backend/app/services/orchestrator.py) (Case Orchestrator), [`backend/app/services/razorpay.py`](https://github.com/bhaskararamkarri/revivex/blob/main/backend/app/services/razorpay.py) (Gateway Integration), [`backend/app/database.py`](https://github.com/bhaskararamkarri/revivex/blob/main/backend/app/database.py) (SQL Database)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingestion["Ingestion &amp; Data"]
  node_api["API Routes<br/>[main.py]"]
  node_gateway_service["Gateway Integration<br/>[razorpay.py]"]
  node_db[("SQL Database<br/>[database.py]")]
  node_entities["Payment Records<br/>[models.py]"]
  node_schemas["API Schemas<br/>[schemas.py]"]
end

subgraph group_recovery["Recovery Workflow"]
  node_detection["Risk Detection<br/>[detection.py]"]
  node_orchestrator["Case Orchestrator<br/>[orchestrator.py]"]
  node_diagnosis["AI Diagnosis<br/>[diagnosis.py]"]
  node_decision["Safety Decisions<br/>[decision.py]"]
  node_execution["Recovery Execution<br/>[recovery.py]"]
  node_simulator["Workflow Simulator<br/>[simulator.py]"]
end

subgraph group_operations["Operations &amp; Insights"]
  node_overview["Executive Overview<br/>[page.tsx]"]
  node_incident_views["Incident Views"]
  node_investigation_views["Investigation Views"]
  node_case_views["Risk Case Views"]
  node_transaction_views["Transaction Views"]
  node_recovery_view["Recovery Operations<br/>[page.tsx]"]
  node_policy_view["Policy Center<br/>[page.tsx]"]
  node_audit_view["Audit Trail<br/>[page.tsx]"]
  node_assistant_view["AI Assistant<br/>[page.tsx]"]
end

subgraph group_frontend["Control Center"]
  node_control_center["Frontend Shell<br/>[layout.tsx]"]
end

node_merchant(("Merchant Operator"))
node_razorpay{{"Razorpay Gateway"}}

node_razorpay -->|"sends webhooks"| node_api
node_api -->|"handles gateway events"| node_gateway_service
node_gateway_service -->|"creates payment links"| node_razorpay
node_gateway_service -->|"normalizes events"| node_api
node_api -->|"reads and writes"| node_db
node_entities -->|"maps records"| node_db
node_api -->|"dispatches detection"| node_detection
node_detection -->|"creates risk cases"| node_db
node_api -->|"starts case workflow"| node_orchestrator
node_orchestrator -->|"requests diagnosis"| node_diagnosis
node_orchestrator -->|"evaluates policies"| node_decision
node_orchestrator -->|"executes decision"| node_execution
node_execution -->|"creates payment links"| node_gateway_service
node_merchant -->|"authorizes recovery"| node_api
node_api -->|"runs simulation"| node_simulator
node_control_center -->|"frames views"| node_overview
node_merchant -->|"uses control center"| node_control_center
node_overview -.->|"loads dashboard data"| node_api
node_incident_views -.->|"loads incident data"| node_api
node_investigation_views -.->|"loads investigation data"| node_api
node_case_views -.->|"loads case data"| node_api
node_transaction_views -.->|"loads transaction data"| node_api
node_recovery_view -.->|"manages recovery"| node_api
node_policy_view -.->|"edits policy bounds"| node_api
node_audit_view -.->|"loads audit trail"| node_api
node_assistant_view -.->|"requests assistance"| node_api

click node_api "https://github.com/bhaskararamkarri/revivex/blob/main/backend/app/main.py"
click node_gateway_service "https://github.com/bhaskararamkarri/revivex/blob/main/backend/app/services/razorpay.py"
click node_db "https://github.com/bhaskararamkarri/revivex/blob/main/backend/app/database.py"
click node_entities "https://github.com/bhaskararamkarri/revivex/blob/main/backend/app/models.py"
click node_schemas "https://github.com/bhaskararamkarri/revivex/blob/main/backend/app/schemas.py"
click node_detection "https://github.com/bhaskararamkarri/revivex/blob/main/backend/app/services/detection.py"
click node_orchestrator "https://github.com/bhaskararamkarri/revivex/blob/main/backend/app/services/orchestrator.py"
click node_diagnosis "https://github.com/bhaskararamkarri/revivex/blob/main/backend/app/services/diagnosis.py"
click node_decision "https://github.com/bhaskararamkarri/revivex/blob/main/backend/app/services/decision.py"
click node_execution "https://github.com/bhaskararamkarri/revivex/blob/main/backend/app/services/recovery.py"
click node_simulator "https://github.com/bhaskararamkarri/revivex/blob/main/backend/app/services/simulator.py"
click node_overview "https://github.com/bhaskararamkarri/revivex/blob/main/frontend/src/app/overview/page.tsx"
click node_incident_views "https://github.com/bhaskararamkarri/revivex/tree/main/frontend/src/app/incidents"
click node_investigation_views "https://github.com/bhaskararamkarri/revivex/tree/main/frontend/src/app/investigations"
click node_case_views "https://github.com/bhaskararamkarri/revivex/tree/main/frontend/src/app/risk-cases"
click node_transaction_views "https://github.com/bhaskararamkarri/revivex/tree/main/frontend/src/app/transactions"
click node_recovery_view "https://github.com/bhaskararamkarri/revivex/blob/main/frontend/src/app/recovery/page.tsx"
click node_policy_view "https://github.com/bhaskararamkarri/revivex/blob/main/frontend/src/app/policies/page.tsx"
click node_audit_view "https://github.com/bhaskararamkarri/revivex/blob/main/frontend/src/app/audit/page.tsx"
click node_assistant_view "https://github.com/bhaskararamkarri/revivex/blob/main/frontend/src/app/ai-assistant/page.tsx"
click node_control_center "https://github.com/bhaskararamkarri/revivex/blob/main/frontend/src/app/layout.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_api,node_gateway_service,node_db,node_entities,node_schemas toneBlue
class node_detection,node_orchestrator,node_diagnosis,node_decision,node_execution,node_simulator toneAmber
class node_overview,node_incident_views,node_investigation_views,node_case_views,node_transaction_views,node_recovery_view,node_policy_view,node_audit_view,node_assistant_view toneMint
class node_control_center toneRose
class node_merchant,node_razorpay toneIndigo
```

## Components

### Ingestion & Data

- [API Routes](https://github.com/bhaskararamkarri/revivex/blob/main/backend/app/main.py): `backend/app/main.py`
- [Gateway Integration](https://github.com/bhaskararamkarri/revivex/blob/main/backend/app/services/razorpay.py): `backend/app/services/razorpay.py`
- [SQL Database](https://github.com/bhaskararamkarri/revivex/blob/main/backend/app/database.py): `backend/app/database.py`
- [Payment Records](https://github.com/bhaskararamkarri/revivex/blob/main/backend/app/models.py): `backend/app/models.py`
- [API Schemas](https://github.com/bhaskararamkarri/revivex/blob/main/backend/app/schemas.py): `backend/app/schemas.py`

### Recovery Workflow

- [Risk Detection](https://github.com/bhaskararamkarri/revivex/blob/main/backend/app/services/detection.py): `backend/app/services/detection.py`
- [Case Orchestrator](https://github.com/bhaskararamkarri/revivex/blob/main/backend/app/services/orchestrator.py): `backend/app/services/orchestrator.py`
- [AI Diagnosis](https://github.com/bhaskararamkarri/revivex/blob/main/backend/app/services/diagnosis.py): `backend/app/services/diagnosis.py`
- [Safety Decisions](https://github.com/bhaskararamkarri/revivex/blob/main/backend/app/services/decision.py): `backend/app/services/decision.py`
- [Recovery Execution](https://github.com/bhaskararamkarri/revivex/blob/main/backend/app/services/recovery.py): `backend/app/services/recovery.py`
- [Workflow Simulator](https://github.com/bhaskararamkarri/revivex/blob/main/backend/app/services/simulator.py): `backend/app/services/simulator.py`

### Operations & Insights

- [Executive Overview](https://github.com/bhaskararamkarri/revivex/blob/main/frontend/src/app/overview/page.tsx): `frontend/src/app/overview/page.tsx`
- [Incident Views](https://github.com/bhaskararamkarri/revivex/tree/main/frontend/src/app/incidents): `frontend/src/app/incidents`
- [Investigation Views](https://github.com/bhaskararamkarri/revivex/tree/main/frontend/src/app/investigations): `frontend/src/app/investigations`
- [Risk Case Views](https://github.com/bhaskararamkarri/revivex/tree/main/frontend/src/app/risk-cases): `frontend/src/app/risk-cases`
- [Transaction Views](https://github.com/bhaskararamkarri/revivex/tree/main/frontend/src/app/transactions): `frontend/src/app/transactions`
- [Recovery Operations](https://github.com/bhaskararamkarri/revivex/blob/main/frontend/src/app/recovery/page.tsx): `frontend/src/app/recovery/page.tsx`
- [Policy Center](https://github.com/bhaskararamkarri/revivex/blob/main/frontend/src/app/policies/page.tsx): `frontend/src/app/policies/page.tsx`
- [Audit Trail](https://github.com/bhaskararamkarri/revivex/blob/main/frontend/src/app/audit/page.tsx): `frontend/src/app/audit/page.tsx`
- [AI Assistant](https://github.com/bhaskararamkarri/revivex/blob/main/frontend/src/app/ai-assistant/page.tsx): `frontend/src/app/ai-assistant/page.tsx`

### Control Center

- [Frontend Shell](https://github.com/bhaskararamkarri/revivex/blob/main/frontend/src/app/layout.tsx): `frontend/src/app/layout.tsx`

### Other components

- **Merchant Operator**
- **Razorpay Gateway**

## Connections

- Razorpay Gateway → API Routes: sends webhooks (evidence: `README.md`)
- API Routes → Gateway Integration: handles gateway events (evidence: `README.md`)
- Gateway Integration → Razorpay Gateway: creates payment links (evidence: `backend/app/services/razorpay.py`)
- Gateway Integration → API Routes: normalizes events (evidence: `README.md`)
- API Routes → SQL Database: reads and writes (evidence: `backend/app/main.py`)
- Payment Records → SQL Database: maps records (evidence: `backend/app/models.py`)
- API Routes → Risk Detection: dispatches detection (evidence: `backend/app/main.py`)
- Risk Detection → SQL Database: creates risk cases (evidence: `backend/app/services/detection.py`)
- API Routes → Case Orchestrator: starts case workflow (evidence: `backend/app/main.py`)
- Case Orchestrator → AI Diagnosis: requests diagnosis (evidence: `backend/app/services/orchestrator.py`)
- Case Orchestrator → Safety Decisions: evaluates policies (evidence: `backend/app/services/orchestrator.py`)
- Case Orchestrator → Recovery Execution: executes decision (evidence: `backend/app/services/orchestrator.py`)
- Recovery Execution → Gateway Integration: creates payment links (evidence: `backend/app/services/recovery.py`)
- Merchant Operator → API Routes: authorizes recovery (evidence: `README.md`)
- API Routes → Workflow Simulator: runs simulation (evidence: `backend/app/main.py`)
- Frontend Shell → Executive Overview: frames views (evidence: `frontend/src/app/layout.tsx`)
- Merchant Operator → Frontend Shell: uses control center (evidence: `README.md`)
- Executive Overview → API Routes: loads dashboard data
- Incident Views → API Routes: loads incident data
- Investigation Views → API Routes: loads investigation data
- Risk Case Views → API Routes: loads case data
- Transaction Views → API Routes: loads transaction data
- Recovery Operations → API Routes: manages recovery
- Policy Center → API Routes: edits policy bounds
- Audit Trail → API Routes: loads audit trail
- AI Assistant → API Routes: requests assistance
