Skip to content

LocalLLMServerManager — System Architecture & Component Design

v3.11.0 Architecture Specification & Mermaid Diagrams

This document provides a visual and structural blueprint of LocalLLMServerManager, detailing its component decomposition, MVVM hierarchy, Minimal API route modules, Dependency Injection lifecycle, Model Context Protocol (MCP) Multimodal AI integration, VRAM orchestration flow, Modular Feature Pack management, WebAssembly static asset pipeline, Playwright E2E testing layer, and Docker containerization architecture.


🏛️ High-Level System Architecture


🧱 SOLID MVVM Control & ViewModel Hierarchy

The UI layer is structured into single-responsibility Avalonia UserControls and matching child ObservableObject ViewModels.


🔄 VRAM Orchestration & Engine Switch Sequence

When a user or external client requests an Image Generation or 3D Mesh job while an LLM model is consuming GPU VRAM, the VramOrchestrator automatically frees VRAM to prevent Out-Of-Memory (OOM) crashes.


🛠️ Interface & Service Mapping Matrix

InterfaceImplementationLifetimeResponsibility
IAiEngineManagerAiEngineManagerSingletonSpawns, monitors, and terminates ComfyUI & Forge process trees via Win32 Job Objects
IToolDiscoveryServiceToolDiscoveryServiceSingletonScans system drives and PATH to detect Ollama, ComfyUI, and SD Forge; validates paths
IGitUpdateServiceGitUpdateServiceSingletonValidates branch names, executes git fetch, git checkout, and git pull
IGpuTelemetryProviderGpuTelemetryProviderSingletonQueries hardware VRAM via nvidia-smi CLI, Linux /proc/meminfo, or Windows Registry scoring
ISettingsServiceSettingsServiceSingletonHandles thread-safe JSON serialization for settings.json
ITelemetryServiceTelemetryServiceSingletonQueries /api/gpu/vram and engine health endpoints for UI ViewModels
IOllamaModelServiceOllamaModelServiceSingletonLoads installed models, capabilities, and executes VRAM unload API calls
IHuggingFaceSearchServiceHuggingFaceSearchServiceSingletonQueries Hugging Face Hub API for GGUF model repositories and quantization files
ICivitaiSearchServiceCivitaiSearchServiceSingletonQueries CivitAI REST API for Stable Diffusion checkpoints, LoRAs, and ratings
LocalLlmMcpToolsLocalLlmMcpToolsScoped / MCPImplements 8 standard Model Context Protocol tools for AI agent automation
IContentTypeProviderFileExtensionContentTypeProviderSingletonConfigures WASM MIME mapping (.wasm, .dat, .json) for static file hosting
IBrowser / IPagePlaywrightWasmE2ETests / PlaywrightScreenshotGeneratorTest LifecycleHeadless Chromium automation for E2E integration testing and screenshot generation
Container OrchestrationDockerfile / docker-compose.ymlContainer RuntimeMulti-stage Docker packaging, port mapping (5246), and volume mounting
Installer & LifecycleInno Setup / PowerShell / BashInstall RuntimeManages pre-stop of active processes, non-destructive config upgrades, and post-update restarts

🎯 Architecture-to-Requirements Mapping

Each architectural subsystem maps directly to standardized requirement specifications defined in Software Requirements Specification & RTM and verified in Test Coverage Specification:

Architecture LayerSubsystem / ComponentRequirement DomainKey Requirement IDs
Host & MiddlewareASP.NET Core Kestrel Host, YARP Proxy, SettingsCore InfrastructureCORE-001 .. CORE-008
LLM ManagementOllama Model Service, KV Cache CalculatorLLM & OllamaLLM-001 .. LLM-008
Model HubsHugging Face Hub Service, CivitAI ServiceModel RepositoriesHUB-001 .. HUB-003, DIFF-001 .. DIFF-005
3D & StudioComfyUI Proxy, 3D Mesh Studio, WebGL Viewer3D Generation3D-001 .. 3D-006
Hardware & MemoryGPU Telemetry Provider, VRAM OrchestratorTelemetry & MemoryVRAM-001 .. VRAM-005
AI Assistant APIModel Context Protocol Streamable HTTP & SSEMCP IntegrationMCP-001 .. MCP-004
Installer & LifecycleInno Setup, PowerShell & Linux InstallersInstaller & UpgradesINST-001 .. INST-004
Tool DiscoveryMulti-Drive Scanner & Path ValidationTool DiscoveryDISC-001 .. DISC-005
Desktop & Web UIAvalonia XAML Controls, MVVM Layer, WASM AppUser InterfaceUI-001 .. UI-004, WASM-001 .. WASM-003
Quality & AutomationPlaywright Harness, Screenshot GeneratorTest & AutomationE2E-001 .. E2E-003

Released under the MIT License.