# uniscz/dehcode architecture

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

- Interactive diagram: https://gitdiagram.com/uniscz/dehcode
- Repository: https://github.com/uniscz/dehcode

## Overview

DehCode is an experimental local runtime and router for open video models. Users can inspect hardware, browse the model catalog, receive conservative recommendations, download a pinned model snapshot, and generate an MP4 through a model adapter and shared runtime. The graph distinguishes those stages and the internal registry, request, and configuration layers. The README documents planned capabilities separately; the sampled implementation supports one Wan adapter. Evidence is limited to the README and indexed source excerpts.

Main entry points: [`src/dehcode/cli.py`](https://github.com/uniscz/dehcode/blob/main/src/dehcode/cli.py) (CLI commands), [`src/dehcode/core/download.py`](https://github.com/uniscz/dehcode/blob/main/src/dehcode/core/download.py) (Snapshot installer), [`src/dehcode/runtimes/diffusers.py`](https://github.com/uniscz/dehcode/blob/main/src/dehcode/runtimes/diffusers.py) (Diffusers runtime), [`src/dehcode/core/service.py`](https://github.com/uniscz/dehcode/blob/main/src/dehcode/core/service.py) (Run orchestrator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["CLI and diagnostics"]
  node_cli["CLI commands<br/>[cli.py]"]
  node_hardware["Hardware probe<br/>[__init__.py]"]
end

subgraph group_catalog["Catalog and recommendations"]
  node_registry["Model registry<br/>[registry.py]"]
  node_catalogdata["Model catalog JSON<br/>[wan.json]"]
  node_recommend["Recommendation logic<br/>[recommend.py]"]
  node_request["Generation request<br/>[request.py]"]
end

subgraph group_acquisition["Model acquisition"]
  node_config["Cache directories<br/>[__init__.py]"]
  node_download["Snapshot installer<br/>[download.py]"]
  node_installed[("Installed snapshots<br/>[download.py]")]
end

subgraph group_generation["Generation runtime"]
  node_service["Run orchestrator<br/>[service.py]"]
  node_adaptermap["Adapter selection<br/>[__init__.py]"]
  node_wan["Wan adapter<br/>[wan.py]"]
  node_diffusers["Diffusers runtime<br/>[diffusers.py]"]
  node_outputs["MP4 and metadata<br/>[diffusers.py]"]
end

node_user(("Local user"))
node_modelhub["Hugging Face Hub"]
node_gpu["NVIDIA GPU"]

node_user -->|"runs commands"| node_cli
node_cli -->|"probes hardware"| node_hardware
node_cli -->|"lists models"| node_registry
node_cli -->|"requests advice"| node_recommend
node_cli -->|"gets probe data"| node_hardware
node_recommend -->|"reads hardware"| node_hardware
node_recommend -->|"evaluates models"| node_registry
node_registry -->|"loads catalog"| node_catalogdata
node_cli -->|"starts install"| node_download
node_download -->|"resolves cache"| node_config
node_download -->|"fetches snapshot"| node_modelhub
node_download -->|"records snapshot"| node_installed
node_cli -->|"selects model"| node_registry
node_cli -->|"builds request"| node_request
node_cli -->|"starts generation"| node_service
node_service -->|"selects adapter"| node_adaptermap
node_adaptermap -->|"creates adapter"| node_wan
node_service -->|"checks installation"| node_download
node_service -->|"dispatches execution"| node_diffusers
node_diffusers -->|"loads and invokes"| node_wan
node_wan -->|"validates parameters"| node_request
node_wan -->|"configures pipeline"| node_diffusers
node_diffusers -->|"runs inference"| node_gpu
node_diffusers -->|"writes video and metadata"| node_outputs

click node_cli "https://github.com/uniscz/dehcode/blob/main/src/dehcode/cli.py"
click node_hardware "https://github.com/uniscz/dehcode/blob/main/src/dehcode/hardware/__init__.py"
click node_registry "https://github.com/uniscz/dehcode/blob/main/src/dehcode/core/registry.py"
click node_catalogdata "https://github.com/uniscz/dehcode/blob/main/src/dehcode/registry/wan.json"
click node_recommend "https://github.com/uniscz/dehcode/blob/main/src/dehcode/core/recommend.py"
click node_request "https://github.com/uniscz/dehcode/blob/main/src/dehcode/core/request.py"
click node_config "https://github.com/uniscz/dehcode/blob/main/src/dehcode/config/__init__.py"
click node_download "https://github.com/uniscz/dehcode/blob/main/src/dehcode/core/download.py"
click node_installed "https://github.com/uniscz/dehcode/blob/main/src/dehcode/core/download.py"
click node_service "https://github.com/uniscz/dehcode/blob/main/src/dehcode/core/service.py"
click node_adaptermap "https://github.com/uniscz/dehcode/blob/main/src/dehcode/adapters/__init__.py"
click node_wan "https://github.com/uniscz/dehcode/blob/main/src/dehcode/adapters/wan.py"
click node_diffusers "https://github.com/uniscz/dehcode/blob/main/src/dehcode/runtimes/diffusers.py"
click node_outputs "https://github.com/uniscz/dehcode/blob/main/src/dehcode/runtimes/diffusers.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_cli,node_hardware,node_user toneBlue
class node_registry,node_catalogdata,node_recommend,node_request toneAmber
class node_config,node_download,node_installed toneMint
class node_service,node_adaptermap,node_wan,node_diffusers,node_outputs toneRose
class node_modelhub,node_gpu toneIndigo
```

## Components

### CLI and diagnostics

- [CLI commands](https://github.com/uniscz/dehcode/blob/main/src/dehcode/cli.py): `src/dehcode/cli.py`
- [Hardware probe](https://github.com/uniscz/dehcode/blob/main/src/dehcode/hardware/__init__.py): `src/dehcode/hardware/__init__.py`

### Catalog and recommendations

- [Model registry](https://github.com/uniscz/dehcode/blob/main/src/dehcode/core/registry.py): `src/dehcode/core/registry.py`
- [Model catalog JSON](https://github.com/uniscz/dehcode/blob/main/src/dehcode/registry/wan.json): `src/dehcode/registry/wan.json`
- [Recommendation logic](https://github.com/uniscz/dehcode/blob/main/src/dehcode/core/recommend.py): `src/dehcode/core/recommend.py`
- [Generation request](https://github.com/uniscz/dehcode/blob/main/src/dehcode/core/request.py): `src/dehcode/core/request.py`

### Model acquisition

- [Cache directories](https://github.com/uniscz/dehcode/blob/main/src/dehcode/config/__init__.py): `src/dehcode/config/__init__.py`
- [Snapshot installer](https://github.com/uniscz/dehcode/blob/main/src/dehcode/core/download.py): `src/dehcode/core/download.py`
- [Installed snapshots](https://github.com/uniscz/dehcode/blob/main/src/dehcode/core/download.py): `src/dehcode/core/download.py`

### Generation runtime

- [Run orchestrator](https://github.com/uniscz/dehcode/blob/main/src/dehcode/core/service.py): `src/dehcode/core/service.py`
- [Adapter selection](https://github.com/uniscz/dehcode/blob/main/src/dehcode/adapters/__init__.py): `src/dehcode/adapters/__init__.py`
- [Wan adapter](https://github.com/uniscz/dehcode/blob/main/src/dehcode/adapters/wan.py): `src/dehcode/adapters/wan.py`
- [Diffusers runtime](https://github.com/uniscz/dehcode/blob/main/src/dehcode/runtimes/diffusers.py): `src/dehcode/runtimes/diffusers.py`
- [MP4 and metadata](https://github.com/uniscz/dehcode/blob/main/src/dehcode/runtimes/diffusers.py): `src/dehcode/runtimes/diffusers.py`

### Other components

- **Local user**
- **Hugging Face Hub**
- **NVIDIA GPU**

## Connections

- Local user → CLI commands: runs commands (evidence: `README.md`)
- CLI commands → Hardware probe: probes hardware (evidence: `src/dehcode/cli.py`)
- CLI commands → Model registry: lists models (evidence: `src/dehcode/cli.py`)
- CLI commands → Recommendation logic: requests advice (evidence: `src/dehcode/cli.py`)
- CLI commands → Hardware probe: gets probe data (evidence: `src/dehcode/cli.py`)
- Recommendation logic → Hardware probe: reads hardware (evidence: `README.md`)
- Recommendation logic → Model registry: evaluates models (evidence: `src/dehcode/cli.py`)
- Model registry → Model catalog JSON: loads catalog (evidence: `README.md`)
- CLI commands → Snapshot installer: starts install (evidence: `src/dehcode/cli.py`)
- Snapshot installer → Cache directories: resolves cache (evidence: `src/dehcode/core/download.py`)
- Snapshot installer → Hugging Face Hub: fetches snapshot (evidence: `src/dehcode/core/download.py`)
- Snapshot installer → Installed snapshots: records snapshot (evidence: `src/dehcode/core/download.py`)
- CLI commands → Model registry: selects model (evidence: `src/dehcode/cli.py`)
- CLI commands → Generation request: builds request (evidence: `src/dehcode/cli.py`)
- CLI commands → Run orchestrator: starts generation (evidence: `src/dehcode/cli.py`)
- Run orchestrator → Adapter selection: selects adapter (evidence: `src/dehcode/core/service.py`)
- Adapter selection → Wan adapter: creates adapter (evidence: `src/dehcode/adapters/__init__.py`)
- Run orchestrator → Snapshot installer: checks installation (evidence: `src/dehcode/core/service.py`)
- Run orchestrator → Diffusers runtime: dispatches execution (evidence: `src/dehcode/core/service.py`)
- Diffusers runtime → Wan adapter: loads and invokes (evidence: `src/dehcode/runtimes/diffusers.py`)
- Wan adapter → Generation request: validates parameters (evidence: `src/dehcode/adapters/wan.py`)
- Wan adapter → Diffusers runtime: configures pipeline (evidence: `src/dehcode/adapters/wan.py`)
- Diffusers runtime → NVIDIA GPU: runs inference (evidence: `src/dehcode/runtimes/diffusers.py`)
- Diffusers runtime → MP4 and metadata: writes video and metadata (evidence: `src/dehcode/runtimes/diffusers.py`)
