# azeez11223/click-fraud-detection architecture

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

- Interactive diagram: https://gitdiagram.com/azeez11223/click-fraud-detection
- Repository: https://github.com/azeez11223/click-fraud-detection

## Overview

AdShield is a click-fraud detection platform with a Streamlit dashboard and FastAPI service. A user navigates the dashboard to submit click attributes or manage campaigns; page-specific API helpers send requests to the backend, which classifies clicks, records results, and exposes analytics. The product also supports model training, IP blocklists and bulk uploads, and Google/Facebook event monitoring. The source index and README establish the main module links; unsampled runtime details and some page-to-endpoint mappings are not inferred.

Main entry points: [`frontend/app.py`](https://github.com/azeez11223/click-fraud-detection/blob/main/frontend/app.py) (Streamlit app), [`frontend/components/api.py`](https://github.com/azeez11223/click-fraud-detection/blob/main/frontend/components/api.py) (API helpers), [`backend/main.py`](https://github.com/azeez11223/click-fraud-detection/blob/main/backend/main.py) (FastAPI routes), [`frontend/components/charts.py`](https://github.com/azeez11223/click-fraud-detection/blob/main/frontend/components/charts.py) (Charts)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Dashboard"]
  node_app["Streamlit app<br/>[app.py]"]
  node_prediction["Click prediction<br/>[predict.py]"]
  node_campaigns["Campaign pages<br/>[campaigns.py]"]
  node_campaign_detail["Campaign detail<br/>[campaign_detail.py]"]
  node_dashboard["Dashboard analytics<br/>[dashboard.py]"]
  node_analytics["Analytics<br/>[analytics.py]"]
  node_history["Prediction history<br/>[history.py]"]
  node_ip_manager["IP management<br/>[ip_manager.py]"]
  node_platform["Platform integrations"]
  node_realtime["Realtime monitor"]
  node_signup["Signup<br/>[signup.py]"]
  node_login["Login<br/>[login.py]"]
  node_about["About<br/>[about.py]"]
  node_charts["Charts<br/>[charts.py]"]
  node_styles["UI styles<br/>[styles.py]"]
end

subgraph group_api["Service API"]
  node_api_client["API helpers<br/>[api.py]"]
  node_backend["FastAPI routes<br/>[main.py]"]
  node_auth["JWT authentication<br/>[auth.py]"]
end

subgraph group_fraud["Detection"]
  node_model["Fraud model<br/>[model.py]"]
  node_preprocess["Feature engineering<br/>[preprocess.py]"]
end

subgraph group_state["Persistence"]
  node_database[("SQLite data<br/>[database.py]")]
end

node_user(("Dashboard user"))

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_signup
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_realtime
node_app -->|"routes to"| node_campaigns
node_app -->|"routes to"| node_campaign_detail
node_app -->|"routes to"| node_platform
node_app -->|"routes to"| node_ip_manager
node_app -->|"routes to"| node_prediction
node_app -->|"routes to"| node_analytics
node_app -->|"routes to"| node_history
node_app -->|"routes to"| node_about
node_prediction -->|"calls"| node_api_client
node_campaigns -->|"calls"| node_api_client
node_campaign_detail -->|"calls"| node_api_client
node_dashboard -->|"calls"| node_api_client
node_analytics -->|"calls"| node_api_client
node_history -->|"calls"| node_api_client
node_ip_manager -->|"calls"| node_api_client
node_platform -->|"calls"| node_api_client
node_realtime -->|"calls"| node_api_client
node_signup -->|"calls"| node_api_client
node_login -->|"calls"| node_api_client
node_api_client -->|"HTTP requests"| node_backend
node_backend -->|"invokes"| node_model
node_backend -->|"reads and writes"| node_database
node_backend -->|"uses"| node_auth
node_model -->|"uses"| node_preprocess
node_dashboard -->|"uses"| node_charts
node_analytics -->|"uses"| node_charts
node_prediction -->|"uses"| node_charts
node_charts -->|"applies theme"| node_styles
node_app -->|"applies styles"| node_styles

click node_app "https://github.com/azeez11223/click-fraud-detection/blob/main/frontend/app.py"
click node_prediction "https://github.com/azeez11223/click-fraud-detection/blob/main/frontend/pages/predict.py"
click node_campaigns "https://github.com/azeez11223/click-fraud-detection/blob/main/frontend/pages/campaigns.py"
click node_campaign_detail "https://github.com/azeez11223/click-fraud-detection/blob/main/frontend/pages/campaign_detail.py"
click node_dashboard "https://github.com/azeez11223/click-fraud-detection/blob/main/frontend/pages/dashboard.py"
click node_analytics "https://github.com/azeez11223/click-fraud-detection/blob/main/frontend/pages/analytics.py"
click node_history "https://github.com/azeez11223/click-fraud-detection/blob/main/frontend/pages/history.py"
click node_ip_manager "https://github.com/azeez11223/click-fraud-detection/blob/main/frontend/pages/ip_manager.py"
click node_platform "https://github.com/azeez11223/click-fraud-detection/blob/main/frontend/pages/platform_integrations.py"
click node_realtime "https://github.com/azeez11223/click-fraud-detection/blob/main/frontend/pages/realtime_monitor.py"
click node_signup "https://github.com/azeez11223/click-fraud-detection/blob/main/frontend/pages/signup.py"
click node_login "https://github.com/azeez11223/click-fraud-detection/blob/main/frontend/pages/login.py"
click node_about "https://github.com/azeez11223/click-fraud-detection/blob/main/frontend/pages/about.py"
click node_api_client "https://github.com/azeez11223/click-fraud-detection/blob/main/frontend/components/api.py"
click node_charts "https://github.com/azeez11223/click-fraud-detection/blob/main/frontend/components/charts.py"
click node_styles "https://github.com/azeez11223/click-fraud-detection/blob/main/frontend/components/styles.py"
click node_backend "https://github.com/azeez11223/click-fraud-detection/blob/main/backend/main.py"
click node_auth "https://github.com/azeez11223/click-fraud-detection/blob/main/backend/auth.py"
click node_model "https://github.com/azeez11223/click-fraud-detection/blob/main/backend/model.py"
click node_preprocess "https://github.com/azeez11223/click-fraud-detection/blob/main/backend/preprocess.py"
click node_database "https://github.com/azeez11223/click-fraud-detection/blob/main/backend/database.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_prediction,node_campaigns,node_campaign_detail,node_dashboard,node_analytics,node_history,node_ip_manager,node_platform,node_realtime,node_signup,node_login,node_about,node_charts,node_styles,node_user toneBlue
class node_api_client,node_backend,node_auth toneAmber
class node_model,node_preprocess toneMint
class node_database toneRose
```

## Components

### Dashboard

- [Streamlit app](https://github.com/azeez11223/click-fraud-detection/blob/main/frontend/app.py): `frontend/app.py`
- [Click prediction](https://github.com/azeez11223/click-fraud-detection/blob/main/frontend/pages/predict.py): `frontend/pages/predict.py`
- [Campaign pages](https://github.com/azeez11223/click-fraud-detection/blob/main/frontend/pages/campaigns.py): `frontend/pages/campaigns.py`
- [Campaign detail](https://github.com/azeez11223/click-fraud-detection/blob/main/frontend/pages/campaign_detail.py): `frontend/pages/campaign_detail.py`
- [Dashboard analytics](https://github.com/azeez11223/click-fraud-detection/blob/main/frontend/pages/dashboard.py): `frontend/pages/dashboard.py`
- [Analytics](https://github.com/azeez11223/click-fraud-detection/blob/main/frontend/pages/analytics.py): `frontend/pages/analytics.py`
- [Prediction history](https://github.com/azeez11223/click-fraud-detection/blob/main/frontend/pages/history.py): `frontend/pages/history.py`
- [IP management](https://github.com/azeez11223/click-fraud-detection/blob/main/frontend/pages/ip_manager.py): `frontend/pages/ip_manager.py`
- [Platform integrations](https://github.com/azeez11223/click-fraud-detection/blob/main/frontend/pages/platform_integrations.py): `frontend/pages/platform_integrations.py`
- [Realtime monitor](https://github.com/azeez11223/click-fraud-detection/blob/main/frontend/pages/realtime_monitor.py): `frontend/pages/realtime_monitor.py`
- [Signup](https://github.com/azeez11223/click-fraud-detection/blob/main/frontend/pages/signup.py): `frontend/pages/signup.py`
- [Login](https://github.com/azeez11223/click-fraud-detection/blob/main/frontend/pages/login.py): `frontend/pages/login.py`
- [About](https://github.com/azeez11223/click-fraud-detection/blob/main/frontend/pages/about.py): `frontend/pages/about.py`
- [Charts](https://github.com/azeez11223/click-fraud-detection/blob/main/frontend/components/charts.py): `frontend/components/charts.py`
- [UI styles](https://github.com/azeez11223/click-fraud-detection/blob/main/frontend/components/styles.py): `frontend/components/styles.py`

### Service API

- [API helpers](https://github.com/azeez11223/click-fraud-detection/blob/main/frontend/components/api.py): `frontend/components/api.py`
- [FastAPI routes](https://github.com/azeez11223/click-fraud-detection/blob/main/backend/main.py): `backend/main.py`
- [JWT authentication](https://github.com/azeez11223/click-fraud-detection/blob/main/backend/auth.py): `backend/auth.py`

### Detection

- [Fraud model](https://github.com/azeez11223/click-fraud-detection/blob/main/backend/model.py): `backend/model.py`
- [Feature engineering](https://github.com/azeez11223/click-fraud-detection/blob/main/backend/preprocess.py): `backend/preprocess.py`

### Persistence

- [SQLite data](https://github.com/azeez11223/click-fraud-detection/blob/main/backend/database.py): `backend/database.py`

### Other components

- **Dashboard user**

## Connections

- Dashboard user → Streamlit app: uses (evidence: `README.md`)
- Streamlit app → Signup: routes to (evidence: `frontend/app.py`)
- Streamlit app → Login: routes to (evidence: `frontend/app.py`)
- Streamlit app → Dashboard analytics: routes to (evidence: `frontend/app.py`)
- Streamlit app → Realtime monitor: routes to (evidence: `frontend/app.py`)
- Streamlit app → Campaign pages: routes to (evidence: `frontend/app.py`)
- Streamlit app → Campaign detail: routes to (evidence: `frontend/app.py`)
- Streamlit app → Platform integrations: routes to (evidence: `frontend/app.py`)
- Streamlit app → IP management: routes to (evidence: `frontend/app.py`)
- Streamlit app → Click prediction: routes to (evidence: `frontend/app.py`)
- Streamlit app → Analytics: routes to (evidence: `frontend/app.py`)
- Streamlit app → Prediction history: routes to (evidence: `frontend/app.py`)
- Streamlit app → About: routes to (evidence: `frontend/app.py`)
- Click prediction → API helpers: calls (evidence: `frontend/pages/predict.py`)
- Campaign pages → API helpers: calls (evidence: `frontend/pages/campaigns.py`)
- Campaign detail → API helpers: calls (evidence: `frontend/pages/campaign_detail.py`)
- Dashboard analytics → API helpers: calls (evidence: `frontend/pages/dashboard.py`)
- Analytics → API helpers: calls (evidence: `frontend/pages/analytics.py`)
- Prediction history → API helpers: calls (evidence: `frontend/pages/history.py`)
- IP management → API helpers: calls (evidence: `frontend/pages/ip_manager.py`)
- Platform integrations → API helpers: calls (evidence: `frontend/pages/platform_integrations.py`)
- Realtime monitor → API helpers: calls (evidence: `frontend/pages/realtime_monitor.py`)
- Signup → API helpers: calls (evidence: `frontend/pages/signup.py`)
- Login → API helpers: calls (evidence: `frontend/pages/login.py`)
- API helpers → FastAPI routes: HTTP requests (evidence: `README.md`)
- FastAPI routes → Fraud model: invokes (evidence: `backend/main.py`)
- FastAPI routes → SQLite data: reads and writes (evidence: `backend/main.py`)
- FastAPI routes → JWT authentication: uses (evidence: `backend/main.py`)
- Fraud model → Feature engineering: uses (evidence: `backend/model.py`)
- Dashboard analytics → Charts: uses (evidence: `frontend/pages/dashboard.py`)
- Analytics → Charts: uses (evidence: `frontend/pages/analytics.py`)
- Click prediction → Charts: uses (evidence: `frontend/pages/predict.py`)
- Charts → UI styles: applies theme (evidence: `frontend/components/charts.py`)
- Streamlit app → UI styles: applies styles (evidence: `frontend/app.py`)
