# sheikhrehanseo/valiguard-project-main architecture

> Architecture diagram of the GitHub repository sheikhrehanseo/valiguard-project-main, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sheikhrehanseo/valiguard-project-main
- Repository: https://github.com/sheikhrehanseo/valiguard-project-main

## Overview

ValiGuard AI is a QIE validator security dashboard. Its main workflow connects a wallet in the Next.js UI, authenticates through Flask, and presents monitoring and cross-chain risk information. Separately, the ingestion worker polls QIE, normalizes and scores transactions, and persists monitoring data for the API. Validator setup and node management are additional product capabilities. The README documents analytics and live feeds; sampled source gives only partial visibility into their routes and frontend data flow, so those links are conservative.

Main entry points: [`backend/app.py`](https://github.com/sheikhrehanseo/valiguard-project-main/blob/main/backend/app.py) (Flask API), [`backend/ingestion/worker.py`](https://github.com/sheikhrehanseo/valiguard-project-main/blob/main/backend/ingestion/worker.py) (Transaction ingestion), [`backend/auth/routes.py`](https://github.com/sheikhrehanseo/valiguard-project-main/blob/main/backend/auth/routes.py) (Wallet auth routes), [`backend/ml/anomaly_model.py`](https://github.com/sheikhrehanseo/valiguard-project-main/blob/main/backend/ml/anomaly_model.py) (Anomaly scoring)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Dashboard"]
  node_wallet["Wallet connect<br/>[WalletConnect.js]"]
  node_dashboard["Monitoring dashboard<br/>[page.js]"]
  node_api_client["API client<br/>[api.js]"]
end

subgraph group_api["API and auth"]
  node_flask_api["Flask API<br/>[app.py]"]
  node_auth_routes["Wallet auth routes<br/>[routes.py]"]
  node_nonce_store[("Nonce store<br/>[nonce_store.py]")]
  node_jwt_auth["JWT auth<br/>[jwt_auth.py]"]
end

subgraph group_monitoring["Monitoring pipeline"]
  node_ingestion["Transaction ingestion<br/>[worker.py]"]
  node_qie_node["QIE node manager"]
  node_anomaly["Anomaly scoring<br/>[anomaly_model.py]"]
  node_features["Feature extraction"]
  node_severity["Severity classification<br/>[severity.py]"]
end

subgraph group_data["Persistence"]
  node_db_manager["Database operations<br/>[db.py]"]
  node_models[("Monitoring data models<br/>[models.py]")]
end

subgraph group_validator["Validator operations"]
  node_setup_manager["Node setup"]
  node_validator_manager["Validator management"]
  node_wallet_manager["Validator wallet"]
end

node_operator(("Dashboard user"))
node_qie_network{{"QIE network"}}
node_validator(("QIE validator operator"))

node_operator -->|"uses"| node_dashboard
node_dashboard -->|"renders"| node_wallet
node_dashboard -->|"calls"| node_api_client
node_wallet -->|"authenticates via"| node_api_client
node_api_client -->|"requests nonce and verifies"| node_auth_routes
node_auth_routes -->|"issues and consumes"| node_nonce_store
node_auth_routes -->|"issues token"| node_jwt_auth
node_flask_api -->|"registers"| node_auth_routes
node_flask_api -->|"queries node"| node_qie_node
node_flask_api -->|"scores requests"| node_anomaly
node_flask_api -->|"starts monitoring"| node_ingestion
node_ingestion -->|"polls"| node_qie_node
node_ingestion -->|"scores transactions"| node_anomaly
node_anomaly -->|"extracts features"| node_features
node_anomaly -->|"classifies risk"| node_severity
node_ingestion -->|"persists transactions"| node_db_manager
node_db_manager -->|"manages records"| node_models
node_qie_node -->|"queries and broadcasts"| node_qie_network
node_validator -->|"sets up node"| node_setup_manager
node_validator -->|"registers validator"| node_validator_manager
node_validator_manager -.->|"uses wallet operations"| node_wallet_manager

click node_wallet "https://github.com/sheikhrehanseo/valiguard-project-main/blob/main/frontend/src/components/WalletConnect.js"
click node_dashboard "https://github.com/sheikhrehanseo/valiguard-project-main/blob/main/frontend/src/app/page.js"
click node_api_client "https://github.com/sheikhrehanseo/valiguard-project-main/blob/main/frontend/src/lib/api.js"
click node_flask_api "https://github.com/sheikhrehanseo/valiguard-project-main/blob/main/backend/app.py"
click node_auth_routes "https://github.com/sheikhrehanseo/valiguard-project-main/blob/main/backend/auth/routes.py"
click node_nonce_store "https://github.com/sheikhrehanseo/valiguard-project-main/blob/main/backend/auth/nonce_store.py"
click node_jwt_auth "https://github.com/sheikhrehanseo/valiguard-project-main/blob/main/backend/auth/jwt_auth.py"
click node_ingestion "https://github.com/sheikhrehanseo/valiguard-project-main/blob/main/backend/ingestion/worker.py"
click node_qie_node "https://github.com/sheikhrehanseo/valiguard-project-main/blob/main/backend/qie_node_manager.py"
click node_anomaly "https://github.com/sheikhrehanseo/valiguard-project-main/blob/main/backend/ml/anomaly_model.py"
click node_features "https://github.com/sheikhrehanseo/valiguard-project-main/blob/main/backend/ml/feature_extraction.py"
click node_severity "https://github.com/sheikhrehanseo/valiguard-project-main/blob/main/backend/core/severity.py"
click node_db_manager "https://github.com/sheikhrehanseo/valiguard-project-main/blob/main/backend/database/db.py"
click node_models "https://github.com/sheikhrehanseo/valiguard-project-main/blob/main/backend/database/models.py"
click node_setup_manager "https://github.com/sheikhrehanseo/valiguard-project-main/blob/main/backend/qie_setup_manager.py"
click node_validator_manager "https://github.com/sheikhrehanseo/valiguard-project-main/blob/main/backend/qie_validator_manager.py"
click node_wallet_manager "https://github.com/sheikhrehanseo/valiguard-project-main/blob/main/backend/qie_wallet_manager.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_wallet,node_dashboard,node_api_client,node_operator toneBlue
class node_flask_api,node_auth_routes,node_nonce_store,node_jwt_auth toneAmber
class node_ingestion,node_qie_node,node_anomaly,node_features,node_severity toneMint
class node_db_manager,node_models toneRose
class node_setup_manager,node_validator_manager,node_wallet_manager,node_qie_network,node_validator toneIndigo
```

## Components

### Dashboard

- [Wallet connect](https://github.com/sheikhrehanseo/valiguard-project-main/blob/main/frontend/src/components/WalletConnect.js): `frontend/src/components/WalletConnect.js`
- [Monitoring dashboard](https://github.com/sheikhrehanseo/valiguard-project-main/blob/main/frontend/src/app/page.js): `frontend/src/app/page.js`
- [API client](https://github.com/sheikhrehanseo/valiguard-project-main/blob/main/frontend/src/lib/api.js): `frontend/src/lib/api.js`

### API and auth

- [Flask API](https://github.com/sheikhrehanseo/valiguard-project-main/blob/main/backend/app.py): `backend/app.py`
- [Wallet auth routes](https://github.com/sheikhrehanseo/valiguard-project-main/blob/main/backend/auth/routes.py): `backend/auth/routes.py`
- [Nonce store](https://github.com/sheikhrehanseo/valiguard-project-main/blob/main/backend/auth/nonce_store.py): `backend/auth/nonce_store.py`
- [JWT auth](https://github.com/sheikhrehanseo/valiguard-project-main/blob/main/backend/auth/jwt_auth.py): `backend/auth/jwt_auth.py`

### Monitoring pipeline

- [Transaction ingestion](https://github.com/sheikhrehanseo/valiguard-project-main/blob/main/backend/ingestion/worker.py): `backend/ingestion/worker.py`
- [QIE node manager](https://github.com/sheikhrehanseo/valiguard-project-main/blob/main/backend/qie_node_manager.py): `backend/qie_node_manager.py`
- [Anomaly scoring](https://github.com/sheikhrehanseo/valiguard-project-main/blob/main/backend/ml/anomaly_model.py): `backend/ml/anomaly_model.py`
- [Feature extraction](https://github.com/sheikhrehanseo/valiguard-project-main/blob/main/backend/ml/feature_extraction.py): `backend/ml/feature_extraction.py`
- [Severity classification](https://github.com/sheikhrehanseo/valiguard-project-main/blob/main/backend/core/severity.py): `backend/core/severity.py`

### Persistence

- [Database operations](https://github.com/sheikhrehanseo/valiguard-project-main/blob/main/backend/database/db.py): `backend/database/db.py`
- [Monitoring data models](https://github.com/sheikhrehanseo/valiguard-project-main/blob/main/backend/database/models.py): `backend/database/models.py`

### Validator operations

- [Node setup](https://github.com/sheikhrehanseo/valiguard-project-main/blob/main/backend/qie_setup_manager.py): `backend/qie_setup_manager.py`
- [Validator management](https://github.com/sheikhrehanseo/valiguard-project-main/blob/main/backend/qie_validator_manager.py): `backend/qie_validator_manager.py`
- [Validator wallet](https://github.com/sheikhrehanseo/valiguard-project-main/blob/main/backend/qie_wallet_manager.py): `backend/qie_wallet_manager.py`

### Other components

- **Dashboard user**
- **QIE network**
- **QIE validator operator**

## Connections

- Dashboard user → Monitoring dashboard: uses
- Monitoring dashboard → Wallet connect: renders (evidence: `frontend/src/app/page.js`)
- Monitoring dashboard → API client: calls (evidence: `frontend/src/app/page.js`)
- Wallet connect → API client: authenticates via (evidence: `frontend/src/components/WalletConnect.js`)
- API client → Wallet auth routes: requests nonce and verifies (evidence: `frontend/src/lib/api.js`)
- Wallet auth routes → Nonce store: issues and consumes (evidence: `backend/auth/routes.py`)
- Wallet auth routes → JWT auth: issues token (evidence: `backend/auth/routes.py`)
- Flask API → Wallet auth routes: registers (evidence: `backend/app.py`)
- Flask API → QIE node manager: queries node (evidence: `backend/app.py`)
- Flask API → Anomaly scoring: scores requests (evidence: `backend/app.py`)
- Flask API → Transaction ingestion: starts monitoring (evidence: `backend/app.py`)
- Transaction ingestion → QIE node manager: polls (evidence: `backend/ingestion/worker.py`)
- Transaction ingestion → Anomaly scoring: scores transactions (evidence: `backend/ingestion/worker.py`)
- Anomaly scoring → Feature extraction: extracts features (evidence: `backend/ml/anomaly_model.py`)
- Anomaly scoring → Severity classification: classifies risk (evidence: `backend/ml/anomaly_model.py`)
- Transaction ingestion → Database operations: persists transactions (evidence: `backend/ingestion/worker.py`)
- Database operations → Monitoring data models: manages records (evidence: `backend/database/db.py`)
- QIE node manager → QIE network: queries and broadcasts (evidence: `backend/qie_node_manager.py`)
- QIE validator operator → Node setup: sets up node
- QIE validator operator → Validator management: registers validator
- Validator management → Validator wallet: uses wallet operations
