# drawthingsai/draw-things-community architecture

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

- Interactive diagram: https://gitdiagram.com/drawthingsai/draw-things-community
- Repository: https://github.com/drawthingsai/draw-things-community

## Overview

Draw Things Community contains public-facing implementations of Draw Things capabilities, including local image generation, model and sampler implementations, training, and a self-hosted gRPC server. The documented user paths are generating images with draw-things-cli and connecting the app to a self-hosted server. The graph includes major model, asset, and history subsystems as well. Source excerpts are partial, so some cross-component links are shown only as unverified dashed relationships rather than asserted calls.

Main entry points: [`Libraries/ModelZoo/Sources/ModelZoo.swift`](https://github.com/drawthingsai/draw-things-community/blob/main/Libraries/ModelZoo/Sources/ModelZoo.swift) (Model catalog), [`Libraries/MediaGenerationKit/Sources/MediaGenerationPipeline.swift`](https://github.com/drawthingsai/draw-things-community/blob/main/Libraries/MediaGenerationKit/Sources/MediaGenerationPipeline.swift) (Media generation pipeline), [`Libraries/ImageGenerator/Sources/ImageGeneratorProtocol.swift`](https://github.com/drawthingsai/draw-things-community/blob/main/Libraries/ImageGenerator/Sources/ImageGeneratorProtocol.swift) (Generator protocol), [`Libraries/SwiftDiffusion/Sources/Models/UNet.swift`](https://github.com/drawthingsai/draw-things-community/blob/main/Libraries/SwiftDiffusion/Sources/Models/UNet.swift) (Diffusion models)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User interfaces"]
  node_draw_cli["Draw Things CLI"]
  node_grpc_cli["gRPC server CLI"]
  node_http_api["HTTP API"]
end

subgraph group_generation["Generation services"]
  node_grpc_service["Image generation service"]
  node_media_pipeline["Media generation pipeline"]
  node_remote_execution["Remote execution"]
  node_image_generator["Generator protocol"]
  node_local_generator["Local generator"]
  node_remote_generator["Remote generator"]
end

subgraph group_assets["Models and assets"]
  node_model_zoo["Model catalog<br/>[ModelZoo.swift]"]
  node_control_zoo["ControlNet catalog"]
  node_textual_zoo["Textual inversion catalog"]
  node_downloader["Model downloads"]
  node_model_import["Model importers<br/>[Importer.swift]"]
end

subgraph group_runtime["ML runtime"]
  node_diffusion_models["Diffusion models<br/>[UNet.swift]"]
  node_lora["LoRA support<br/>[LoRA.swift]"]
  node_float_type["Tensor precision<br/>[FloatType.swift]"]
end

subgraph group_capabilities["Product capabilities"]
  node_trainer["LoRA trainer<br/>[LoRATrainer.swift]"]
  node_history[("Image history")]
  node_video_export["Video export"]
end

node_cli_user(("CLI user"))
node_app_user(("Draw Things app"))

node_cli_user -->|"runs"| node_draw_cli
node_draw_cli -.->|"requests generation"| node_media_pipeline
node_app_user -->|"connects to"| node_grpc_cli
node_grpc_cli -.->|"hosts"| node_grpc_service
node_grpc_service -->|"uses catalog"| node_model_zoo
node_media_pipeline -->|"resolves model"| node_model_zoo
node_media_pipeline -->|"dispatches remotely"| node_remote_execution
node_media_pipeline -.->|"uses generator interface"| node_image_generator
node_image_generator -.->|"implemented by"| node_local_generator
node_image_generator -.->|"implemented by"| node_remote_generator
node_model_zoo -->|"maps model types"| node_diffusion_models
node_model_zoo -.->|"catalogs controls"| node_control_zoo
node_model_zoo -.->|"catalogs embeddings"| node_textual_zoo
node_downloader -.->|"downloads assets"| node_model_zoo
node_model_import -->|"registers imported assets"| node_model_zoo
node_diffusion_models -.->|"uses precision"| node_float_type
node_lora -.->|"adapts models"| node_diffusion_models
node_trainer -.->|"trains adapters"| node_lora

click node_draw_cli "https://github.com/drawthingsai/draw-things-community/blob/main/Apps/DrawThingsCLI/DrawThingsCLI.swift"
click node_grpc_cli "https://github.com/drawthingsai/draw-things-community/blob/main/Apps/gRPCServerCLI/gRPCServerCLI.swift"
click node_grpc_service "https://github.com/drawthingsai/draw-things-community/blob/main/Libraries/GRPC/Server/Sources/ImageGenerationServiceImpl.swift"
click node_http_api "https://github.com/drawthingsai/draw-things-community/blob/main/Libraries/HTTPAPIServer/Sources/HTTPAPIServer.swift"
click node_media_pipeline "https://github.com/drawthingsai/draw-things-community/blob/main/Libraries/MediaGenerationKit/Sources/MediaGenerationPipeline.swift"
click node_remote_execution "https://github.com/drawthingsai/draw-things-community/blob/main/Libraries/MediaGenerationKit/Sources/MediaGenerationRemoteExecution.swift"
click node_image_generator "https://github.com/drawthingsai/draw-things-community/blob/main/Libraries/ImageGenerator/Sources/ImageGeneratorProtocol.swift"
click node_local_generator "https://github.com/drawthingsai/draw-things-community/blob/main/Libraries/LocalImageGenerator/Sources/LocalImageGenerator.swift"
click node_remote_generator "https://github.com/drawthingsai/draw-things-community/blob/main/Libraries/RemoteImageGenerator/Sources/RemoteImageGenerator.swift"
click node_model_zoo "https://github.com/drawthingsai/draw-things-community/blob/main/Libraries/ModelZoo/Sources/ModelZoo.swift"
click node_control_zoo "https://github.com/drawthingsai/draw-things-community/blob/main/Libraries/ModelZoo/Sources/ControlNetZoo.swift"
click node_textual_zoo "https://github.com/drawthingsai/draw-things-community/blob/main/Libraries/ModelZoo/Sources/TextualInversionZoo.swift"
click node_downloader "https://github.com/drawthingsai/draw-things-community/blob/main/Libraries/Downloader/Sources/ResumableDownloader.swift"
click node_model_import "https://github.com/drawthingsai/draw-things-community/blob/main/Libraries/ModelOp/Sources/Importer.swift"
click node_diffusion_models "https://github.com/drawthingsai/draw-things-community/blob/main/Libraries/SwiftDiffusion/Sources/Models/UNet.swift"
click node_lora "https://github.com/drawthingsai/draw-things-community/blob/main/Libraries/SwiftDiffusion/Sources/Models/LoRA.swift"
click node_float_type "https://github.com/drawthingsai/draw-things-community/blob/main/Libraries/SwiftDiffusion/Sources/FloatType.swift"
click node_trainer "https://github.com/drawthingsai/draw-things-community/blob/main/Libraries/Trainer/Sources/LoRATrainer.swift"
click node_history "https://github.com/drawthingsai/draw-things-community/blob/main/Libraries/History/Sources/ImageHistoryManager.swift"
click node_video_export "https://github.com/drawthingsai/draw-things-community/blob/main/Libraries/Exporter/Sources/VideoExporter.swift"

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_draw_cli,node_grpc_cli,node_http_api,node_cli_user toneBlue
class node_grpc_service,node_media_pipeline,node_remote_execution,node_image_generator,node_local_generator,node_remote_generator toneAmber
class node_model_zoo,node_control_zoo,node_textual_zoo,node_downloader,node_model_import toneMint
class node_diffusion_models,node_lora,node_float_type toneRose
class node_trainer,node_history,node_video_export,node_app_user toneIndigo
```

## Components

### User interfaces

- [Draw Things CLI](https://github.com/drawthingsai/draw-things-community/blob/main/Apps/DrawThingsCLI/DrawThingsCLI.swift): `Apps/DrawThingsCLI/DrawThingsCLI.swift`
- [gRPC server CLI](https://github.com/drawthingsai/draw-things-community/blob/main/Apps/gRPCServerCLI/gRPCServerCLI.swift): `Apps/gRPCServerCLI/gRPCServerCLI.swift`
- [HTTP API](https://github.com/drawthingsai/draw-things-community/blob/main/Libraries/HTTPAPIServer/Sources/HTTPAPIServer.swift): `Libraries/HTTPAPIServer/Sources/HTTPAPIServer.swift`

### Generation services

- [Image generation service](https://github.com/drawthingsai/draw-things-community/blob/main/Libraries/GRPC/Server/Sources/ImageGenerationServiceImpl.swift): `Libraries/GRPC/Server/Sources/ImageGenerationServiceImpl.swift`
- [Media generation pipeline](https://github.com/drawthingsai/draw-things-community/blob/main/Libraries/MediaGenerationKit/Sources/MediaGenerationPipeline.swift): `Libraries/MediaGenerationKit/Sources/MediaGenerationPipeline.swift`
- [Remote execution](https://github.com/drawthingsai/draw-things-community/blob/main/Libraries/MediaGenerationKit/Sources/MediaGenerationRemoteExecution.swift): `Libraries/MediaGenerationKit/Sources/MediaGenerationRemoteExecution.swift`
- [Generator protocol](https://github.com/drawthingsai/draw-things-community/blob/main/Libraries/ImageGenerator/Sources/ImageGeneratorProtocol.swift): `Libraries/ImageGenerator/Sources/ImageGeneratorProtocol.swift`
- [Local generator](https://github.com/drawthingsai/draw-things-community/blob/main/Libraries/LocalImageGenerator/Sources/LocalImageGenerator.swift): `Libraries/LocalImageGenerator/Sources/LocalImageGenerator.swift`
- [Remote generator](https://github.com/drawthingsai/draw-things-community/blob/main/Libraries/RemoteImageGenerator/Sources/RemoteImageGenerator.swift): `Libraries/RemoteImageGenerator/Sources/RemoteImageGenerator.swift`

### Models and assets

- [Model catalog](https://github.com/drawthingsai/draw-things-community/blob/main/Libraries/ModelZoo/Sources/ModelZoo.swift): `Libraries/ModelZoo/Sources/ModelZoo.swift`
- [ControlNet catalog](https://github.com/drawthingsai/draw-things-community/blob/main/Libraries/ModelZoo/Sources/ControlNetZoo.swift): `Libraries/ModelZoo/Sources/ControlNetZoo.swift`
- [Textual inversion catalog](https://github.com/drawthingsai/draw-things-community/blob/main/Libraries/ModelZoo/Sources/TextualInversionZoo.swift): `Libraries/ModelZoo/Sources/TextualInversionZoo.swift`
- [Model downloads](https://github.com/drawthingsai/draw-things-community/blob/main/Libraries/Downloader/Sources/ResumableDownloader.swift): `Libraries/Downloader/Sources/ResumableDownloader.swift`
- [Model importers](https://github.com/drawthingsai/draw-things-community/blob/main/Libraries/ModelOp/Sources/Importer.swift): `Libraries/ModelOp/Sources/Importer.swift`

### ML runtime

- [Diffusion models](https://github.com/drawthingsai/draw-things-community/blob/main/Libraries/SwiftDiffusion/Sources/Models/UNet.swift): `Libraries/SwiftDiffusion/Sources/Models/UNet.swift`
- [LoRA support](https://github.com/drawthingsai/draw-things-community/blob/main/Libraries/SwiftDiffusion/Sources/Models/LoRA.swift): `Libraries/SwiftDiffusion/Sources/Models/LoRA.swift`
- [Tensor precision](https://github.com/drawthingsai/draw-things-community/blob/main/Libraries/SwiftDiffusion/Sources/FloatType.swift): `Libraries/SwiftDiffusion/Sources/FloatType.swift`

### Product capabilities

- [LoRA trainer](https://github.com/drawthingsai/draw-things-community/blob/main/Libraries/Trainer/Sources/LoRATrainer.swift): `Libraries/Trainer/Sources/LoRATrainer.swift`
- [Image history](https://github.com/drawthingsai/draw-things-community/blob/main/Libraries/History/Sources/ImageHistoryManager.swift): `Libraries/History/Sources/ImageHistoryManager.swift`
- [Video export](https://github.com/drawthingsai/draw-things-community/blob/main/Libraries/Exporter/Sources/VideoExporter.swift): `Libraries/Exporter/Sources/VideoExporter.swift`

### Other components

- **CLI user**
- **Draw Things app**

## Connections

- CLI user → Draw Things CLI: runs (evidence: `README.md`)
- Draw Things CLI → Media generation pipeline: requests generation
- Draw Things app → gRPC server CLI: connects to (evidence: `README.md`)
- gRPC server CLI → Image generation service: hosts
- Image generation service → Model catalog: uses catalog (evidence: `Libraries/GRPC/Server/Sources/ImageGenerationServiceImpl.swift`)
- Media generation pipeline → Model catalog: resolves model (evidence: `Libraries/MediaGenerationKit/Sources/MediaGenerationPipeline.swift`)
- Media generation pipeline → Remote execution: dispatches remotely (evidence: `Libraries/MediaGenerationKit/Sources/MediaGenerationPipeline.swift`)
- Media generation pipeline → Generator protocol: uses generator interface
- Generator protocol → Local generator: implemented by
- Generator protocol → Remote generator: implemented by
- Model catalog → Diffusion models: maps model types (evidence: `Libraries/ModelZoo/Sources/ModelZoo.swift`)
- Model catalog → ControlNet catalog: catalogs controls
- Model catalog → Textual inversion catalog: catalogs embeddings (evidence: `Libraries/ModelZoo/Sources/TextualInversionZoo.swift`)
- Model downloads → Model catalog: downloads assets
- Model importers → Model catalog: registers imported assets
- Diffusion models → Tensor precision: uses precision
- LoRA support → Diffusion models: adapts models
- LoRA trainer → LoRA support: trains adapters
