# sairamchamakuri/razorpay-buildathon architecture

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

- Interactive diagram: https://gitdiagram.com/sairamchamakuri/razorpay-buildathon
- Repository: https://github.com/sairamchamakuri/razorpay-buildathon

## Overview

PayAssure AI is a merchant POS system for assessing whether a failed payment caused by a temporary bank outage can be deferred. The main workflow runs from checkout and risk assessment through merchant PIN/QR approval, a timed deferred-payment lifecycle, and settlement by bank recovery, UTR, or cash; reminders, analytics, and model metrics support that flow. The sampled code confirms key API, model, and UI connections. Some endpoint and service details are documented or indexed but unsampled, so uncertain links are omitted.

Main entry points: [`frontend/src/services/api.ts`](https://github.com/sairamchamakuri/razorpay-buildathon/blob/main/frontend/src/services/api.ts) (HTTP API client), [`frontend/src/App.tsx`](https://github.com/sairamchamakuri/razorpay-buildathon/blob/main/frontend/src/App.tsx) (Application shell), [`backend/app/api/deferred.py`](https://github.com/sairamchamakuri/razorpay-buildathon/blob/main/backend/app/api/deferred.py) (Deferred payment operations), [`backend/app/api/payments.py`](https://github.com/sairamchamakuri/razorpay-buildathon/blob/main/backend/app/api/payments.py) (Payment intake)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["POS experience"]
  node_app["Application shell<br/>[App.tsx]"]
  node_pos["Merchant POS<br/>[MerchantPOS.tsx]"]
  node_customer_view["Customer mobile<br/>[CustomerMobile.tsx]"]
  node_dashboard["Merchant dashboard"]
  node_demo["Demo controls<br/>[DemoToolbar.tsx]"]
  node_metrics["Model metrics view"]
  node_client_api["HTTP API client<br/>[api.ts]"]
end

subgraph group_api["Payment API"]
  node_payments["Payment intake<br/>[payments.py]"]
  node_deferred["Deferred payment operations<br/>[deferred.py]"]
  node_merchant_api["Merchant analytics<br/>[merchant.py]"]
  node_demo_api["Demo operations<br/>[demo.py]"]
  node_risk_api["Customer risk endpoint<br/>[risk.py]"]
  node_app_entry["FastAPI application<br/>[main.py]"]
end

subgraph group_risk["Risk assessment"]
  node_risk_engine["Risk policy and scoring<br/>[risk_engine.py]"]
  node_features["Customer features<br/>[features.py]"]
end

subgraph group_state["Deferred lifecycle and state"]
  node_db[("Database session<br/>[database.py]")]
  node_entities["Payment entities<br/>[entities.py]"]
  node_settlement["Settlement methods"]
  node_notifications["Reminder notifications"]
  node_audit["Audit log<br/>[audit_service.py]"]
end

node_merchant(("Merchant or customer"))

node_merchant -->|"uses"| node_app
node_app -->|"renders"| node_pos
node_app -->|"renders"| node_customer_view
node_app -->|"renders"| node_dashboard
node_app -->|"renders"| node_demo
node_app -->|"renders"| node_metrics
node_app -->|"calls"| node_client_api
node_pos -->|"calls"| node_client_api
node_customer_view -->|"calls"| node_client_api
node_dashboard -->|"calls"| node_client_api
node_client_api -->|"requests"| node_payments
node_client_api -->|"requests"| node_deferred
node_client_api -->|"requests"| node_merchant_api
node_client_api -->|"requests"| node_demo_api
node_client_api -->|"requests"| node_risk_api
node_payments -->|"evaluates risk"| node_risk_engine
node_risk_engine -->|"extracts features"| node_features
node_payments -->|"reads and writes"| node_db
node_payments -->|"creates records"| node_entities
node_payments -->|"records events"| node_audit
node_deferred -->|"reads and writes"| node_db
node_deferred -->|"updates lifecycle"| node_entities
node_deferred -->|"processes settlement"| node_settlement
node_deferred -.->|"dispatches reminders"| node_notifications
node_deferred -.->|"records events"| node_audit
node_app_entry -->|"registers router"| node_payments
node_app_entry -->|"registers router"| node_deferred
node_app_entry -->|"registers router"| node_merchant_api
node_app_entry -->|"registers router"| node_demo_api
node_app_entry -->|"registers router"| node_risk_api
node_metrics -.->|"loads metrics"| node_client_api

click node_app "https://github.com/sairamchamakuri/razorpay-buildathon/blob/main/frontend/src/App.tsx"
click node_pos "https://github.com/sairamchamakuri/razorpay-buildathon/blob/main/frontend/src/components/MerchantPOS.tsx"
click node_customer_view "https://github.com/sairamchamakuri/razorpay-buildathon/blob/main/frontend/src/components/CustomerMobile.tsx"
click node_dashboard "https://github.com/sairamchamakuri/razorpay-buildathon/blob/main/frontend/src/components/MerchantDashboard.tsx"
click node_demo "https://github.com/sairamchamakuri/razorpay-buildathon/blob/main/frontend/src/components/DemoToolbar.tsx"
click node_metrics "https://github.com/sairamchamakuri/razorpay-buildathon/blob/main/frontend/src/components/ModelMetricsModal.tsx"
click node_client_api "https://github.com/sairamchamakuri/razorpay-buildathon/blob/main/frontend/src/services/api.ts"
click node_payments "https://github.com/sairamchamakuri/razorpay-buildathon/blob/main/backend/app/api/payments.py"
click node_deferred "https://github.com/sairamchamakuri/razorpay-buildathon/blob/main/backend/app/api/deferred.py"
click node_merchant_api "https://github.com/sairamchamakuri/razorpay-buildathon/blob/main/backend/app/api/merchant.py"
click node_demo_api "https://github.com/sairamchamakuri/razorpay-buildathon/blob/main/backend/app/api/demo.py"
click node_risk_api "https://github.com/sairamchamakuri/razorpay-buildathon/blob/main/backend/app/api/risk.py"
click node_risk_engine "https://github.com/sairamchamakuri/razorpay-buildathon/blob/main/backend/app/services/risk_engine.py"
click node_features "https://github.com/sairamchamakuri/razorpay-buildathon/blob/main/ml/features.py"
click node_db "https://github.com/sairamchamakuri/razorpay-buildathon/blob/main/backend/app/database.py"
click node_entities "https://github.com/sairamchamakuri/razorpay-buildathon/blob/main/backend/app/models/entities.py"
click node_settlement "https://github.com/sairamchamakuri/razorpay-buildathon/blob/main/backend/app/services/settlement_service.py"
click node_notifications "https://github.com/sairamchamakuri/razorpay-buildathon/blob/main/backend/app/services/notification_service.py"
click node_audit "https://github.com/sairamchamakuri/razorpay-buildathon/blob/main/backend/app/services/audit_service.py"
click node_app_entry "https://github.com/sairamchamakuri/razorpay-buildathon/blob/main/backend/app/main.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_pos,node_customer_view,node_dashboard,node_demo,node_metrics,node_client_api toneBlue
class node_payments,node_deferred,node_merchant_api,node_demo_api,node_risk_api,node_app_entry toneAmber
class node_risk_engine,node_features toneMint
class node_db,node_entities,node_settlement,node_notifications,node_audit toneRose
class node_merchant toneIndigo
```

## Components

### POS experience

- [Application shell](https://github.com/sairamchamakuri/razorpay-buildathon/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Merchant POS](https://github.com/sairamchamakuri/razorpay-buildathon/blob/main/frontend/src/components/MerchantPOS.tsx): `frontend/src/components/MerchantPOS.tsx`
- [Customer mobile](https://github.com/sairamchamakuri/razorpay-buildathon/blob/main/frontend/src/components/CustomerMobile.tsx): `frontend/src/components/CustomerMobile.tsx`
- [Merchant dashboard](https://github.com/sairamchamakuri/razorpay-buildathon/blob/main/frontend/src/components/MerchantDashboard.tsx): `frontend/src/components/MerchantDashboard.tsx`
- [Demo controls](https://github.com/sairamchamakuri/razorpay-buildathon/blob/main/frontend/src/components/DemoToolbar.tsx): `frontend/src/components/DemoToolbar.tsx`
- [Model metrics view](https://github.com/sairamchamakuri/razorpay-buildathon/blob/main/frontend/src/components/ModelMetricsModal.tsx): `frontend/src/components/ModelMetricsModal.tsx`
- [HTTP API client](https://github.com/sairamchamakuri/razorpay-buildathon/blob/main/frontend/src/services/api.ts): `frontend/src/services/api.ts`

### Payment API

- [Payment intake](https://github.com/sairamchamakuri/razorpay-buildathon/blob/main/backend/app/api/payments.py): `backend/app/api/payments.py`
- [Deferred payment operations](https://github.com/sairamchamakuri/razorpay-buildathon/blob/main/backend/app/api/deferred.py): `backend/app/api/deferred.py`
- [Merchant analytics](https://github.com/sairamchamakuri/razorpay-buildathon/blob/main/backend/app/api/merchant.py): `backend/app/api/merchant.py`
- [Demo operations](https://github.com/sairamchamakuri/razorpay-buildathon/blob/main/backend/app/api/demo.py): `backend/app/api/demo.py`
- [Customer risk endpoint](https://github.com/sairamchamakuri/razorpay-buildathon/blob/main/backend/app/api/risk.py): `backend/app/api/risk.py`
- [FastAPI application](https://github.com/sairamchamakuri/razorpay-buildathon/blob/main/backend/app/main.py): `backend/app/main.py`

### Risk assessment

- [Risk policy and scoring](https://github.com/sairamchamakuri/razorpay-buildathon/blob/main/backend/app/services/risk_engine.py): `backend/app/services/risk_engine.py`
- [Customer features](https://github.com/sairamchamakuri/razorpay-buildathon/blob/main/ml/features.py): `ml/features.py`

### Deferred lifecycle and state

- [Database session](https://github.com/sairamchamakuri/razorpay-buildathon/blob/main/backend/app/database.py): `backend/app/database.py`
- [Payment entities](https://github.com/sairamchamakuri/razorpay-buildathon/blob/main/backend/app/models/entities.py): `backend/app/models/entities.py`
- [Settlement methods](https://github.com/sairamchamakuri/razorpay-buildathon/blob/main/backend/app/services/settlement_service.py): `backend/app/services/settlement_service.py`
- [Reminder notifications](https://github.com/sairamchamakuri/razorpay-buildathon/blob/main/backend/app/services/notification_service.py): `backend/app/services/notification_service.py`
- [Audit log](https://github.com/sairamchamakuri/razorpay-buildathon/blob/main/backend/app/services/audit_service.py): `backend/app/services/audit_service.py`

### Other components

- **Merchant or customer**

## Connections

- Merchant or customer → Application shell: uses (evidence: `README.md`)
- Application shell → Merchant POS: renders (evidence: `frontend/src/App.tsx`)
- Application shell → Customer mobile: renders (evidence: `frontend/src/App.tsx`)
- Application shell → Merchant dashboard: renders (evidence: `frontend/src/App.tsx`)
- Application shell → Demo controls: renders (evidence: `frontend/src/App.tsx`)
- Application shell → Model metrics view: renders (evidence: `frontend/src/App.tsx`)
- Application shell → HTTP API client: calls (evidence: `frontend/src/App.tsx`)
- Merchant POS → HTTP API client: calls (evidence: `frontend/src/components/MerchantPOS.tsx`)
- Customer mobile → HTTP API client: calls (evidence: `frontend/src/components/CustomerMobile.tsx`)
- Merchant dashboard → HTTP API client: calls (evidence: `frontend/src/components/MerchantDashboard.tsx`)
- HTTP API client → Payment intake: requests (evidence: `README.md`)
- HTTP API client → Deferred payment operations: requests (evidence: `README.md`)
- HTTP API client → Merchant analytics: requests (evidence: `README.md`)
- HTTP API client → Demo operations: requests (evidence: `README.md`)
- HTTP API client → Customer risk endpoint: requests (evidence: `README.md`)
- Payment intake → Risk policy and scoring: evaluates risk (evidence: `backend/app/api/payments.py`)
- Risk policy and scoring → Customer features: extracts features (evidence: `backend/app/services/risk_engine.py`)
- Payment intake → Database session: reads and writes (evidence: `backend/app/api/payments.py`)
- Payment intake → Payment entities: creates records (evidence: `backend/app/api/payments.py`)
- Payment intake → Audit log: records events (evidence: `backend/app/api/payments.py`)
- Deferred payment operations → Database session: reads and writes (evidence: `backend/app/api/deferred.py`)
- Deferred payment operations → Payment entities: updates lifecycle (evidence: `backend/app/api/deferred.py`)
- Deferred payment operations → Settlement methods: processes settlement (evidence: `backend/app/api/deferred.py`)
- Deferred payment operations → Reminder notifications: dispatches reminders (evidence: `backend/app/api/deferred.py`)
- Deferred payment operations → Audit log: records events (evidence: `backend/app/api/deferred.py`)
- FastAPI application → Payment intake: registers router (evidence: `backend/app/main.py`)
- FastAPI application → Deferred payment operations: registers router (evidence: `backend/app/main.py`)
- FastAPI application → Merchant analytics: registers router (evidence: `backend/app/main.py`)
- FastAPI application → Demo operations: registers router (evidence: `backend/app/main.py`)
- FastAPI application → Customer risk endpoint: registers router (evidence: `backend/app/main.py`)
- Model metrics view → HTTP API client: loads metrics
