# praveenhallur123/fruad-detection architecture

> Architecture diagram of the GitHub repository praveenhallur123/fruad-detection, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/praveenhallur123/fruad-detection
- Repository: https://github.com/praveenhallur123/fruad-detection

## Overview

##### Project Type & Purpose
- A full-stack, real-time AI-powered fraud detection platform
- Frontend is a React single-page application (SPA) in `src/`
- Backend is a Node.js + Express service (not shown in the file tree but described in README)
- Integrates AI/ML fraud-detection APIs, behavioral biometrics, and dashboarding

##### Main Components
a. React Frontend
– UI Shell (public/index.html + src/index.js + src/index.css)
– Screen Modules (src/screens: Home, Alert, Recent)
– Utility Modules (src/utils: dummyAlerts, fraudDetection)
b. Node.js/Express Backend
– REST API endpoints for alert retrieval, fraud scoring
– Business logic that invokes ML/AI services
c. Fraud-Detection Engine (External Service or Microservice)
– Lightweight ML models or third-party APIs
d. Data Storage
– NoSQL or SQL database for storing alert logs, user sessions, behavior profiles
e. External Services
– SMS / Email / VOIP providers for real-time scam-call/SMS ingestion
f. Deployment Targets
– Frontend: Netlify
– Backend: Render/Vercel

##### Relationships & Data Flows
- User’s browser → React SPA (initial load from Netlify)
- React SPA → Backend API (HTTPS REST) for:
– Fetching recent alerts (GET /api/alerts)
– Submitting new interactions (POST /api/detect)
- Backend → Fraud-Detection Engine
– Sends payload for scanning (behavioral data, message content)
– Receives risk score / classification
- Backend → Database
– Writes alerts, user sessions, biometrics data
– Reads historical data for “Recent” screen
- Backend → Frontend
– Pushes live alerts via WebSocket or Server-Sent Events (for real-time updates)

##### Architectural Patterns & Principles
- Separation of concerns: UI vs. API vs. ML engine vs. Data store
- Modular React components: Screens vs. Utilities
- Layered architecture in backend: Router → Controller → Service → Data Access
- Event-driven updates (WebSocket/SSE) for real-time alerts
- Externalization of ML logic (microservice or third-party API)

##### Checklist
[ ] Notes on key libraries/frameworks: React.js, Express.js, WebSocket/SSE, ML API.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External User
    Browser["User Browser"]:::external

    %% Deployment Targets
    Netlify["Netlify"]:::external
    Vercel["Render/Vercel"]:::external

    %% React Frontend Container
    subgraph "React SPA"
        direction TB
        %% UI Shell
        subgraph "UI Shell"
            direction TB
            IndexHTML["index.html"]:::frontend
            IndexJS["index.js"]:::frontend
            IndexCSS["index.css"]:::frontend
            AppJS["App.js"]:::frontend
        end
        %% Screen Modules
        subgraph "Screens"
            direction TB
            HomeScreen["HomeScreen.js"]:::frontend
            AlertScreen["AlertScreen.js"]:::frontend
            RecentScreen["RecentScreen.js"]:::frontend
        end
        %% Utility Modules
        subgraph "Utils"
            direction TB
            DummyAlerts["dummyAlerts.js"]:::frontend
            FraudDetectionUtil["fraudDetection.js"]:::frontend
        end
    end

    %% Backend Service
    ExpressAPI["Express API"]:::backend

    %% Fraud Detection Engine
    FraudService["Fraud-Detection Service"]:::backend

    %% Database
    DB["Database"]:::datastore

    %% External Providers
    Providers["SMS/Email/Call Providers"]:::external

    %% Data Flows
    Browser -->|HTTP GET initial load| Netlify
    Netlify -->|Serves SPA| Browser
    Browser -->|Loads SPA| AppJS
    AppJS -->|HTTPS GET /api/alerts<br/>POST /api/detect| ExpressAPI
    ExpressAPI -->|Sends payload| FraudService
    FraudService -->|Returns risk score| ExpressAPI
    ExpressAPI -->|Reads/Writes data| DB
    ExpressAPI -->|Ingests messages| Providers
    ExpressAPI -->|WebSocket/SSE pushes| Browser

    %% Deployment Links
    Netlify -->|Deploys| IndexHTML
    Vercel -->|Deploys| ExpressAPI

    %% Click Events
    click IndexHTML "https://github.com/praveenhallur123/fruad-detection/blob/main/public/index.html"
    click IndexJS "https://github.com/praveenhallur123/fruad-detection/blob/main/src/index.js"
    click IndexCSS "https://github.com/praveenhallur123/fruad-detection/blob/main/src/index.css"
    click AppJS "https://github.com/praveenhallur123/fruad-detection/blob/main/src/App.js"
    click HomeScreen "https://github.com/praveenhallur123/fruad-detection/blob/main/src/screens/HomeScreen.js"
    click AlertScreen "https://github.com/praveenhallur123/fruad-detection/blob/main/src/screens/AlertScreen.js"
    click RecentScreen "https://github.com/praveenhallur123/fruad-detection/blob/main/src/screens/RecentScreen.js"
    click DummyAlerts "https://github.com/praveenhallur123/fruad-detection/blob/main/src/utils/dummyAlerts.js"
    click FraudDetectionUtil "https://github.com/praveenhallur123/fruad-detection/blob/main/src/utils/fraudDetection.js"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#000,stroke-width:1px
    classDef backend fill:#D0FFD0,stroke:#000,stroke-width:1px
    classDef datastore fill:#FFE0B2,stroke:#000,stroke-width:1px
    classDef external fill:#E1BEE7,stroke:#000,stroke-width:1px
```
