# paras-2407/vulnai-vulnerability-detection-in-ai-models architecture

> Architecture diagram of the GitHub repository paras-2407/vulnai-vulnerability-detection-in-ai-models, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/paras-2407/vulnai-vulnerability-detection-in-ai-models
- Repository: https://github.com/paras-2407/vulnai-vulnerability-detection-in-ai-models

## Overview

VulnAI is a web application for authenticated ML-model and LLM security audits. Users sign in, submit a model and (for ML scans) test images, run the selected security analysis, then review reports and scan history. The graph distinguishes the ML adversarial-attack pipeline from LLM checks and report generation. Edges are limited to relationships shown in excerpts or README; unsampled frontend/API wiring and some backend scan steps are omitted.

Main entry points: [`backend/app/routers/upload.py`](https://github.com/paras-2407/vulnai-vulnerability-detection-in-ai-models/blob/main/backend/app/routers/upload.py) (Upload and scan routes), [`backend/app/services/auth.py`](https://github.com/paras-2407/vulnai-vulnerability-detection-in-ai-models/blob/main/backend/app/services/auth.py) (Token service), [`frontend/app/page.jsx`](https://github.com/paras-2407/vulnai-vulnerability-detection-in-ai-models/blob/main/frontend/app/page.jsx) (Scan dashboard), [`backend/app/main.py`](https://github.com/paras-2407/vulnai-vulnerability-detection-in-ai-models/blob/main/backend/app/main.py) (FastAPI app)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web dashboard"]
  node_dashboard["Scan dashboard<br/>[page.jsx]"]
  node_oauth_ui["OAuth provider<br/>[providers.jsx]"]
  node_api_client["API client<br/>[api-client.js]"]
end

subgraph group_api["API and identity"]
  node_api_app["FastAPI app<br/>[main.py]"]
  node_auth_route["Google auth route<br/>[auth_router.py]"]
  node_auth_service["Token service<br/>[auth.py]"]
  node_config["Auth configuration<br/>[config.py]"]
  node_upload_route["Upload and scan routes<br/>[upload.py]"]
  node_schemas["Scan schemas<br/>[schemas.py]"]
end

subgraph group_ml["ML scanning"]
  node_model_store[("Model and image files<br/>[model_service.py]")]
  node_attack_engine["Adversarial attacks<br/>[attack_service.py]"]
end

subgraph group_llm["LLM scanning"]
  node_llm_engine["LLM security tests"]
end

subgraph group_reports["Results and reporting"]
  node_reporter["Report generation"]
  node_scan_history[("Scan history<br/>[upload.py]")]
end

node_user(("Auditor"))
node_gemini["Gemini API"]
node_google["Google OAuth"]

node_user -.->|"uses"| node_dashboard
node_dashboard -.->|"authenticates with"| node_oauth_ui
node_dashboard -.->|"requests scans"| node_api_client
node_api_client -.->|"calls API"| node_api_app
node_api_app -->|"registers"| node_auth_route
node_api_app -->|"registers"| node_upload_route
node_auth_route -->|"verifies and signs"| node_auth_service
node_auth_service -->|"reads settings"| node_config
node_auth_service -->|"verifies token"| node_google
node_upload_route -->|"checks identity"| node_auth_service
node_upload_route -->|"saves and lists"| node_model_store
node_upload_route -->|"runs ML scan"| node_attack_engine
node_attack_engine -->|"loads model"| node_model_store
node_attack_engine -->|"creates results"| node_schemas
node_upload_route -->|"runs LLM scan"| node_llm_engine
node_upload_route -->|"validates responses"| node_schemas
node_upload_route -.->|"requests report"| node_reporter
node_reporter -->|"generates report"| node_gemini
node_upload_route -->|"stores and retrieves"| node_scan_history
node_user -->|"signs in"| node_google

click node_dashboard "https://github.com/paras-2407/vulnai-vulnerability-detection-in-ai-models/blob/main/frontend/app/page.jsx"
click node_oauth_ui "https://github.com/paras-2407/vulnai-vulnerability-detection-in-ai-models/blob/main/frontend/app/providers.jsx"
click node_api_client "https://github.com/paras-2407/vulnai-vulnerability-detection-in-ai-models/blob/main/frontend/lib/api-client.js"
click node_api_app "https://github.com/paras-2407/vulnai-vulnerability-detection-in-ai-models/blob/main/backend/app/main.py"
click node_auth_route "https://github.com/paras-2407/vulnai-vulnerability-detection-in-ai-models/blob/main/backend/app/routers/auth_router.py"
click node_auth_service "https://github.com/paras-2407/vulnai-vulnerability-detection-in-ai-models/blob/main/backend/app/services/auth.py"
click node_config "https://github.com/paras-2407/vulnai-vulnerability-detection-in-ai-models/blob/main/backend/app/config.py"
click node_upload_route "https://github.com/paras-2407/vulnai-vulnerability-detection-in-ai-models/blob/main/backend/app/routers/upload.py"
click node_schemas "https://github.com/paras-2407/vulnai-vulnerability-detection-in-ai-models/blob/main/backend/app/models/schemas.py"
click node_model_store "https://github.com/paras-2407/vulnai-vulnerability-detection-in-ai-models/blob/main/backend/app/services/model_service.py"
click node_attack_engine "https://github.com/paras-2407/vulnai-vulnerability-detection-in-ai-models/blob/main/backend/app/services/attack_service.py"
click node_llm_engine "https://github.com/paras-2407/vulnai-vulnerability-detection-in-ai-models/blob/main/backend/app/services/llm_security_service.py"
click node_reporter "https://github.com/paras-2407/vulnai-vulnerability-detection-in-ai-models/blob/main/backend/app/services/reporter_service.py"
click node_scan_history "https://github.com/paras-2407/vulnai-vulnerability-detection-in-ai-models/blob/main/backend/app/routers/upload.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_dashboard,node_oauth_ui,node_api_client toneBlue
class node_api_app,node_auth_route,node_auth_service,node_config,node_upload_route,node_schemas toneAmber
class node_model_store,node_attack_engine,node_gemini toneMint
class node_llm_engine toneRose
class node_reporter,node_scan_history,node_user,node_google toneIndigo
```

## Components

### Web dashboard

- [Scan dashboard](https://github.com/paras-2407/vulnai-vulnerability-detection-in-ai-models/blob/main/frontend/app/page.jsx): `frontend/app/page.jsx`
- [OAuth provider](https://github.com/paras-2407/vulnai-vulnerability-detection-in-ai-models/blob/main/frontend/app/providers.jsx): `frontend/app/providers.jsx`
- [API client](https://github.com/paras-2407/vulnai-vulnerability-detection-in-ai-models/blob/main/frontend/lib/api-client.js): `frontend/lib/api-client.js`

### API and identity

- [FastAPI app](https://github.com/paras-2407/vulnai-vulnerability-detection-in-ai-models/blob/main/backend/app/main.py): `backend/app/main.py`
- [Google auth route](https://github.com/paras-2407/vulnai-vulnerability-detection-in-ai-models/blob/main/backend/app/routers/auth_router.py): `backend/app/routers/auth_router.py`
- [Token service](https://github.com/paras-2407/vulnai-vulnerability-detection-in-ai-models/blob/main/backend/app/services/auth.py): `backend/app/services/auth.py`
- [Auth configuration](https://github.com/paras-2407/vulnai-vulnerability-detection-in-ai-models/blob/main/backend/app/config.py): `backend/app/config.py`
- [Upload and scan routes](https://github.com/paras-2407/vulnai-vulnerability-detection-in-ai-models/blob/main/backend/app/routers/upload.py): `backend/app/routers/upload.py`
- [Scan schemas](https://github.com/paras-2407/vulnai-vulnerability-detection-in-ai-models/blob/main/backend/app/models/schemas.py): `backend/app/models/schemas.py`

### ML scanning

- [Model and image files](https://github.com/paras-2407/vulnai-vulnerability-detection-in-ai-models/blob/main/backend/app/services/model_service.py): `backend/app/services/model_service.py`
- [Adversarial attacks](https://github.com/paras-2407/vulnai-vulnerability-detection-in-ai-models/blob/main/backend/app/services/attack_service.py): `backend/app/services/attack_service.py`

### LLM scanning

- [LLM security tests](https://github.com/paras-2407/vulnai-vulnerability-detection-in-ai-models/blob/main/backend/app/services/llm_security_service.py): `backend/app/services/llm_security_service.py`

### Results and reporting

- [Report generation](https://github.com/paras-2407/vulnai-vulnerability-detection-in-ai-models/blob/main/backend/app/services/reporter_service.py): `backend/app/services/reporter_service.py`
- [Scan history](https://github.com/paras-2407/vulnai-vulnerability-detection-in-ai-models/blob/main/backend/app/routers/upload.py): `backend/app/routers/upload.py`

### Other components

- **Auditor**
- **Gemini API**
- **Google OAuth**

## Connections

- Auditor → Scan dashboard: uses
- Scan dashboard → OAuth provider: authenticates with (evidence: `frontend/app/providers.jsx`)
- Scan dashboard → API client: requests scans
- API client → FastAPI app: calls API
- FastAPI app → Google auth route: registers (evidence: `backend/app/main.py`)
- FastAPI app → Upload and scan routes: registers (evidence: `backend/app/main.py`)
- Google auth route → Token service: verifies and signs (evidence: `backend/app/routers/auth_router.py`)
- Token service → Auth configuration: reads settings (evidence: `backend/app/services/auth.py`)
- Token service → Google OAuth: verifies token (evidence: `backend/app/services/auth.py`)
- Upload and scan routes → Token service: checks identity (evidence: `backend/app/routers/upload.py`)
- Upload and scan routes → Model and image files: saves and lists (evidence: `backend/app/routers/upload.py`)
- Upload and scan routes → Adversarial attacks: runs ML scan (evidence: `backend/app/routers/upload.py`)
- Adversarial attacks → Model and image files: loads model (evidence: `backend/app/services/attack_service.py`)
- Adversarial attacks → Scan schemas: creates results (evidence: `backend/app/services/attack_service.py`)
- Upload and scan routes → LLM security tests: runs LLM scan (evidence: `backend/app/routers/upload.py`)
- Upload and scan routes → Scan schemas: validates responses (evidence: `backend/app/routers/upload.py`)
- Upload and scan routes → Report generation: requests report (evidence: `backend/app/routers/upload.py`)
- Report generation → Gemini API: generates report (evidence: `backend/app/services/reporter_service.py`)
- Upload and scan routes → Scan history: stores and retrieves (evidence: `backend/app/routers/upload.py`)
- Auditor → Google OAuth: signs in
