Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

One-click ComfyUI install from within the app

PurpleDoubleDad2dc7ba509f
diff --git a/README.md b/README.md
index acb9bca7..2927e962 100644
--- a/README.md
+++ b/README.md
@@ -114,14 +114,16 @@ npm run dev
Open **http://localhost:5173** — the app recommends models on first launch.
-### Image/Video Generation (Optional)
+### Image & Video Generation
-1. Install [ComfyUI](https://github.com/comfyanonymous/ComfyUI) anywhere on your system
-2. Open the **Create** tab in the app — it will auto-detect ComfyUI or ask you to enter the path
-3. Go to **Model Manager → Discover → Image/Video** and click **Install All** on any bundle
-4. That's it — models are downloaded directly into the right ComfyUI folders
+No separate installation needed! When you open the **Create** tab:
-No manual `.env` editing needed. The app handles everything.
+1. The app checks for ComfyUI automatically
+2. If not found, click **"Install ComfyUI Automatically"** — it clones, installs dependencies, and sets up CUDA in one click
+3. Go to **Model Manager → Discover → Image/Video** and click **Install All** on any model bundle
+4. Generate images and videos — everything is ready
+
+The entire setup happens inside the app. No terminal commands, no manual config files.
### One-Click Start (Windows)
diff --git a/src/components/create/CreateView.tsx b/src/components/create/CreateView.tsx
index fd193418..970fbecb 100644
--- a/src/components/create/CreateView.tsx
+++ b/src/components/create/CreateView.tsx
@@ -30,6 +30,10 @@ export function CreateView() {
const [comfyPathInput, setComfyPathInput] = useState('')
const [pathSaving, setPathSaving] = useState(false)
const [pathError, setPathError] = useState('')
+ const [installing, setInstalling] = useState(false)
+ const [installLogs, setInstallLogs] = useState<string[]>([])
+ const [installError, setInstallError] = useState('')
+ const installPollRef = useRef<ReturnType<typeof setInterval> | null>(null)
const pollRef = useRef<ReturnType<typeof setInterval> | null>(null)
const pollIdRef = useRef(0) // prevent duplicate polling
@@ -96,7 +100,7 @@ export function CreateView() {
return (
<div className="h-full flex flex-col">
{/* Status: ComfyUI not found — setup wizard */}
- {notFound && (
+ {notFound && !installing && (
<div className="border-b border-red-200 dark:border-red-500/20">
<div className="p-4 bg-red-50 dark:bg-red-500/5 space-y-3">
<div className="flex items-center gap-2 text-red-600 dark:text-red-400 text-sm font-medium">
@@ -104,65 +108,120 @@ export function CreateView() {
ComfyUI not found — required for image & video generation
</div>
- <div className="bg-white dark:bg-[#2a2a2a] rounded-lg p-4 space-y-3 border border-gray-200 dark:border-white/10">
- <p className="text-xs text-gray-500">Option 1: Enter your ComfyUI path</p>
- <div className="flex gap-2">
- <div className="flex-1 relative">
- <FolderOpen size={14} className="absolute left-3 top-1/2 -translate-y-1/2 text-gray-400" />
- <input
- value={comfyPathInput}
- onChange={(e) => { setComfyPathInput(e.target.value); setPathError('') }}
- placeholder="C:\Users\you\ComfyUI"
- className="w-full pl-9 pr-3 py-2 rounded-lg bg-gray-100 dark:bg-white/5 border border-gray-200 dark:border-white/10 text-sm text-gray-900 dark:text-white placeholder-gray-400 focus:outline-none focus:border-blue-500"
- />
- </div>
+ <div className="bg-white dark:bg-[#2a2a2a] rounded-lg p-4 space-y-4 border border-gray-200 dark:border-white/10">
+ {/* Option 1: Auto-install */}
+ <div>
+ <p className="text-xs text-gray-500 mb-2">Option 1: Automatic install (recommended)</p>
<button
onClick={async () => {
- if (!comfyPathInput.trim()) { setPathError('Enter a path'); return }
- setPathSaving(true)
- setPathError('')
+ setInstalling(true)
+ setInstallError('')
+ setInstallLogs([])
try {
- const res = await fetch('/local-api/set-comfyui-path', {
- method: 'POST',
- headers: { 'Content-Type': 'application/json' },
- body: JSON.stringify({ path: comfyPathInput.trim() }),
- })
- const data = await res.json()
- if (data.status === 'ok') {
- // Trigger reconnect
- setTimeout(() => pollStatus(), 2000)
- } else {
- setPathError(data.error || 'Invalid path')
- }
+ await fetch('/local-api/install-comfyui', { method: 'POST' })
+ // Poll install progress
+ installPollRef.current = setInterval(async () => {
+ try {
+ const res = await fetch('/local-api/install-comfyui')
+ const data = await res.json()
+ setInstallLogs(data.logs || [])
+ if (data.status === 'complete') {
+ if (installPollRef.current) clearInterval(installPollRef.current)
+ installPollRef.current = null
+ setInstalling(false)
+ setTimeout(() => pollStatus(), 2000)
+ } else if (data.status === 'error') {
+ if (installPollRef.current) clearInterval(installPollRef.current)
+ installPollRef.current = null
+ setInstallError(data.error || 'Installation failed')
+ setInstalling(false)
+ }
+ } catch { /* keep polling */ }
+ }, 2000)
} catch {
- setPathError('Failed to save path')
+ setInstallError('Failed to start installation')
+ setInstalling(false)
}
- setPathSaving(false)
}}
- disabled={pathSaving}
- className="px-4 py-2 rounded-lg bg-blue-600 hover:bg-blue-700 disabled:opacity-50 text-white text-sm font-medium transition-colors shrink-0"
+ className="flex items-center gap-2 px-4 py-2 rounded-lg bg-green-600 hover:bg-green-700 text-white text-sm font-medium transition-colors"
>
- {pathSaving ? <Loader2 size={14} className="animate-spin" /> : 'Save & Connect'}
+ <Download size={16} /> Install ComfyUI Automatically
</button>
+ <p className="text-[10px] text-gray-400 mt-1">Clones ComfyUI, installs Python dependencies, and sets up CUDA. Takes 5-10 minutes.</p>
</div>
- {pathError && <p className="text-xs text-red-500">{pathError}</p>}
+ {/* Option 2: Manual path */}
<div className="border-t border-gray-200 dark:border-white/5 pt-3">
- <p className="text-xs text-gray-500 mb-2">Option 2: Install ComfyUI first</p>
- <a
- href="https://github.com/comfyanonymous/ComfyUI"
- target="_blank"
- rel="noopener noreferrer"
- className="inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg bg-gray-100 dark:bg-white/5 hover:bg-gray-200 dark:hover:bg-white/10 text-gray-700 dark:text-gray-300 text-xs transition-colors"
- >
- <ExternalLink size={12} /> Install ComfyUI from GitHub
- </a>
+ <p className="text-xs text-gray-500 mb-2">Option 2: Already have ComfyUI? Enter the path</p>
+ <div className="flex gap-2">
+ <div className="flex-1 relative">
+ <FolderOpen size={14} className="absolute left-3 top-1/2 -translate-y-1/2 text-gray-400" />
+ <input
+ value={comfyPathInput}
+ onChange={(e) => { setComfyPathInput(e.target.value); setPathError('') }}
+ placeholder="C:\Users\you\ComfyUI"
+ className="w-full pl-9 pr-3 py-2 rounded-lg bg-gray-100 dark:bg-white/5 border border-gray-200 dark:border-white/10 text-sm text-gray-900 dark:text-white placeholder-gray-400 focus:outline-none focus:border-blue-500"
+ />
+ </div>
+ <button
+ onClick={async () => {
+ if (!comfyPathInput.trim()) { setPathError('Enter a path'); return }
+ setPathSaving(true)
+ setPathError('')
+ try {
+ const res = await fetch('/local-api/set-comfyui-path', {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({ path: comfyPathInput.trim() }),
+ })
+ const data = await res.json()
+ if (data.status === 'ok') {
+ setTimeout(() => pollStatus(), 2000)
+ } else {
+ setPathError(data.error || 'Invalid path')
+ }
+ } catch {
+ setPathError('Failed to save path')
+ }
+ setPathSaving(false)
+ }}
+ disabled={pathSaving}
+ className="px-4 py-2 rounded-lg bg-blue-600 hover:bg-blue-700 disabled:opacity-50 text-white text-sm font-medium transition-colors shrink-0"
+ >
+ {pathSaving ? <Loader2 size={14} className="animate-spin" /> : 'Connect'}
+ </button>
+ </div>
+ {pathError && <p className="text-xs text-red-500 mt-1">{pathError}</p>}
</div>
</div>
</div>
</div>
)}
+ {/* ComfyUI installing */}
+ {installing && (
+ <div className="border-b border-blue-200 dark:border-blue-500/20">
+ <div className="p-4 bg-blue-50 dark:bg-blue-500/5 space-y-3">
+ <div className="flex items-center gap-2 text-blue-600 dark:text-blue-400 text-sm font-medium">
+ <Loader2 size={16} className="animate-spin" />
+ Installing ComfyUI... This takes 5-10 minutes.
+ </div>
+ {installLogs.length > 0 && (
+ <div className="bg-gray-900 rounded-lg p-3 max-h-40 overflow-y-auto font-mono text-xs text-gray-400">
+ {installLogs.slice(-15).map((log, i) => (
+ <div key={i} className="truncate">{log}</div>
+ ))}
+ </div>
+ )}
+ {installError && (
+ <div className="flex items-center gap-2 text-red-500 text-xs">
+ <AlertTriangle size={14} /> {installError}
+ </div>
+ )}
+ </div>
+ </div>
+ )}
+
{/* Status: ComfyUI is starting */}
{isStarting && !connected && (
<div className="border-b border-yellow-200 dark:border-yellow-500/20" role="status">
diff --git a/vite.config.ts b/vite.config.ts
index 05498165..7c881a5d 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -350,6 +350,136 @@ function comfyLauncher(): Plugin {
})
})
+ // API: Install ComfyUI from scratch
+ const installLogs: string[] = []
+ let installStatus: 'idle' | 'installing' | 'complete' | 'error' = 'idle'
+ let installError = ''
+
+ server.middlewares.use('/local-api/install-comfyui', (req, res) => {
+ if (req.method === 'GET') {
+ // Return install status
+ res.writeHead(200, { 'Content-Type': 'application/json' })
+ res.end(JSON.stringify({ status: installStatus, error: installError, logs: installLogs.slice(-30) }))
+ return
+ }
+ if (req.method !== 'POST') { res.writeHead(405); res.end(); return }
+
+ if (installStatus === 'installing') {
+ res.writeHead(200, { 'Content-Type': 'application/json' })
+ res.end(JSON.stringify({ status: 'already_installing' }))
+ return
+ }
+
+ // Check Python is available
+ try {
+ execSync('python --version', { stdio: 'ignore' })
+ } catch {
+ res.writeHead(200, { 'Content-Type': 'application/json' })
+ res.end(JSON.stringify({ status: 'error', error: 'Python not found. Install Python 3.10+ from python.org first.' }))
+ return
+ }
+
+ installStatus = 'installing'
+ installError = ''
+ installLogs.length = 0
+
+ const home = process.env.USERPROFILE || process.env.HOME || ''
+ const installDir = join(home, 'ComfyUI')
+
+ const log = (msg: string) => {
+ installLogs.push(msg)
+ if (installLogs.length > 200) installLogs.shift()
+ console.log(`[ComfyUI Install] ${msg}`)
+ }
+
+ res.writeHead(200, { 'Content-Type': 'application/json' })
+ res.end(JSON.stringify({ status: 'started', path: installDir }))
+
+ // Run installation in background
+ ;(async () => {
+ try {
+ // Step 1: Clone
+ if (!existsSync(installDir)) {
+ log('Cloning ComfyUI from GitHub...')
+ const clone = spawn('git', ['clone', 'https://github.com/comfyanonymous/ComfyUI.git', installDir], { shell: true, stdio: ['ignore', 'pipe', 'pipe'] })
+ clone.stdout?.on('data', (d) => log(d.toString().trim()))
+ clone.stderr?.on('data', (d) => log(d.toString().trim()))
+ await new Promise<void>((resolve, reject) => {
+ clone.on('exit', (code) => code === 0 ? resolve() : reject(new Error(`git clone failed (exit ${code})`)))
+ })
+ log('Clone complete.')
+ } else if (existsSync(join(installDir, 'main.py'))) {
+ log('ComfyUI directory already exists, skipping clone.')
+ } else {
+ throw new Error(`${installDir} exists but is not ComfyUI. Delete it or choose another location.`)
+ }
+
+ // Step 2: Install Python dependencies
+ log('Installing Python dependencies (this may take several minutes)...')
+ const pip = spawn('pip', ['install', '-r', 'requirements.txt'], { cwd: installDir, shell: true, stdio: ['ignore', 'pipe', 'pipe'] })
+ pip.stdout?.on('data', (d) => {
+ const lines = d.toString().split('\n').filter((l: string) => l.trim())
+ lines.forEach((l: string) => log(l.trim()))
+ })
+ pip.stderr?.on('data', (d) => {
+ const lines = d.toString().split('\n').filter((l: string) => l.trim())
+ lines.forEach((l: string) => log(l.trim()))
+ })
+ await new Promise<void>((resolve, reject) => {
+ pip.on('exit', (code) => code === 0 ? resolve() : reject(new Error(`pip install failed (exit ${code})`)))
+ })
+ log('Dependencies installed.')
+
+ // Step 3: Install PyTorch with CUDA (if NVIDIA GPU detected)
+ log('Checking for NVIDIA GPU...')
+ let hasNvidia = false
+ try {
+ execSync('nvidia-smi', { stdio: 'ignore' })
+ hasNvidia = true
+ } catch { /* no nvidia */ }
+
+ if (hasNvidia) {
+ log('NVIDIA GPU found. Installing PyTorch with CUDA support...')
+ const torch = spawn('pip', ['install', 'torch', 'torchvision', 'torchaudio', '--index-url', 'https://download.pytorch.org/whl/cu121'], { cwd: installDir, shell: true, stdio: ['ignore', 'pipe', 'pipe'] })
+ torch.stdout?.on('data', (d) => log(d.toString().trim()))
+ torch.stderr?.on('data', (d) => log(d.toString().trim()))
+ await new Promise<void>((resolve, reject) => {
+ torch.on('exit', (code) => code === 0 ? resolve() : reject(new Error(`PyTorch CUDA install failed (exit ${code})`)))
+ })
+ log('PyTorch with CUDA installed.')
+ } else {
+ log('No NVIDIA GPU — using CPU PyTorch (already in requirements).')
+ }
+
+ // Step 4: Save path to .env
+ const envPath = resolve(__dirname, '.env')
+ const { writeFileSync, readFileSync } = require('fs')
+ let envContent = ''
+ try { envContent = readFileSync(envPath, 'utf8') } catch { /* no .env */ }
+ if (envContent.includes('COMFYUI_PATH=')) {
+ envContent = envContent.replace(/COMFYUI_PATH=.*/g, `COMFYUI_PATH=${installDir}`)
+ } else {
+ envContent += `${envContent.endsWith('\n') ? '' : '\n'}COMFYUI_PATH=${installDir}\n`
+ }
+ writeFileSync(envPath, envContent, 'utf8')
+ process.env.COMFYUI_PATH = installDir
+ log(`Path saved to .env: ${installDir}`)
+
+ // Step 5: Start ComfyUI
+ log('Starting ComfyUI...')
+ startComfy(installDir)
+ log('ComfyUI started! You can now download models and generate images/videos.')
+
+ installStatus = 'complete'
+ } catch (err) {
+ const msg = err instanceof Error ? err.message : String(err)
+ log(`ERROR: ${msg}`)
+ installError = msg
+ installStatus = 'error'
+ }
+ })()
+ })
+
// API: Status + logs
server.middlewares.use('/local-api/comfyui-status', async (_req, res) => {
let running = false