# sumitmaurya2/veritas-ai-powered-financial-fraud-detection-risk-analysis-system architecture

> Architecture diagram of the GitHub repository sumitmaurya2/veritas-ai-powered-financial-fraud-detection-risk-analysis-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sumitmaurya2/veritas-ai-powered-financial-fraud-detection-risk-analysis-system
- Repository: https://github.com/sumitmaurya2/veritas-ai-powered-financial-fraud-detection-risk-analysis-system

## Overview

Veritas AI is a web application for transaction fraud prediction and history, backed by an Express API and a FastAPI model service. The user flow is: enter transaction and customer details, submit a prediction request, preprocess and score it, return fraud/risk/confidence, and store the prediction for later history viewing. The README also describes model-training and explainability capabilities, but no training scripts or dataset files appear in the tree, so these are noted without implementation nodes. Some frontend component internals and prediction pages were not excerpted; relationships are included only where the index or shown source supports them.

Main entry points: [`frontend/src/routes/AppRoutes.tsx`](https://github.com/sumitmaurya2/veritas-ai-powered-financial-fraud-detection-risk-analysis-system/blob/main/frontend/src/routes/AppRoutes.tsx) (Page routing), [`frontend/src/pages/Predict.tsx`](https://github.com/sumitmaurya2/veritas-ai-powered-financial-fraud-detection-risk-analysis-system/blob/main/frontend/src/pages/Predict.tsx) (Prediction page), [`frontend/src/components/layout/Layout.tsx`](https://github.com/sumitmaurya2/veritas-ai-powered-financial-fraud-detection-risk-analysis-system/blob/main/frontend/src/components/layout/Layout.tsx) (Shared layout), [`backend/src/controllers/prediction.controller.ts`](https://github.com/sumitmaurya2/veritas-ai-powered-financial-fraud-detection-risk-analysis-system/blob/main/backend/src/controllers/prediction.controller.ts) (Prediction controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["User interface"]
  node_routes["Page routing<br/>[AppRoutes.tsx]"]
  node_home["Home overview<br/>[Home.tsx]"]
  node_predict["Prediction page<br/>[Predict.tsx]"]
  node_form["Transaction form<br/>[PredictionForm.tsx]"]
  node_result["Risk result panel"]
  node_history["History page<br/>[History.tsx]"]
  node_layout["Shared layout<br/>[Layout.tsx]"]
  node_navbar["Navigation bar<br/>[Navbar.tsx]"]
  node_footer["Footer<br/>[Footer.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
end

subgraph group_api["Prediction API"]
  node_backend_app["HTTP application<br/>[app.ts]"]
  node_prediction_routes["Prediction routes"]
  node_controller["Prediction controller"]
end

subgraph group_ml["Model inference"]
  node_ml_service["Inference API<br/>[main.py]"]
  node_preprocess["Input preprocessing<br/>[preprocess.py]"]
  node_feature_names["Feature schema<br/>[feature_names.py]"]
  node_model["Trained model and scaler<br/>[main.py]"]
  node_train["Model training and evaluation"]
  node_explain["SHAP explanations"]
end

subgraph group_storage["Prediction history"]
  node_mongo[("MongoDB predictions<br/>[Prediction.ts]")]
end

node_user(("Analyst"))

node_user -->|"opens app"| node_routes
node_routes -->|"routes to"| node_home
node_routes -->|"routes to"| node_predict
node_routes -->|"routes to"| node_history
node_routes -->|"renders within"| node_layout
node_layout -->|"renders"| node_navbar
node_layout -->|"renders"| node_footer
node_navbar -->|"navigates via"| node_routes
node_predict -->|"renders"| node_form
node_predict -->|"renders"| node_result
node_predict -->|"requests prediction"| node_api_client
node_history -->|"requests history"| node_api_client
node_api_client -.->|"HTTP requests"| node_backend_app
node_backend_app -->|"mounts at API path"| node_prediction_routes
node_prediction_routes -->|"dispatches handlers"| node_controller
node_controller -->|"posts prediction"| node_ml_service
node_controller -->|"saves and queries"| node_mongo
node_ml_service -->|"preprocesses input"| node_preprocess
node_preprocess -->|"uses feature columns"| node_feature_names
node_ml_service -->|"scales and scores"| node_model
node_train -.->|"produces saved model"| node_model
node_train -.->|"supports explainability"| node_explain

click node_routes "https://github.com/sumitmaurya2/veritas-ai-powered-financial-fraud-detection-risk-analysis-system/blob/main/frontend/src/routes/AppRoutes.tsx"
click node_home "https://github.com/sumitmaurya2/veritas-ai-powered-financial-fraud-detection-risk-analysis-system/blob/main/frontend/src/pages/Home.tsx"
click node_predict "https://github.com/sumitmaurya2/veritas-ai-powered-financial-fraud-detection-risk-analysis-system/blob/main/frontend/src/pages/Predict.tsx"
click node_form "https://github.com/sumitmaurya2/veritas-ai-powered-financial-fraud-detection-risk-analysis-system/blob/main/frontend/src/components/prediction/PredictionForm.tsx"
click node_result "https://github.com/sumitmaurya2/veritas-ai-powered-financial-fraud-detection-risk-analysis-system/blob/main/frontend/src/components/prediction/PredictionPanel.tsx"
click node_history "https://github.com/sumitmaurya2/veritas-ai-powered-financial-fraud-detection-risk-analysis-system/blob/main/frontend/src/pages/History.tsx"
click node_layout "https://github.com/sumitmaurya2/veritas-ai-powered-financial-fraud-detection-risk-analysis-system/blob/main/frontend/src/components/layout/Layout.tsx"
click node_navbar "https://github.com/sumitmaurya2/veritas-ai-powered-financial-fraud-detection-risk-analysis-system/blob/main/frontend/src/components/layout/Navbar.tsx"
click node_footer "https://github.com/sumitmaurya2/veritas-ai-powered-financial-fraud-detection-risk-analysis-system/blob/main/frontend/src/components/layout/Footer.tsx"
click node_api_client "https://github.com/sumitmaurya2/veritas-ai-powered-financial-fraud-detection-risk-analysis-system/blob/main/frontend/src/services/api.ts"
click node_backend_app "https://github.com/sumitmaurya2/veritas-ai-powered-financial-fraud-detection-risk-analysis-system/blob/main/backend/src/app.ts"
click node_prediction_routes "https://github.com/sumitmaurya2/veritas-ai-powered-financial-fraud-detection-risk-analysis-system/blob/main/backend/src/routes/prediction.routes.ts"
click node_controller "https://github.com/sumitmaurya2/veritas-ai-powered-financial-fraud-detection-risk-analysis-system/blob/main/backend/src/controllers/prediction.controller.ts"
click node_ml_service "https://github.com/sumitmaurya2/veritas-ai-powered-financial-fraud-detection-risk-analysis-system/blob/main/ml-service/main.py"
click node_preprocess "https://github.com/sumitmaurya2/veritas-ai-powered-financial-fraud-detection-risk-analysis-system/blob/main/ml-service/preprocess.py"
click node_feature_names "https://github.com/sumitmaurya2/veritas-ai-powered-financial-fraud-detection-risk-analysis-system/blob/main/ml-service/feature_names.py"
click node_model "https://github.com/sumitmaurya2/veritas-ai-powered-financial-fraud-detection-risk-analysis-system/blob/main/ml-service/main.py"
click node_mongo "https://github.com/sumitmaurya2/veritas-ai-powered-financial-fraud-detection-risk-analysis-system/blob/main/backend/src/models/Prediction.ts"

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_routes,node_home,node_predict,node_form,node_result,node_history,node_layout,node_navbar,node_footer,node_api_client toneBlue
class node_backend_app,node_prediction_routes,node_controller toneAmber
class node_ml_service,node_preprocess,node_feature_names,node_model,node_train,node_explain toneMint
class node_mongo toneRose
class node_user toneIndigo
```

## Components

### User interface

- [Page routing](https://github.com/sumitmaurya2/veritas-ai-powered-financial-fraud-detection-risk-analysis-system/blob/main/frontend/src/routes/AppRoutes.tsx): `frontend/src/routes/AppRoutes.tsx`
- [Home overview](https://github.com/sumitmaurya2/veritas-ai-powered-financial-fraud-detection-risk-analysis-system/blob/main/frontend/src/pages/Home.tsx): `frontend/src/pages/Home.tsx`
- [Prediction page](https://github.com/sumitmaurya2/veritas-ai-powered-financial-fraud-detection-risk-analysis-system/blob/main/frontend/src/pages/Predict.tsx): `frontend/src/pages/Predict.tsx`
- [Transaction form](https://github.com/sumitmaurya2/veritas-ai-powered-financial-fraud-detection-risk-analysis-system/blob/main/frontend/src/components/prediction/PredictionForm.tsx): `frontend/src/components/prediction/PredictionForm.tsx`
- [Risk result panel](https://github.com/sumitmaurya2/veritas-ai-powered-financial-fraud-detection-risk-analysis-system/blob/main/frontend/src/components/prediction/PredictionPanel.tsx): `frontend/src/components/prediction/PredictionPanel.tsx`
- [History page](https://github.com/sumitmaurya2/veritas-ai-powered-financial-fraud-detection-risk-analysis-system/blob/main/frontend/src/pages/History.tsx): `frontend/src/pages/History.tsx`
- [Shared layout](https://github.com/sumitmaurya2/veritas-ai-powered-financial-fraud-detection-risk-analysis-system/blob/main/frontend/src/components/layout/Layout.tsx): `frontend/src/components/layout/Layout.tsx`
- [Navigation bar](https://github.com/sumitmaurya2/veritas-ai-powered-financial-fraud-detection-risk-analysis-system/blob/main/frontend/src/components/layout/Navbar.tsx): `frontend/src/components/layout/Navbar.tsx`
- [Footer](https://github.com/sumitmaurya2/veritas-ai-powered-financial-fraud-detection-risk-analysis-system/blob/main/frontend/src/components/layout/Footer.tsx): `frontend/src/components/layout/Footer.tsx`
- [API client](https://github.com/sumitmaurya2/veritas-ai-powered-financial-fraud-detection-risk-analysis-system/blob/main/frontend/src/services/api.ts): `frontend/src/services/api.ts`

### Prediction API

- [HTTP application](https://github.com/sumitmaurya2/veritas-ai-powered-financial-fraud-detection-risk-analysis-system/blob/main/backend/src/app.ts): `backend/src/app.ts`
- [Prediction routes](https://github.com/sumitmaurya2/veritas-ai-powered-financial-fraud-detection-risk-analysis-system/blob/main/backend/src/routes/prediction.routes.ts): `backend/src/routes/prediction.routes.ts`
- [Prediction controller](https://github.com/sumitmaurya2/veritas-ai-powered-financial-fraud-detection-risk-analysis-system/blob/main/backend/src/controllers/prediction.controller.ts): `backend/src/controllers/prediction.controller.ts`

### Model inference

- [Inference API](https://github.com/sumitmaurya2/veritas-ai-powered-financial-fraud-detection-risk-analysis-system/blob/main/ml-service/main.py): `ml-service/main.py`
- [Input preprocessing](https://github.com/sumitmaurya2/veritas-ai-powered-financial-fraud-detection-risk-analysis-system/blob/main/ml-service/preprocess.py): `ml-service/preprocess.py`
- [Feature schema](https://github.com/sumitmaurya2/veritas-ai-powered-financial-fraud-detection-risk-analysis-system/blob/main/ml-service/feature_names.py): `ml-service/feature_names.py`
- [Trained model and scaler](https://github.com/sumitmaurya2/veritas-ai-powered-financial-fraud-detection-risk-analysis-system/blob/main/ml-service/main.py): `ml-service/main.py`
- **Model training and evaluation**
- **SHAP explanations**

### Prediction history

- [MongoDB predictions](https://github.com/sumitmaurya2/veritas-ai-powered-financial-fraud-detection-risk-analysis-system/blob/main/backend/src/models/Prediction.ts): `backend/src/models/Prediction.ts`

### Other components

- **Analyst**

## Connections

- Analyst → Page routing: opens app (evidence: `frontend/src/routes/AppRoutes.tsx`)
- Page routing → Home overview: routes to (evidence: `frontend/src/routes/AppRoutes.tsx`)
- Page routing → Prediction page: routes to (evidence: `frontend/src/routes/AppRoutes.tsx`)
- Page routing → History page: routes to (evidence: `frontend/src/routes/AppRoutes.tsx`)
- Page routing → Shared layout: renders within (evidence: `frontend/src/routes/AppRoutes.tsx`)
- Shared layout → Navigation bar: renders (evidence: `frontend/src/components/layout/Layout.tsx`)
- Shared layout → Footer: renders (evidence: `frontend/src/components/layout/Layout.tsx`)
- Navigation bar → Page routing: navigates via (evidence: `frontend/src/components/layout/Navbar.tsx`)
- Prediction page → Transaction form: renders (evidence: `frontend/src/pages/Predict.tsx`)
- Prediction page → Risk result panel: renders (evidence: `frontend/src/pages/Predict.tsx`)
- Prediction page → API client: requests prediction (evidence: `frontend/src/pages/Predict.tsx`)
- History page → API client: requests history (evidence: `frontend/src/pages/History.tsx`)
- API client → HTTP application: HTTP requests
- HTTP application → Prediction routes: mounts at API path (evidence: `backend/src/app.ts`)
- Prediction routes → Prediction controller: dispatches handlers (evidence: `backend/src/routes/prediction.routes.ts`)
- Prediction controller → Inference API: posts prediction (evidence: `backend/src/controllers/prediction.controller.ts`)
- Prediction controller → MongoDB predictions: saves and queries (evidence: `backend/src/controllers/prediction.controller.ts`)
- Inference API → Input preprocessing: preprocesses input (evidence: `ml-service/main.py`)
- Input preprocessing → Feature schema: uses feature columns (evidence: `ml-service/preprocess.py`)
- Inference API → Trained model and scaler: scales and scores (evidence: `ml-service/main.py`)
- Model training and evaluation → Trained model and scaler: produces saved model
- Model training and evaluation → SHAP explanations: supports explainability
