# vladmandic/sdnext architecture

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

- Interactive diagram: https://gitdiagram.com/vladmandic/sdnext
- Repository: https://github.com/vladmandic/sdnext

## Overview

SD.Next is a cross-platform WebUI and server for generating, editing, and processing AI images and video. The documented user journey is to submit a generation or editing workflow through the interface/API, run model inference, then refine or process the result. The graph preserves README capabilities including captioning, ControlNet, LoRA, upscaling, model downloads, quantization, and installer support. Some wiring is based on README statements or SOURCE INDEX references; unsampled modules are represented at directory level, and uncertain runtime links are omitted.

Main entry points: [`modules/processing.py`](https://github.com/vladmandic/sdnext/blob/master/modules/processing.py) (Generation engine), [`modules/sd_models.py`](https://github.com/vladmandic/sdnext/blob/master/modules/sd_models.py) (Model loading), [`modules/api`](https://github.com/vladmandic/sdnext/tree/master/modules/api) (Web UI and API), [`modules/dlss/nr_pipeline.py`](https://github.com/vladmandic/sdnext/blob/master/modules/dlss/nr_pipeline.py) (DLSS features)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Interface and API"]
  node_webapi["Web UI and API"]
  node_api_routes["Generation API<br/>[generate.py]"]
  node_history[("Generation history<br/>[history.py]")]
end

subgraph group_generation["Generation and Editing"]
  node_generation_core["Generation engine<br/>[processing.py]"]
  node_image_edit["Image-to-image<br/>[img2img.py]"]
  node_apg["APG pipelines"]
  node_controlnet["Control guidance"]
  node_lora["LoRA adapters"]
  node_apg_sd["Stable Diffusion APG"]
end

subgraph group_media["Media Processing"]
  node_caption["Caption and tagging"]
  node_detailer["Detailer"]
  node_upscale["Upscaling"]
  node_image_processing["Image processing"]
  node_video["Video workflows"]
  node_dlss["DLSS features<br/>[nr_pipeline.py]"]
  node_dlss_model["DLSS model<br/>[nr_model.py]"]
  node_dlss_features["DLSS features<br/>[nr_features.py]"]
end

subgraph group_models["Models and Runtime"]
  node_model_loading["Model loading<br/>[sd_models.py]"]
  node_model_paths["Model paths<br/>[paths.py]"]
  node_quantization["SDNQ quantization<br/>[model_quant.py]"]
  node_attention["Attention backends"]
  node_ipex["IPEX optimizations<br/>[diffusers.py]"]
end

subgraph group_platform["Platform Services"]
  node_installer["Installer<br/>[installer.py]"]
  node_platform_runtime["Device support<br/>[devices.py]"]
  node_logging["Logging<br/>[logger.py]"]
end

node_user(("Artist / API client"))

node_user -->|"submits workflow"| node_webapi
node_webapi -->|"offers generation"| node_api_routes
node_api_routes -.->|"runs generation"| node_generation_core
node_generation_core -.->|"uses models"| node_model_loading
node_generation_core -->|"supports image editing"| node_image_edit
node_generation_core -.->|"supports diffusion pipeline"| node_apg
node_generation_core -.->|"supports diffusion pipeline"| node_apg_sd
node_generation_core -->|"uses guidance"| node_controlnet
node_generation_core -->|"uses adapters"| node_lora
node_generation_core -->|"supports captioning"| node_caption
node_generation_core -->|"supports video"| node_video
node_generation_core -->|"supports refinement"| node_detailer
node_generation_core -->|"supports upscaling"| node_upscale
node_generation_core -->|"supports processing"| node_image_processing
node_webapi -.->|"exposes history"| node_history
node_model_loading -->|"uses paths"| node_model_paths
node_model_loading -->|"supports quantization"| node_quantization
node_generation_core -.->|"uses attention"| node_attention
node_generation_core -->|"uses optimizations"| node_ipex
node_installer -->|"downloads models"| node_model_loading
node_platform_runtime -.->|"enables execution"| node_generation_core
node_dlss -->|"uses model"| node_dlss_model
node_dlss -->|"uses features"| node_dlss_features
node_generation_core -.->|"supports enhancement"| node_dlss

click node_webapi "https://github.com/vladmandic/sdnext/tree/master/modules/api"
click node_api_routes "https://github.com/vladmandic/sdnext/blob/master/modules/api/generate.py"
click node_generation_core "https://github.com/vladmandic/sdnext/blob/master/modules/processing.py"
click node_image_edit "https://github.com/vladmandic/sdnext/blob/master/modules/img2img.py"
click node_apg "https://github.com/vladmandic/sdnext/blob/master/modules/apg/pipeline_stable_diffision_xl_apg.py"
click node_controlnet "https://github.com/vladmandic/sdnext/tree/master/modules/control"
click node_lora "https://github.com/vladmandic/sdnext/tree/master/modules/lora"
click node_model_loading "https://github.com/vladmandic/sdnext/blob/master/modules/sd_models.py"
click node_model_paths "https://github.com/vladmandic/sdnext/blob/master/modules/paths.py"
click node_quantization "https://github.com/vladmandic/sdnext/blob/master/modules/model_quant.py"
click node_attention "https://github.com/vladmandic/sdnext/tree/master/modules/attention"
click node_ipex "https://github.com/vladmandic/sdnext/blob/master/modules/intel/ipex/diffusers.py"
click node_caption "https://github.com/vladmandic/sdnext/tree/master/modules/caption"
click node_detailer "https://github.com/vladmandic/sdnext/tree/master/modules/detailer"
click node_upscale "https://github.com/vladmandic/sdnext/tree/master/modules/postprocess"
click node_image_processing "https://github.com/vladmandic/sdnext/tree/master/modules/image"
click node_video "https://github.com/vladmandic/sdnext/blob/master/modules/processing_video.py"
click node_history "https://github.com/vladmandic/sdnext/blob/master/modules/history.py"
click node_installer "https://github.com/vladmandic/sdnext/blob/master/installer.py"
click node_platform_runtime "https://github.com/vladmandic/sdnext/blob/master/modules/devices.py"
click node_logging "https://github.com/vladmandic/sdnext/blob/master/modules/logger.py"
click node_dlss "https://github.com/vladmandic/sdnext/blob/master/modules/dlss/nr_pipeline.py"
click node_dlss_model "https://github.com/vladmandic/sdnext/blob/master/modules/dlss/nr_model.py"
click node_dlss_features "https://github.com/vladmandic/sdnext/blob/master/modules/dlss/nr_features.py"
click node_apg_sd "https://github.com/vladmandic/sdnext/blob/master/modules/apg/pipeline_stable_diffusion_apg.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_webapi,node_api_routes,node_history,node_user toneBlue
class node_generation_core,node_image_edit,node_apg,node_controlnet,node_lora,node_apg_sd toneAmber
class node_caption,node_detailer,node_upscale,node_image_processing,node_video,node_dlss,node_dlss_model,node_dlss_features toneMint
class node_model_loading,node_model_paths,node_quantization,node_attention,node_ipex toneRose
class node_installer,node_platform_runtime,node_logging toneIndigo
```

## Components

### Interface and API

- [Web UI and API](https://github.com/vladmandic/sdnext/tree/master/modules/api): `modules/api`
- [Generation API](https://github.com/vladmandic/sdnext/blob/master/modules/api/generate.py): `modules/api/generate.py`
- [Generation history](https://github.com/vladmandic/sdnext/blob/master/modules/history.py): `modules/history.py`

### Generation and Editing

- [Generation engine](https://github.com/vladmandic/sdnext/blob/master/modules/processing.py): `modules/processing.py`
- [Image-to-image](https://github.com/vladmandic/sdnext/blob/master/modules/img2img.py): `modules/img2img.py`
- [APG pipelines](https://github.com/vladmandic/sdnext/blob/master/modules/apg/pipeline_stable_diffision_xl_apg.py): `modules/apg/pipeline_stable_diffision_xl_apg.py`
- [Control guidance](https://github.com/vladmandic/sdnext/tree/master/modules/control): `modules/control`
- [LoRA adapters](https://github.com/vladmandic/sdnext/tree/master/modules/lora): `modules/lora`
- [Stable Diffusion APG](https://github.com/vladmandic/sdnext/blob/master/modules/apg/pipeline_stable_diffusion_apg.py): `modules/apg/pipeline_stable_diffusion_apg.py`

### Media Processing

- [Caption and tagging](https://github.com/vladmandic/sdnext/tree/master/modules/caption): `modules/caption`
- [Detailer](https://github.com/vladmandic/sdnext/tree/master/modules/detailer): `modules/detailer`
- [Upscaling](https://github.com/vladmandic/sdnext/tree/master/modules/postprocess): `modules/postprocess`
- [Image processing](https://github.com/vladmandic/sdnext/tree/master/modules/image): `modules/image`
- [Video workflows](https://github.com/vladmandic/sdnext/blob/master/modules/processing_video.py): `modules/processing_video.py`
- [DLSS features](https://github.com/vladmandic/sdnext/blob/master/modules/dlss/nr_pipeline.py): `modules/dlss/nr_pipeline.py`
- [DLSS model](https://github.com/vladmandic/sdnext/blob/master/modules/dlss/nr_model.py): `modules/dlss/nr_model.py`
- [DLSS features](https://github.com/vladmandic/sdnext/blob/master/modules/dlss/nr_features.py): `modules/dlss/nr_features.py`

### Models and Runtime

- [Model loading](https://github.com/vladmandic/sdnext/blob/master/modules/sd_models.py): `modules/sd_models.py`
- [Model paths](https://github.com/vladmandic/sdnext/blob/master/modules/paths.py): `modules/paths.py`
- [SDNQ quantization](https://github.com/vladmandic/sdnext/blob/master/modules/model_quant.py): `modules/model_quant.py`
- [Attention backends](https://github.com/vladmandic/sdnext/tree/master/modules/attention): `modules/attention`
- [IPEX optimizations](https://github.com/vladmandic/sdnext/blob/master/modules/intel/ipex/diffusers.py): `modules/intel/ipex/diffusers.py`

### Platform Services

- [Installer](https://github.com/vladmandic/sdnext/blob/master/installer.py): `installer.py`
- [Device support](https://github.com/vladmandic/sdnext/blob/master/modules/devices.py): `modules/devices.py`
- [Logging](https://github.com/vladmandic/sdnext/blob/master/modules/logger.py): `modules/logger.py`

### Other components

- **Artist / API client**

## Connections

- Artist / API client → Web UI and API: submits workflow (evidence: `README.md`)
- Web UI and API → Generation API: offers generation (evidence: `README.md`)
- Generation API → Generation engine: runs generation
- Generation engine → Model loading: uses models
- Generation engine → Image-to-image: supports image editing (evidence: `README.md`)
- Generation engine → APG pipelines: supports diffusion pipeline
- Generation engine → Stable Diffusion APG: supports diffusion pipeline
- Generation engine → Control guidance: uses guidance (evidence: `README.md`)
- Generation engine → LoRA adapters: uses adapters (evidence: `README.md`)
- Generation engine → Caption and tagging: supports captioning (evidence: `README.md`)
- Generation engine → Video workflows: supports video (evidence: `README.md`)
- Generation engine → Detailer: supports refinement (evidence: `README.md`)
- Generation engine → Upscaling: supports upscaling (evidence: `README.md`)
- Generation engine → Image processing: supports processing (evidence: `README.md`)
- Web UI and API → Generation history: exposes history
- Model loading → Model paths: uses paths
- Model loading → SDNQ quantization: supports quantization (evidence: `README.md`)
- Generation engine → Attention backends: uses attention
- Generation engine → IPEX optimizations: uses optimizations
- Installer → Model loading: downloads models (evidence: `README.md`)
- Device support → Generation engine: enables execution
- DLSS features → DLSS model: uses model (evidence: `modules/dlss/nr_pipeline.py`)
- DLSS features → DLSS features: uses features (evidence: `modules/dlss/nr_pipeline.py`)
- Generation engine → DLSS features: supports enhancement
