# commando-x/vuln-bank architecture

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

- Interactive diagram: https://gitdiagram.com/commando-x/vuln-bank
- Repository: https://github.com/commando-x/vuln-bank

## Overview

Vulnerable Bank is an intentionally insecure Flask banking application for security training. Users interact with web pages and APIs for authentication, account operations, transfers, loans, cards, bills, and transaction history; administrators have management and analytics views, and merchants can use a separate payment API. The app also offers an AI support agent and stored-XSS cleanup. The sampled sources confirm several module integrations, but many feature implementations live in unsampled portions of app.py, so those are grouped there rather than mapped as speculative internal pipelines.

Main entry points: [`app.py`](https://github.com/commando-x/vuln-bank/blob/main/app.py) (Banking routes), [`database.py`](https://github.com/commando-x/vuln-bank/blob/main/database.py) (Bank database), [`templates`](https://github.com/commando-x/vuln-bank/tree/main/templates) (Banking web UI), [`ai_agent_deepseek.py`](https://github.com/commando-x/vuln-bank/blob/main/ai_agent_deepseek.py) (AI support agent)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Banking application"]
  node_web_ui["Banking web UI"]
  node_dashboard_js["Dashboard interactions<br/>[dashboard.js]"]
  node_flask_app["Banking routes<br/>[app.py]"]
  node_auth["Authentication<br/>[auth.py]"]
  node_validation["Username validation"]
  node_graphql["Transaction analytics"]
  node_merchant_api["Merchant payments"]
  node_env_exposure["Exposed env files"]
end

subgraph group_integrations["External integrations"]
  node_ai_agent["AI support agent"]
  node_deepseek["DeepSeek API"]
end

subgraph group_runtime["Data and runtime"]
  node_database[("Bank database<br/>[database.py]")]
  node_xss_cleanup["Stored-XSS cleanup<br/>[xss_cleanup.py]"]
end

node_customer(("Bank customer"))
node_admin(("Administrator"))
node_merchant(("Merchant"))

node_customer -->|"uses"| node_web_ui
node_admin -->|"uses"| node_web_ui
node_merchant -->|"calls"| node_merchant_api
node_web_ui -.->|"loads"| node_dashboard_js
node_dashboard_js -->|"calls APIs"| node_flask_app
node_web_ui -.->|"submits requests"| node_flask_app
node_flask_app -->|"uses"| node_auth
node_flask_app -->|"validates usernames"| node_validation
node_flask_app -->|"routes analytics"| node_graphql
node_flask_app -->|"registers routes"| node_merchant_api
node_flask_app -->|"uses"| node_ai_agent
node_flask_app -->|"uses"| node_env_exposure
node_flask_app -->|"queries"| node_database
node_merchant_api -->|"queries"| node_database
node_graphql -->|"queries"| node_database
node_ai_agent -->|"queries"| node_database
node_ai_agent -->|"sends prompts"| node_deepseek
node_xss_cleanup -->|"cleans stored payloads"| node_database

click node_web_ui "https://github.com/commando-x/vuln-bank/tree/main/templates"
click node_dashboard_js "https://github.com/commando-x/vuln-bank/blob/main/static/dashboard.js"
click node_flask_app "https://github.com/commando-x/vuln-bank/blob/main/app.py"
click node_auth "https://github.com/commando-x/vuln-bank/blob/main/auth.py"
click node_validation "https://github.com/commando-x/vuln-bank/blob/main/username_validation.py"
click node_graphql "https://github.com/commando-x/vuln-bank/blob/main/transaction_graphql.py"
click node_merchant_api "https://github.com/commando-x/vuln-bank/blob/main/merchant_payments.py"
click node_ai_agent "https://github.com/commando-x/vuln-bank/blob/main/ai_agent_deepseek.py"
click node_env_exposure "https://github.com/commando-x/vuln-bank/blob/main/exposed_env_files.py"
click node_database "https://github.com/commando-x/vuln-bank/blob/main/database.py"
click node_xss_cleanup "https://github.com/commando-x/vuln-bank/blob/main/xss_cleanup.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_web_ui,node_dashboard_js,node_flask_app,node_auth,node_validation,node_graphql,node_merchant_api,node_env_exposure toneBlue
class node_ai_agent,node_deepseek toneAmber
class node_database,node_xss_cleanup toneMint
class node_customer,node_admin,node_merchant toneIndigo
```

## Components

### Banking application

- [Banking web UI](https://github.com/commando-x/vuln-bank/tree/main/templates): `templates`
- [Dashboard interactions](https://github.com/commando-x/vuln-bank/blob/main/static/dashboard.js): `static/dashboard.js`
- [Banking routes](https://github.com/commando-x/vuln-bank/blob/main/app.py): `app.py`
- [Authentication](https://github.com/commando-x/vuln-bank/blob/main/auth.py): `auth.py`
- [Username validation](https://github.com/commando-x/vuln-bank/blob/main/username_validation.py): `username_validation.py`
- [Transaction analytics](https://github.com/commando-x/vuln-bank/blob/main/transaction_graphql.py): `transaction_graphql.py`
- [Merchant payments](https://github.com/commando-x/vuln-bank/blob/main/merchant_payments.py): `merchant_payments.py`
- [Exposed env files](https://github.com/commando-x/vuln-bank/blob/main/exposed_env_files.py): `exposed_env_files.py`

### External integrations

- [AI support agent](https://github.com/commando-x/vuln-bank/blob/main/ai_agent_deepseek.py): `ai_agent_deepseek.py`
- **DeepSeek API**

### Data and runtime

- [Bank database](https://github.com/commando-x/vuln-bank/blob/main/database.py): `database.py`
- [Stored-XSS cleanup](https://github.com/commando-x/vuln-bank/blob/main/xss_cleanup.py): `xss_cleanup.py`

### Other components

- **Bank customer**
- **Administrator**
- **Merchant**

## Connections

- Bank customer → Banking web UI: uses (evidence: `README.md`)
- Administrator → Banking web UI: uses (evidence: `README.md`)
- Merchant → Merchant payments: calls (evidence: `README.md`)
- Banking web UI → Dashboard interactions: loads
- Dashboard interactions → Banking routes: calls APIs (evidence: `static/dashboard.js`)
- Banking web UI → Banking routes: submits requests
- Banking routes → Authentication: uses (evidence: `app.py`)
- Banking routes → Username validation: validates usernames (evidence: `app.py`)
- Banking routes → Transaction analytics: routes analytics (evidence: `app.py`)
- Banking routes → Merchant payments: registers routes (evidence: `app.py`)
- Banking routes → AI support agent: uses (evidence: `app.py`)
- Banking routes → Exposed env files: uses (evidence: `app.py`)
- Banking routes → Bank database: queries (evidence: `app.py`)
- Merchant payments → Bank database: queries (evidence: `merchant_payments.py`)
- Transaction analytics → Bank database: queries (evidence: `transaction_graphql.py`)
- AI support agent → Bank database: queries (evidence: `ai_agent_deepseek.py`)
- AI support agent → DeepSeek API: sends prompts (evidence: `ai_agent_deepseek.py`)
- Stored-XSS cleanup → Bank database: cleans stored payloads (evidence: `xss_cleanup.py`)
