# hungrybro/viper architecture

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

- Interactive diagram: https://gitdiagram.com/hungrybro/viper
- Repository: https://github.com/hungrybro/viper

## Overview

VIPER is a visual image-processing workflow platform: operators assemble node graphs, configure inputs and algorithm stages, then run workflows and inspect results and logs. The React client coordinates execution through stage runners and calls a FastAPI backend, whose routes dispatch processing and persist platform data. Major documented branches include YOLO training/detection and Grad-CAM, evaluation, reusable templates, authentication, and administration. Some router and runner internals were not sampled, so those components are represented at supported directory paths; uncertain runtime links are omitted.

Main entry points: [`server/main.py`](https://github.com/hungrybro/viper/blob/main/server/main.py) (API Router), [`my-react-flow-app/src/App.tsx`](https://github.com/hungrybro/viper/blob/main/my-react-flow-app/src/App.tsx) (Workflow Shell), [`my-react-flow-app/src/FlowCanvas.tsx`](https://github.com/hungrybro/viper/blob/main/my-react-flow-app/src/FlowCanvas.tsx) (Workflow Canvas), [`server/routers/templates.py`](https://github.com/hungrybro/viper/blob/main/server/routers/templates.py) (Template Routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Workflow Client"]
  node_app["Workflow Shell<br/>[App.tsx]"]
  node_canvas["Workflow Canvas<br/>[FlowCanvas.tsx]"]
  node_node_library["Node Library"]
  node_runners["Stage Runners"]
  node_templates_ui["Template Library"]
  node_template_client["Template Client<br/>[templateApi.ts]"]
end

subgraph group_processing["Image Processing"]
  node_feature_match["Feature &amp; Matching"]
  node_alignment["Alignment"]
  node_class_seg["Classify &amp; Segment"]
  node_enhance_restore["Enhance &amp; Restore"]
  node_quality_eval["Quality &amp; Evaluation"]
  node_yolo["YOLO &amp; Grad-CAM<br/>[yolo_adapter.py]"]
end

subgraph group_platform["Platform Services"]
  node_api["API Router<br/>[main.py]"]
  node_detection_routes["Detection Routes<br/>[detection.py]"]
  node_template_routes["Template Routes<br/>[templates.py]"]
  node_auth["Authentication<br/>[auth.py]"]
  node_admin["Administration<br/>[admin.py]"]
end

subgraph group_data["Persistence"]
  node_database[("Relational Store<br/>[database.py]")]
  node_models["Data Models<br/>[models.py]"]
end

node_operator(("Operator"))

node_operator -->|"builds workflows"| node_app
node_app -->|"renders"| node_canvas
node_app -->|"offers nodes"| node_node_library
node_canvas -->|"renders nodes"| node_node_library
node_canvas -->|"dispatches stages"| node_runners
node_runners -.->|"requests processing"| node_api
node_operator -->|"browses templates"| node_templates_ui
node_templates_ui -->|"loads templates"| node_template_client
node_template_client -.->|"calls API"| node_template_routes
node_api -->|"registers routes"| node_detection_routes
node_detection_routes -->|"dispatches detection"| node_yolo
node_api -->|"registers processing routes"| node_feature_match
node_api -.->|"registers processing routes"| node_alignment
node_api -.->|"registers processing routes"| node_class_seg
node_api -.->|"registers processing routes"| node_enhance_restore
node_api -.->|"registers processing routes"| node_quality_eval
node_api -->|"registers routes"| node_template_routes
node_api -->|"registers routes"| node_auth
node_api -->|"registers routes"| node_admin
node_template_routes -->|"reads and writes"| node_models
node_auth -->|"authenticates users"| node_models
node_models -->|"uses ORM base"| node_database
node_api -->|"initializes storage"| node_database

click node_app "https://github.com/hungrybro/viper/blob/main/my-react-flow-app/src/App.tsx"
click node_canvas "https://github.com/hungrybro/viper/blob/main/my-react-flow-app/src/FlowCanvas.tsx"
click node_node_library "https://github.com/hungrybro/viper/tree/main/my-react-flow-app/src/components/nodes"
click node_runners "https://github.com/hungrybro/viper/tree/main/my-react-flow-app/src/lib/runners"
click node_templates_ui "https://github.com/hungrybro/viper/blob/main/my-react-flow-app/src/components/TemplatePlatformLibrary.tsx"
click node_template_client "https://github.com/hungrybro/viper/blob/main/my-react-flow-app/src/lib/templateApi.ts"
click node_feature_match "https://github.com/hungrybro/viper/tree/main/server/algos/feature"
click node_alignment "https://github.com/hungrybro/viper/tree/main/server/algos/ObjectAlignment"
click node_class_seg "https://github.com/hungrybro/viper/tree/main/server/algos/Classification"
click node_enhance_restore "https://github.com/hungrybro/viper/tree/main/server/algos/enchancement"
click node_quality_eval "https://github.com/hungrybro/viper/tree/main/server/algos/evaluation"
click node_yolo "https://github.com/hungrybro/viper/blob/main/server/algos/detection/yolo_adapter.py"
click node_api "https://github.com/hungrybro/viper/blob/main/server/main.py"
click node_detection_routes "https://github.com/hungrybro/viper/blob/main/server/routers/detection.py"
click node_template_routes "https://github.com/hungrybro/viper/blob/main/server/routers/templates.py"
click node_auth "https://github.com/hungrybro/viper/blob/main/server/routers/auth.py"
click node_admin "https://github.com/hungrybro/viper/blob/main/server/routers/admin.py"
click node_database "https://github.com/hungrybro/viper/blob/main/server/database.py"
click node_models "https://github.com/hungrybro/viper/blob/main/server/models.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_canvas,node_node_library,node_runners,node_templates_ui,node_template_client toneBlue
class node_feature_match,node_alignment,node_class_seg,node_enhance_restore,node_quality_eval,node_yolo toneAmber
class node_api,node_detection_routes,node_template_routes,node_auth,node_admin toneMint
class node_database,node_models toneRose
class node_operator toneIndigo
```

## Components

### Workflow Client

- [Workflow Shell](https://github.com/hungrybro/viper/blob/main/my-react-flow-app/src/App.tsx): `my-react-flow-app/src/App.tsx`
- [Workflow Canvas](https://github.com/hungrybro/viper/blob/main/my-react-flow-app/src/FlowCanvas.tsx): `my-react-flow-app/src/FlowCanvas.tsx`
- [Node Library](https://github.com/hungrybro/viper/tree/main/my-react-flow-app/src/components/nodes): `my-react-flow-app/src/components/nodes`
- [Stage Runners](https://github.com/hungrybro/viper/tree/main/my-react-flow-app/src/lib/runners): `my-react-flow-app/src/lib/runners`
- [Template Library](https://github.com/hungrybro/viper/blob/main/my-react-flow-app/src/components/TemplatePlatformLibrary.tsx): `my-react-flow-app/src/components/TemplatePlatformLibrary.tsx`
- [Template Client](https://github.com/hungrybro/viper/blob/main/my-react-flow-app/src/lib/templateApi.ts): `my-react-flow-app/src/lib/templateApi.ts`

### Image Processing

- [Feature & Matching](https://github.com/hungrybro/viper/tree/main/server/algos/feature): `server/algos/feature`
- [Alignment](https://github.com/hungrybro/viper/tree/main/server/algos/ObjectAlignment): `server/algos/ObjectAlignment`
- [Classify & Segment](https://github.com/hungrybro/viper/tree/main/server/algos/Classification): `server/algos/Classification`
- [Enhance & Restore](https://github.com/hungrybro/viper/tree/main/server/algos/enchancement): `server/algos/enchancement`
- [Quality & Evaluation](https://github.com/hungrybro/viper/tree/main/server/algos/evaluation): `server/algos/evaluation`
- [YOLO & Grad-CAM](https://github.com/hungrybro/viper/blob/main/server/algos/detection/yolo_adapter.py): `server/algos/detection/yolo_adapter.py`

### Platform Services

- [API Router](https://github.com/hungrybro/viper/blob/main/server/main.py): `server/main.py`
- [Detection Routes](https://github.com/hungrybro/viper/blob/main/server/routers/detection.py): `server/routers/detection.py`
- [Template Routes](https://github.com/hungrybro/viper/blob/main/server/routers/templates.py): `server/routers/templates.py`
- [Authentication](https://github.com/hungrybro/viper/blob/main/server/routers/auth.py): `server/routers/auth.py`
- [Administration](https://github.com/hungrybro/viper/blob/main/server/routers/admin.py): `server/routers/admin.py`

### Persistence

- [Relational Store](https://github.com/hungrybro/viper/blob/main/server/database.py): `server/database.py`
- [Data Models](https://github.com/hungrybro/viper/blob/main/server/models.py): `server/models.py`

### Other components

- **Operator**

## Connections

- Operator → Workflow Shell: builds workflows (evidence: `README.md`)
- Workflow Shell → Workflow Canvas: renders (evidence: `my-react-flow-app/src/App.tsx`)
- Workflow Shell → Node Library: offers nodes (evidence: `my-react-flow-app/src/App.tsx`)
- Workflow Canvas → Node Library: renders nodes (evidence: `README.md`)
- Workflow Canvas → Stage Runners: dispatches stages (evidence: `my-react-flow-app/src/FlowCanvas.tsx`)
- Stage Runners → API Router: requests processing
- Operator → Template Library: browses templates (evidence: `README.md`)
- Template Library → Template Client: loads templates
- Template Client → Template Routes: calls API
- API Router → Detection Routes: registers routes (evidence: `server/main.py`)
- Detection Routes → YOLO & Grad-CAM: dispatches detection (evidence: `server/routers/detection.py`)
- API Router → Feature & Matching: registers processing routes (evidence: `server/main.py`)
- API Router → Alignment: registers processing routes
- API Router → Classify & Segment: registers processing routes
- API Router → Enhance & Restore: registers processing routes
- API Router → Quality & Evaluation: registers processing routes
- API Router → Template Routes: registers routes (evidence: `server/main.py`)
- API Router → Authentication: registers routes (evidence: `server/main.py`)
- API Router → Administration: registers routes (evidence: `server/main.py`)
- Template Routes → Data Models: reads and writes (evidence: `server/routers/templates.py`)
- Authentication → Data Models: authenticates users (evidence: `server/routers/auth.py`)
- Data Models → Relational Store: uses ORM base (evidence: `server/models.py`)
- API Router → Relational Store: initializes storage (evidence: `server/main.py`)
