# sunnyshin8/bridgeguard-ai architecture

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

- Interactive diagram: https://gitdiagram.com/sunnyshin8/bridgeguard-ai
- Repository: https://github.com/sunnyshin8/bridgeguard-ai

## Overview

BridgeGuard AI combines a validator-operations toolkit with a blockchain security dashboard. In the documented monitoring workflow, users view dashboard data fetched through the API; backend endpoints report QIE node/validator state and provide bridge history and anomaly results. Separate CLI managers install and configure QIE nodes, manage validator registration and wallets, while SQLAlchemy models represent bridge, transaction, validator, alert, and anomaly data. The tree and excerpts do not establish how the Flask API persists data, nor do they expose the new dashboard's data-fetching code, so those connections are omitted.

Main entry points: [`backend/app.py`](https://github.com/sunnyshin8/bridgeguard-ai/blob/main/backend/app.py) (Flask API), [`backend/qie_setup_manager.py`](https://github.com/sunnyshin8/bridgeguard-ai/blob/main/backend/qie_setup_manager.py) (Node setup), [`frontend_legacy/dashboard.js`](https://github.com/sunnyshin8/bridgeguard-ai/blob/main/frontend_legacy/dashboard.js) (Legacy dashboard), [`frontend_legacy/api-client.js`](https://github.com/sunnyshin8/bridgeguard-ai/blob/main/frontend_legacy/api-client.js) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dash["Dashboard"]
  node_web["Next.js dashboard<br/>[page.js]"]
  node_legacy["Legacy dashboard<br/>[dashboard.js]"]
  node_client["API client<br/>[api-client.js]"]
  node_walletui["Wallet connect<br/>[WalletConnect.js]"]
  node_contact["Contact page<br/>[page.js]"]
end

subgraph group_monitor["Monitoring API"]
  node_api["Flask API<br/>[app.py]"]
  node_node["QIE node manager"]
  node_anomaly["Anomaly analysis<br/>[app.py]"]
  node_history["Bridge history<br/>[app.py]"]
end

subgraph group_validator["Validator Operations"]
  node_setup["Node setup"]
  node_validator_mgr["Validator registration"]
  node_wallet_mgr["Wallet operations"]
end

subgraph group_data["Database"]
  node_dbmodels["Domain models<br/>[models.py]"]
  node_db[("SQL database<br/>[db.py]")]
end

node_user(("Dashboard user"))
node_chain{{"QIE RPC/node"}}
node_qied{{"QIE CLI binary"}}
node_operator(("Node operator"))

node_user -->|"views"| node_web
node_user -.->|"uses"| node_legacy
node_user -->|"connects wallet"| node_walletui
node_user -->|"opens"| node_contact
node_legacy -->|"requests data"| node_client
node_client -->|"HTTP requests"| node_api
node_api -->|"queries node"| node_node
node_node -->|"RPC calls"| node_chain
node_api -->|"scores transactions"| node_anomaly
node_api -->|"returns history"| node_history
node_operator -->|"runs setup"| node_setup
node_setup -->|"checks status"| node_chain
node_setup -->|"installs/configures"| node_qied
node_operator -->|"registers validator"| node_validator_mgr
node_validator_mgr -->|"runs commands"| node_qied
node_operator -->|"manages wallet"| node_wallet_mgr
node_wallet_mgr -->|"runs commands"| node_qied
node_dbmodels -->|"defines persisted entities"| node_db

click node_web "https://github.com/sunnyshin8/bridgeguard-ai/blob/main/frontend/src/app/page.js"
click node_legacy "https://github.com/sunnyshin8/bridgeguard-ai/blob/main/frontend_legacy/dashboard.js"
click node_client "https://github.com/sunnyshin8/bridgeguard-ai/blob/main/frontend_legacy/api-client.js"
click node_walletui "https://github.com/sunnyshin8/bridgeguard-ai/blob/main/frontend/src/components/WalletConnect.js"
click node_api "https://github.com/sunnyshin8/bridgeguard-ai/blob/main/backend/app.py"
click node_node "https://github.com/sunnyshin8/bridgeguard-ai/blob/main/backend/qie_node_manager.py"
click node_anomaly "https://github.com/sunnyshin8/bridgeguard-ai/blob/main/backend/app.py"
click node_history "https://github.com/sunnyshin8/bridgeguard-ai/blob/main/backend/app.py"
click node_dbmodels "https://github.com/sunnyshin8/bridgeguard-ai/blob/main/backend/database/models.py"
click node_db "https://github.com/sunnyshin8/bridgeguard-ai/blob/main/backend/database/db.py"
click node_setup "https://github.com/sunnyshin8/bridgeguard-ai/blob/main/backend/qie_setup_manager.py"
click node_validator_mgr "https://github.com/sunnyshin8/bridgeguard-ai/blob/main/backend/qie_validator_manager.py"
click node_wallet_mgr "https://github.com/sunnyshin8/bridgeguard-ai/blob/main/backend/qie_wallet_manager.py"
click node_contact "https://github.com/sunnyshin8/bridgeguard-ai/blob/main/frontend/src/app/contact/page.js"

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_web,node_legacy,node_client,node_walletui,node_contact,node_user toneBlue
class node_api,node_node,node_anomaly,node_history toneAmber
class node_setup,node_validator_mgr,node_wallet_mgr toneMint
class node_dbmodels,node_db toneRose
class node_chain,node_qied,node_operator toneIndigo
```

## Components

### Dashboard

- [Next.js dashboard](https://github.com/sunnyshin8/bridgeguard-ai/blob/main/frontend/src/app/page.js): `frontend/src/app/page.js`
- [Legacy dashboard](https://github.com/sunnyshin8/bridgeguard-ai/blob/main/frontend_legacy/dashboard.js): `frontend_legacy/dashboard.js`
- [API client](https://github.com/sunnyshin8/bridgeguard-ai/blob/main/frontend_legacy/api-client.js): `frontend_legacy/api-client.js`
- [Wallet connect](https://github.com/sunnyshin8/bridgeguard-ai/blob/main/frontend/src/components/WalletConnect.js): `frontend/src/components/WalletConnect.js`
- [Contact page](https://github.com/sunnyshin8/bridgeguard-ai/blob/main/frontend/src/app/contact/page.js): `frontend/src/app/contact/page.js`

### Monitoring API

- [Flask API](https://github.com/sunnyshin8/bridgeguard-ai/blob/main/backend/app.py): `backend/app.py`
- [QIE node manager](https://github.com/sunnyshin8/bridgeguard-ai/blob/main/backend/qie_node_manager.py): `backend/qie_node_manager.py`
- [Anomaly analysis](https://github.com/sunnyshin8/bridgeguard-ai/blob/main/backend/app.py): `backend/app.py`
- [Bridge history](https://github.com/sunnyshin8/bridgeguard-ai/blob/main/backend/app.py): `backend/app.py`

### Validator Operations

- [Node setup](https://github.com/sunnyshin8/bridgeguard-ai/blob/main/backend/qie_setup_manager.py): `backend/qie_setup_manager.py`
- [Validator registration](https://github.com/sunnyshin8/bridgeguard-ai/blob/main/backend/qie_validator_manager.py): `backend/qie_validator_manager.py`
- [Wallet operations](https://github.com/sunnyshin8/bridgeguard-ai/blob/main/backend/qie_wallet_manager.py): `backend/qie_wallet_manager.py`

### Database

- [Domain models](https://github.com/sunnyshin8/bridgeguard-ai/blob/main/backend/database/models.py): `backend/database/models.py`
- [SQL database](https://github.com/sunnyshin8/bridgeguard-ai/blob/main/backend/database/db.py): `backend/database/db.py`

### Other components

- **Dashboard user**
- **QIE RPC/node**
- **QIE CLI binary**
- **Node operator**

## Connections

- Dashboard user → Next.js dashboard: views
- Dashboard user → Legacy dashboard: uses
- Dashboard user → Wallet connect: connects wallet
- Dashboard user → Contact page: opens
- Legacy dashboard → API client: requests data
- API client → Flask API: HTTP requests
- Flask API → QIE node manager: queries node
- QIE node manager → QIE RPC/node: RPC calls
- Flask API → Anomaly analysis: scores transactions
- Flask API → Bridge history: returns history
- Node operator → Node setup: runs setup
- Node setup → QIE RPC/node: checks status
- Node setup → QIE CLI binary: installs/configures
- Node operator → Validator registration: registers validator
- Validator registration → QIE CLI binary: runs commands
- Node operator → Wallet operations: manages wallet
- Wallet operations → QIE CLI binary: runs commands
- Domain models → SQL database: defines persisted entities
