# willmiao/comfyui-lora-manager architecture

> Architecture diagram of the GitHub repository willmiao/comfyui-lora-manager, 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/willmiao/comfyui-lora-manager
- Repository: https://github.com/willmiao/comfyui-lora-manager

## Overview

ComfyUI LoRA Manager is a model-library and workflow companion: users browse and organize model types, manage recipes and metadata, download models, and apply LoRAs in ComfyUI. The principal workflow runs from the browser UI through model APIs and server routes into model services; separate branches cover downloads, recipes, AI-assisted enrichment, and ComfyUI nodes/extensions. The README documents these capabilities, while source-index references and excerpts support only some internal links; unsampled subsystem connections are omitted.

Main entry points: [`static/js/api/modelApiFactory.js`](https://github.com/willmiao/comfyui-lora-manager/blob/main/static/js/api/modelApiFactory.js) (Model API Client), [`py/services/service_registry.py`](https://github.com/willmiao/comfyui-lora-manager/blob/main/py/services/service_registry.py) (Service Registry), [`py/lora_manager.py`](https://github.com/willmiao/comfyui-lora-manager/blob/main/py/lora_manager.py) (Server Setup), [`static/js/components/SidebarManager.js`](https://github.com/willmiao/comfyui-lora-manager/blob/main/static/js/components/SidebarManager.js) (Model Library UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Library Interface"]
  node_library_ui["Model Library UI<br/>[SidebarManager.js]"]
  node_api_client["Model API Client<br/>[modelApiFactory.js]"]
  node_ui_state["Browser State<br/>[index.js]"]
  node_download_ui["Download Manager UI<br/>[DownloadManager.js]"]
  node_recipe_ui["Recipe Interface<br/>[recipes.js]"]
end

subgraph group_server["Server and Models"]
  node_routes["Model Routes"]
  node_app["Server Setup<br/>[lora_manager.py]"]
  node_service_registry["Service Registry"]
  node_settings["Settings"]
  node_model_services["Model Services"]
  node_model_catalog["Model Scanning<br/>[model_scanner.py]"]
end

subgraph group_downloads["Download and Sources"]
  node_download_service["Download Service<br/>[downloader.py]"]
  node_model_sources["Model Sources"]
end

subgraph group_recipes["Recipes and AI"]
  node_recipe_routes["Recipe Routes<br/>[recipe_routes.py]"]
  node_recipe_storage[("Recipe Persistence")]
  node_agent["Metadata Agent<br/>[agent_service.py]"]
  node_llm["LLM Client<br/>[llm_service.py]"]
end

subgraph group_comfy["ComfyUI Integration"]
  node_comfy_nodes["ComfyUI Nodes<br/>[lora_loader.py]"]
  node_comfy_extension["ComfyUI Extension<br/>[lora_loader.js]"]
end

node_user(("ComfyUI User"))
node_workflow(("Workflow User"))

node_user -->|"browses models"| node_library_ui
node_library_ui -->|"requests models"| node_api_client
node_api_client -->|"reads state"| node_ui_state
node_app -->|"registers routes"| node_routes
node_routes -->|"resolves service"| node_service_registry
node_service_registry -.->|"creates services"| node_model_services
node_app -->|"initializes services"| node_service_registry
node_download_ui -->|"requests downloads"| node_api_client
node_download_service -->|"reads settings"| node_settings
node_agent -->|"calls provider"| node_llm
node_recipe_ui -.->|"manages recipes"| node_recipe_routes
node_recipe_routes -.->|"persists recipes"| node_recipe_storage
node_workflow -->|"applies LoRA"| node_comfy_nodes
node_comfy_extension -.->|"integrates nodes"| node_comfy_nodes

click node_library_ui "https://github.com/willmiao/comfyui-lora-manager/blob/main/static/js/components/SidebarManager.js"
click node_api_client "https://github.com/willmiao/comfyui-lora-manager/blob/main/static/js/api/modelApiFactory.js"
click node_ui_state "https://github.com/willmiao/comfyui-lora-manager/blob/main/static/js/state/index.js"
click node_routes "https://github.com/willmiao/comfyui-lora-manager/blob/main/py/routes/embedding_routes.py"
click node_app "https://github.com/willmiao/comfyui-lora-manager/blob/main/py/lora_manager.py"
click node_service_registry "https://github.com/willmiao/comfyui-lora-manager/blob/main/py/services/service_registry.py"
click node_settings "https://github.com/willmiao/comfyui-lora-manager/blob/main/py/services/settings_manager.py"
click node_model_services "https://github.com/willmiao/comfyui-lora-manager/blob/main/py/services/model_service_factory.py"
click node_model_catalog "https://github.com/willmiao/comfyui-lora-manager/blob/main/py/services/model_scanner.py"
click node_download_ui "https://github.com/willmiao/comfyui-lora-manager/blob/main/static/js/managers/DownloadManager.js"
click node_download_service "https://github.com/willmiao/comfyui-lora-manager/blob/main/py/services/downloader.py"
click node_model_sources "https://github.com/willmiao/comfyui-lora-manager/tree/main/py/services/model_sources"
click node_recipe_ui "https://github.com/willmiao/comfyui-lora-manager/blob/main/static/js/recipes.js"
click node_recipe_routes "https://github.com/willmiao/comfyui-lora-manager/blob/main/py/routes/recipe_routes.py"
click node_recipe_storage "https://github.com/willmiao/comfyui-lora-manager/blob/main/py/services/recipes/persistence_service.py"
click node_agent "https://github.com/willmiao/comfyui-lora-manager/blob/main/py/services/agent/agent_service.py"
click node_llm "https://github.com/willmiao/comfyui-lora-manager/blob/main/py/services/llm_service.py"
click node_comfy_nodes "https://github.com/willmiao/comfyui-lora-manager/blob/main/py/nodes/lora_loader.py"
click node_comfy_extension "https://github.com/willmiao/comfyui-lora-manager/blob/main/web/comfyui/lora_loader.js"

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_library_ui,node_api_client,node_ui_state,node_download_ui,node_recipe_ui,node_user,node_workflow toneBlue
class node_routes,node_app,node_service_registry,node_settings,node_model_services,node_model_catalog toneAmber
class node_download_service,node_model_sources toneMint
class node_recipe_routes,node_recipe_storage,node_agent,node_llm toneRose
class node_comfy_nodes,node_comfy_extension toneIndigo
```

## Components

### Library Interface

- [Model Library UI](https://github.com/willmiao/comfyui-lora-manager/blob/main/static/js/components/SidebarManager.js): `static/js/components/SidebarManager.js`
- [Model API Client](https://github.com/willmiao/comfyui-lora-manager/blob/main/static/js/api/modelApiFactory.js): `static/js/api/modelApiFactory.js`
- [Browser State](https://github.com/willmiao/comfyui-lora-manager/blob/main/static/js/state/index.js): `static/js/state/index.js`
- [Download Manager UI](https://github.com/willmiao/comfyui-lora-manager/blob/main/static/js/managers/DownloadManager.js): `static/js/managers/DownloadManager.js`
- [Recipe Interface](https://github.com/willmiao/comfyui-lora-manager/blob/main/static/js/recipes.js): `static/js/recipes.js`

### Server and Models

- [Model Routes](https://github.com/willmiao/comfyui-lora-manager/blob/main/py/routes/embedding_routes.py): `py/routes/embedding_routes.py`
- [Server Setup](https://github.com/willmiao/comfyui-lora-manager/blob/main/py/lora_manager.py): `py/lora_manager.py`
- [Service Registry](https://github.com/willmiao/comfyui-lora-manager/blob/main/py/services/service_registry.py): `py/services/service_registry.py`
- [Settings](https://github.com/willmiao/comfyui-lora-manager/blob/main/py/services/settings_manager.py): `py/services/settings_manager.py`
- [Model Services](https://github.com/willmiao/comfyui-lora-manager/blob/main/py/services/model_service_factory.py): `py/services/model_service_factory.py`
- [Model Scanning](https://github.com/willmiao/comfyui-lora-manager/blob/main/py/services/model_scanner.py): `py/services/model_scanner.py`

### Download and Sources

- [Download Service](https://github.com/willmiao/comfyui-lora-manager/blob/main/py/services/downloader.py): `py/services/downloader.py`
- [Model Sources](https://github.com/willmiao/comfyui-lora-manager/tree/main/py/services/model_sources): `py/services/model_sources`

### Recipes and AI

- [Recipe Routes](https://github.com/willmiao/comfyui-lora-manager/blob/main/py/routes/recipe_routes.py): `py/routes/recipe_routes.py`
- [Recipe Persistence](https://github.com/willmiao/comfyui-lora-manager/blob/main/py/services/recipes/persistence_service.py): `py/services/recipes/persistence_service.py`
- [Metadata Agent](https://github.com/willmiao/comfyui-lora-manager/blob/main/py/services/agent/agent_service.py): `py/services/agent/agent_service.py`
- [LLM Client](https://github.com/willmiao/comfyui-lora-manager/blob/main/py/services/llm_service.py): `py/services/llm_service.py`

### ComfyUI Integration

- [ComfyUI Nodes](https://github.com/willmiao/comfyui-lora-manager/blob/main/py/nodes/lora_loader.py): `py/nodes/lora_loader.py`
- [ComfyUI Extension](https://github.com/willmiao/comfyui-lora-manager/blob/main/web/comfyui/lora_loader.js): `web/comfyui/lora_loader.js`

### Other components

- **ComfyUI User**
- **Workflow User**

## Connections

- ComfyUI User → Model Library UI: browses models
- Model Library UI → Model API Client: requests models (evidence: `static/js/components/SidebarManager.js`)
- Model API Client → Browser State: reads state (evidence: `static/js/api/modelApiFactory.js`)
- Server Setup → Model Routes: registers routes (evidence: `py/lora_manager.py`)
- Model Routes → Service Registry: resolves service (evidence: `py/routes/embedding_routes.py`)
- Service Registry → Model Services: creates services
- Server Setup → Service Registry: initializes services (evidence: `py/lora_manager.py`)
- Download Manager UI → Model API Client: requests downloads (evidence: `static/js/managers/DownloadManager.js`)
- Download Service → Settings: reads settings (evidence: `py/services/downloader.py`)
- Metadata Agent → LLM Client: calls provider (evidence: `py/services/agent/agent_service.py`)
- Recipe Interface → Recipe Routes: manages recipes
- Recipe Routes → Recipe Persistence: persists recipes
- Workflow User → ComfyUI Nodes: applies LoRA
- ComfyUI Extension → ComfyUI Nodes: integrates nodes
