ComfyUI Desktop (@comfyorg/comfyui-electron) is an Electron-based desktop application that packages ComfyUI with a user-friendly interface. It's "the best modular GUI to run AI diffusion models" and automatically handles Python environment setup, dependency management, and provides a seamless desktop experience for running AI models.
- Homepage: https://comfy.org
- Electron: Desktop app framework
- TypeScript: Primary language
- Vite: Build tool and bundler
- Node.js: Runtime (use nvm)
- Yarn: Package manager
- Vitest: Unit testing
- Playwright: E2E testing
- ESLint: Linting
- Prettier: Formatting
yarn lint # Check & auto-fix ESLint issues
yarn format # Auto-format code
yarn typecheck # TypeScript type checking (all)yarn start # Build and launch app with file watching
yarn make:assets # Download ComfyUI dependencies
yarn clean # Remove build artifactsyarn test:unit # Run unit tests (Vitest)
yarn test:e2e # Run E2E tests (Playwright)
yarn test:e2e:update # Update Playwright snapshotsyarn make # Build platform package
yarn make:nvidia # Build with NVIDIA GPU support
yarn vite:compile # Compile with Vite- If you encounter errors regarding
NODE_MODULE_VERSION, try runningnpx electron-rebuildbefore other troubleshooting steps.- If that still fails, try
yarn rebuild
- If that still fails, try
We have testing configured with Vitest. Use vitest to create any tests you need. Do not attempt to custom code your own testing infrastructure, as that is pointless and will do nothing but derail you.
main.ts: Main Electron process entry pointdesktopApp.ts: Core application logicpreload.ts: Electron preload scriptmain-process/: Main process modulescomfyDesktopApp.ts- ComfyUI server managementappWindow.ts- Window managementcomfyServer.ts- Server lifecycle
install/: Installation & setup logichandlers/: IPC message handlersservices/: Core services (telemetry, Sentry)config/: Configuration managementstore/: Persistent storageutils.ts: Utility functions
unit/: Vitest-based component testsintegration/: Playwright E2E testsinstall/- Fresh installation testingpost-install/- Tests after app setupshared/- Common test functionality
- Python 3.12+ with virtual environment support required
- Node.js v20.x (use nvm for version management)
- Visual Studio 2019+ with C++ workload (Windows)
- Spectre-mitigated libraries for node-gyp compilation
package.json: Defines ComfyUI versions and dependenciesassets/requirements/: Pre-compiled Python requirements by platformtodesktop.json: Cloud build and distribution configbuilder-debug.config.ts: Local development build settings- Multi-config Vite setup with separate configs for main, preload, and types
The app packages these components:
- ComfyUI: AI diffusion model GUI
- ComfyUI_frontend: Modern web frontend
- ComfyUI-Manager: Plugin/extension manager
- uv: Fast Python package manager
--dev-mode: Flag for packaged apps in developmentCOMFY_HOST/COMFY_PORT: External server for developmentVUE_DEVTOOLS_PATH: Frontend debugging support
- Windows:
%APPDATA%\ComfyUI(config),%LOCALAPPDATA%\Programs\ComfyUI(app) - macOS:
~/Library/Application Support/ComfyUI - Linux:
~/.config/ComfyUI
- Follow existing TypeScript patterns in the codebase
- Use ESLint and Prettier for code formatting
- Maintain clean separation between main process, renderer, and preload scripts
- Follow Electron security best practices
- Use the existing store patterns for configuration management
- Test changes with both unit tests (Vitest) and E2E tests (Playwright)
- Use JSDoc format to write documentation for methods
- Common tags are
@param, and@return(do not use forvoidreturn type) - Use
{@link }to reference symbols
- Common tags are
This project must maintain exceptionally high type standards. The any type must not be used. unknown can be used when the type is unknown.
unknownmeans "I do not know what the type is".anymeans "I do not care what the type is".
- Use
yarn formatto ensure consistent formatting - Run
yarn lintandyarn typecheckto check code quality - Run
yarn test:unitto ensure unit tests pass - Consider running
yarn test:e2efor UI changes
This is a sophisticated Electron application with comprehensive testing, automated CI/CD, cross-platform support, and professional development practices.