# thobilobah/frauddetectionsystem-gtguard-full architecture

> Architecture diagram of the GitHub repository thobilobah/frauddetectionsystem-gtguard-full, 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/thobilobah/frauddetectionsystem-gtguard-full
- Repository: https://github.com/thobilobah/frauddetectionsystem-gtguard-full

## Overview

UPI FraudGuard is a transaction-risk platform: the dashboard and payment gateway/simulator submit transactions to a FastAPI backend, which derives historical features, predicts fraud, explains risk, and exposes results for monitoring and review. PostgreSQL stores transaction and profile state; dashboard capabilities include analytics, model performance, history, and a review queue. Edges follow the excerpts, SOURCE INDEX references, or README; unsampled implementation details are not inferred.

Main entry points: [`backend/app/main.py`](https://github.com/thobilobah/frauddetectionsystem-gtguard-full/blob/main/backend/app/main.py) (FastAPI application), [`frontend/src/App.tsx`](https://github.com/thobilobah/frauddetectionsystem-gtguard-full/blob/main/frontend/src/App.tsx) (Dashboard shell), [`backend/app/routes/razorpay.py`](https://github.com/thobilobah/frauddetectionsystem-gtguard-full/blob/main/backend/app/routes/razorpay.py) (Razorpay webhook), [`backend/app/services/prediction_service.py`](https://github.com/thobilobah/frauddetectionsystem-gtguard-full/blob/main/backend/app/services/prediction_service.py) (Prediction pipeline)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Dashboard"]
  node_app["Dashboard shell<br/>[App.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
  node_analyzer["Transaction analyzer"]
  node_monitor["Live monitor<br/>[LiveMonitor.tsx]"]
  node_review["Review queue<br/>[ReviewQueue.tsx]"]
  node_theme["Theme context<br/>[ThemeContext.tsx]"]
  node_toast["Toast context<br/>[ToastContext.tsx]"]
end

subgraph group_api["API and ingestion"]
  node_server["FastAPI application<br/>[main.py]"]
  node_auth["JWT authentication<br/>[auth.py]"]
  node_prediction_route["Prediction routes<br/>[prediction.py]"]
  node_razorpay_route["Razorpay webhook<br/>[razorpay.py]"]
  node_transaction_route["Transaction routes<br/>[transactions.py]"]
  node_analytics_route["Analytics routes<br/>[analytics.py]"]
  node_razorpay_service["Webhook verification"]
end

subgraph group_risk["Risk analysis"]
  node_features["Feature engineering"]
  node_prediction["Prediction pipeline"]
  node_model["Model service<br/>[model_service.py]"]
  node_rules["Rule explanations<br/>[rule_engine.py]"]
end

subgraph group_state["Persistence"]
  node_database[("PostgreSQL transaction store")]
  node_config["Runtime settings<br/>[config.py]"]
end

node_analyst(("Analyst"))
node_gateway(("Razorpay / simulator"))

node_analyst -->|"uses"| node_app
node_app -->|"requests data"| node_api_client
node_analyzer -->|"submits predictions"| node_api_client
node_app -->|"renders"| node_monitor
node_app -->|"renders"| node_review
node_app -->|"uses"| node_theme
node_app -->|"uses"| node_toast
node_api_client -->|"calls API"| node_server
node_gateway -->|"sends webhook"| node_razorpay_route
node_server -->|"registers"| node_prediction_route
node_server -->|"registers"| node_razorpay_route
node_server -->|"registers"| node_transaction_route
node_server -->|"registers"| node_analytics_route
node_server -->|"protects routes"| node_auth
node_prediction_route -->|"builds features"| node_features
node_prediction_route -->|"requests prediction"| node_prediction
node_razorpay_route -->|"verifies webhook"| node_razorpay_service
node_razorpay_route -->|"builds features"| node_features
node_razorpay_route -->|"requests prediction"| node_prediction
node_transaction_route -->|"reads and writes"| node_database
node_analytics_route -->|"queries analytics"| node_database
node_features -->|"reads profiles"| node_database
node_prediction -->|"evaluates rules"| node_rules
node_prediction -->|"reads model setting"| node_database
node_server -->|"checks database"| node_database
node_server -->|"loads settings"| node_config
node_prediction -.->|"uses model implementation"| node_model

click node_app "https://github.com/thobilobah/frauddetectionsystem-gtguard-full/blob/main/frontend/src/App.tsx"
click node_api_client "https://github.com/thobilobah/frauddetectionsystem-gtguard-full/blob/main/frontend/src/services/api.ts"
click node_analyzer "https://github.com/thobilobah/frauddetectionsystem-gtguard-full/blob/main/frontend/src/pages/TransactionAnalyzer.tsx"
click node_monitor "https://github.com/thobilobah/frauddetectionsystem-gtguard-full/blob/main/frontend/src/pages/LiveMonitor.tsx"
click node_review "https://github.com/thobilobah/frauddetectionsystem-gtguard-full/blob/main/frontend/src/pages/ReviewQueue.tsx"
click node_theme "https://github.com/thobilobah/frauddetectionsystem-gtguard-full/blob/main/frontend/src/context/ThemeContext.tsx"
click node_toast "https://github.com/thobilobah/frauddetectionsystem-gtguard-full/blob/main/frontend/src/context/ToastContext.tsx"
click node_server "https://github.com/thobilobah/frauddetectionsystem-gtguard-full/blob/main/backend/app/main.py"
click node_auth "https://github.com/thobilobah/frauddetectionsystem-gtguard-full/blob/main/backend/app/auth.py"
click node_prediction_route "https://github.com/thobilobah/frauddetectionsystem-gtguard-full/blob/main/backend/app/routes/prediction.py"
click node_razorpay_route "https://github.com/thobilobah/frauddetectionsystem-gtguard-full/blob/main/backend/app/routes/razorpay.py"
click node_transaction_route "https://github.com/thobilobah/frauddetectionsystem-gtguard-full/blob/main/backend/app/routes/transactions.py"
click node_analytics_route "https://github.com/thobilobah/frauddetectionsystem-gtguard-full/blob/main/backend/app/routes/analytics.py"
click node_razorpay_service "https://github.com/thobilobah/frauddetectionsystem-gtguard-full/blob/main/backend/app/services/razorpay_service.py"
click node_features "https://github.com/thobilobah/frauddetectionsystem-gtguard-full/blob/main/backend/app/services/feature_engineering.py"
click node_prediction "https://github.com/thobilobah/frauddetectionsystem-gtguard-full/blob/main/backend/app/services/prediction_service.py"
click node_model "https://github.com/thobilobah/frauddetectionsystem-gtguard-full/blob/main/backend/app/services/model_service.py"
click node_rules "https://github.com/thobilobah/frauddetectionsystem-gtguard-full/blob/main/backend/app/services/rule_engine.py"
click node_database "https://github.com/thobilobah/frauddetectionsystem-gtguard-full/blob/main/backend/app/repositories/transaction_repository.py"
click node_config "https://github.com/thobilobah/frauddetectionsystem-gtguard-full/blob/main/backend/app/config.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_api_client,node_analyzer,node_monitor,node_review,node_theme,node_toast toneBlue
class node_server,node_auth,node_prediction_route,node_razorpay_route,node_transaction_route,node_analytics_route,node_razorpay_service toneAmber
class node_features,node_prediction,node_model,node_rules toneMint
class node_database,node_config toneRose
class node_analyst,node_gateway toneIndigo
```

## Components

### Dashboard

- [Dashboard shell](https://github.com/thobilobah/frauddetectionsystem-gtguard-full/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [API client](https://github.com/thobilobah/frauddetectionsystem-gtguard-full/blob/main/frontend/src/services/api.ts): `frontend/src/services/api.ts`
- [Transaction analyzer](https://github.com/thobilobah/frauddetectionsystem-gtguard-full/blob/main/frontend/src/pages/TransactionAnalyzer.tsx): `frontend/src/pages/TransactionAnalyzer.tsx`
- [Live monitor](https://github.com/thobilobah/frauddetectionsystem-gtguard-full/blob/main/frontend/src/pages/LiveMonitor.tsx): `frontend/src/pages/LiveMonitor.tsx`
- [Review queue](https://github.com/thobilobah/frauddetectionsystem-gtguard-full/blob/main/frontend/src/pages/ReviewQueue.tsx): `frontend/src/pages/ReviewQueue.tsx`
- [Theme context](https://github.com/thobilobah/frauddetectionsystem-gtguard-full/blob/main/frontend/src/context/ThemeContext.tsx): `frontend/src/context/ThemeContext.tsx`
- [Toast context](https://github.com/thobilobah/frauddetectionsystem-gtguard-full/blob/main/frontend/src/context/ToastContext.tsx): `frontend/src/context/ToastContext.tsx`

### API and ingestion

- [FastAPI application](https://github.com/thobilobah/frauddetectionsystem-gtguard-full/blob/main/backend/app/main.py): `backend/app/main.py`
- [JWT authentication](https://github.com/thobilobah/frauddetectionsystem-gtguard-full/blob/main/backend/app/auth.py): `backend/app/auth.py`
- [Prediction routes](https://github.com/thobilobah/frauddetectionsystem-gtguard-full/blob/main/backend/app/routes/prediction.py): `backend/app/routes/prediction.py`
- [Razorpay webhook](https://github.com/thobilobah/frauddetectionsystem-gtguard-full/blob/main/backend/app/routes/razorpay.py): `backend/app/routes/razorpay.py`
- [Transaction routes](https://github.com/thobilobah/frauddetectionsystem-gtguard-full/blob/main/backend/app/routes/transactions.py): `backend/app/routes/transactions.py`
- [Analytics routes](https://github.com/thobilobah/frauddetectionsystem-gtguard-full/blob/main/backend/app/routes/analytics.py): `backend/app/routes/analytics.py`
- [Webhook verification](https://github.com/thobilobah/frauddetectionsystem-gtguard-full/blob/main/backend/app/services/razorpay_service.py): `backend/app/services/razorpay_service.py`

### Risk analysis

- [Feature engineering](https://github.com/thobilobah/frauddetectionsystem-gtguard-full/blob/main/backend/app/services/feature_engineering.py): `backend/app/services/feature_engineering.py`
- [Prediction pipeline](https://github.com/thobilobah/frauddetectionsystem-gtguard-full/blob/main/backend/app/services/prediction_service.py): `backend/app/services/prediction_service.py`
- [Model service](https://github.com/thobilobah/frauddetectionsystem-gtguard-full/blob/main/backend/app/services/model_service.py): `backend/app/services/model_service.py`
- [Rule explanations](https://github.com/thobilobah/frauddetectionsystem-gtguard-full/blob/main/backend/app/services/rule_engine.py): `backend/app/services/rule_engine.py`

### Persistence

- [PostgreSQL transaction store](https://github.com/thobilobah/frauddetectionsystem-gtguard-full/blob/main/backend/app/repositories/transaction_repository.py): `backend/app/repositories/transaction_repository.py`
- [Runtime settings](https://github.com/thobilobah/frauddetectionsystem-gtguard-full/blob/main/backend/app/config.py): `backend/app/config.py`

### Other components

- **Analyst**
- **Razorpay / simulator**

## Connections

- Analyst → Dashboard shell: uses (evidence: `frontend/src/App.tsx`)
- Dashboard shell → API client: requests data (evidence: `frontend/src/App.tsx`)
- Transaction analyzer → API client: submits predictions (evidence: `frontend/src/pages/TransactionAnalyzer.tsx`)
- Dashboard shell → Live monitor: renders (evidence: `frontend/src/App.tsx`)
- Dashboard shell → Review queue: renders (evidence: `frontend/src/App.tsx`)
- Dashboard shell → Theme context: uses (evidence: `frontend/src/App.tsx`)
- Dashboard shell → Toast context: uses (evidence: `frontend/src/App.tsx`)
- API client → FastAPI application: calls API (evidence: `frontend/src/services/api.ts`)
- Razorpay / simulator → Razorpay webhook: sends webhook (evidence: `README.md`)
- FastAPI application → Prediction routes: registers (evidence: `backend/app/main.py`)
- FastAPI application → Razorpay webhook: registers (evidence: `backend/app/main.py`)
- FastAPI application → Transaction routes: registers (evidence: `backend/app/main.py`)
- FastAPI application → Analytics routes: registers (evidence: `backend/app/main.py`)
- FastAPI application → JWT authentication: protects routes (evidence: `backend/app/main.py`)
- Prediction routes → Feature engineering: builds features (evidence: `backend/app/routes/prediction.py`)
- Prediction routes → Prediction pipeline: requests prediction (evidence: `backend/app/routes/prediction.py`)
- Razorpay webhook → Webhook verification: verifies webhook (evidence: `backend/app/routes/razorpay.py`)
- Razorpay webhook → Feature engineering: builds features (evidence: `backend/app/routes/razorpay.py`)
- Razorpay webhook → Prediction pipeline: requests prediction (evidence: `backend/app/routes/razorpay.py`)
- Transaction routes → PostgreSQL transaction store: reads and writes (evidence: `backend/app/routes/transactions.py`)
- Analytics routes → PostgreSQL transaction store: queries analytics (evidence: `backend/app/routes/analytics.py`)
- Feature engineering → PostgreSQL transaction store: reads profiles (evidence: `backend/app/services/feature_engineering.py`)
- Prediction pipeline → Rule explanations: evaluates rules (evidence: `backend/app/services/prediction_service.py`)
- Prediction pipeline → PostgreSQL transaction store: reads model setting (evidence: `backend/app/services/prediction_service.py`)
- FastAPI application → PostgreSQL transaction store: checks database (evidence: `backend/app/main.py`)
- FastAPI application → Runtime settings: loads settings (evidence: `backend/app/main.py`)
- Prediction pipeline → Model service: uses model implementation
