Building "Sodalite," a Stable Diffusion Desktop App
There are many ways to generate images with Stable Diffusion, but Web UI-based tools tend to make setting up a Python environment and managing dependencies cumbersome.
Wanting something simpler—a desktop app that works right after downloading an installer—I built Sodalite from scratch.
GitHub: https://github.com/Himeyama/Sodalite
What is Sodalite
Sodalite is a Windows desktop app for image generation with Stable Diffusion.
Its distinguishing feature is that everything from the frontend to the backend was implemented in-house.
- Frontend: WinUI3 (.NET 9 / Windows App SDK)
- Backend: Python 3.13+ / FastAPI / diffusers (managed with uv)
- Communication: The frontend launches the backend as a local subprocess and communicates with it over HTTP
Main features
- Generate images from text (txt2img)
The safety checker is disabled, so NSFW image generation is also supported. Use and publication of generated content must comply with the license of the model used and the laws of the user's place of residence.
Installation
You can use it simply by downloading the latest EXE file from Releases.
Since this is an independently developed app, your browser may temporarily block the download. In that case, select "Save" from the "⋯" menu and keep the file after confirming the warning. For security reasons, the installer is built automatically via GitHub Actions.
Having the uv command installed beforehand is required.
uv installation: https://docs.astral.sh/uv/#installation
The installer is a user-level install that requires no administrator privileges, and is placed under %LOCALAPPDATA%\Programs\Sodalite\. The virtual environment (.venv) is not bundled; on first launch, the frontend runs uv sync to install dependencies such as torch. Since this involves a download of several gigabytes, it may take anywhere from a few minutes to tens of minutes.
The success or failure of setup is recorded along with the hash of uv.lock, and if setup fails, it is automatically retried on the next launch. Dependencies are also re-synced when they change with an app update.
On first launch, the default image generation model (stabilityai/sd-turbo) is automatically downloaded from Hugging Face.
GPU requirements
12 GiB or more of VRAM is recommended, though it works to some extent with 10 GiB.
Setup for developers
If you want to build and run from source, follow the steps below.
# Install backend dependencies
cd backend
uv sync
# Run from the root: syncs the backend, builds the frontend, and launches it all at once
./run.ps1
To verify the backend on its own:
cd backend
./run.ps1
# In a separate terminal
curl http://localhost:8000/api/v1/health
Run lint, formatting, and tests for the Python backend with:
cd backend
uv run ruff check --fix .
uv run ruff format .
uv run pytest
Build the frontend as follows:
cd frontend/Sodalite
dotnet build -c Debug
Coding conventions are documented in skills/python-coding/SKILL.md and skills/winui3-app/SKILL.md.
API overview
The backend provides a custom-designed REST API (/api/v1/*).
| Method | Path | Description |
|---|---|---|
| GET | /api/v1/health | Startup check, loaded model, and device info |
| GET | /api/v1/samplers | List of available samplers |
| POST | /api/v1/generations/text-to-image | txt2img generation |
Directory structure
Sodalite/
├── backend/ # Python backend (uv-managed, FastAPI + diffusers)
│ ├── src/sodalite_backend/
│ │ ├── main.py # FastAPI entry point
│ │ ├── config.py # Startup config (port, model ID)
│ │ ├── api/ # REST API endpoints
│ │ ├── schemas/ # Pydantic request/response models
│ │ ├── inference/ # diffusers pipeline management, samplers
│ │ └── imaging/ # PNG metadata embedding, image saving
│ └── tests/
├── frontend/Sodalite/ # WinUI3 frontend
│ ├── MainWindow.xaml(.cs) # Backend launch, navigation
│ ├── Views/GenerationPage # Prompt input, generation, image display
│ ├── ViewModels/ # GenerationViewModel
│ └── Services/ # BackendProcessManager, BackendApiClient
├── docs/ # Setup notes and other documentation
├── skills/ # Development conventions (winui3-app, python-coding)
├── run.ps1 # App launch script (root)
└── CLAUDE.md
There wasn't much documentation available on combining WinUI3 with a Python backend, so it took some trial and error, but I settled on the approach of launching it as a local subprocess and synchronizing via health checks.
Disclaimer
This app is a tool for running image generation models, and the author bears no responsibility whatsoever for the content, use, or publication of generated images. Use of generated content is entirely the user's own responsibility.
Generated images are subject to the license of the model used (the terms of use, prohibitions, etc. described in the model card). Whether commercial use, redistribution, or NSFW expression is permitted varies by model, so be sure to check the license terms of the model used before use.
Additionally, generated images may resemble or infringe upon the rights of existing copyrighted works, trademarks, or portraits, depending on the prompt or training data. When publishing, distributing, or commercially using generated content, users must check and judge for themselves that they are not infringing on third-party rights such as copyright, trademark, or publicity rights.
Generating images that imitate or evoke existing characters or other IP (intellectual property) from anime, games, movies, and so on may also constitute copyright or trademark infringement. In particular, commercial use, secondary distribution, or sexual expression not authorized by the IP rights holder may constitute rights infringement or violate terms of service, so users must judge this at their own responsibility.
Generating or using images depicting real people (impersonation, defamation, unauthorized use in a sexual context, etc.) may violate the laws of the user's place of residence or platform terms of service. Compliance with laws and terms of service is the user's responsibility.
Generating, possessing, or distributing content regulated by law is strictly prohibited.
Summary
Sodalite is a desktop app born from the desire to use Stable Diffusion easily in a local environment.
By connecting WinUI3 and a Python backend via a local subprocess, it avoids the environment setup complexity common to Web UI-based tools while delivering the usability of a native app.
If you're interested, give it a try by downloading it from Releases.
If it doesn't work, please open an Issue.
Loading...