Skip to content

ComfyAssets/Kiko-Creator

Repository files navigation

🎨 Kiko Creator

A modern, web-based AI image generation interface for ComfyUI with character selection, real-time progress tracking, and gallery management.

Kiko Creator License ComfyUI

🌟 Features

Core Functionality

  • 🎨 Real-Time Generation: WebSocket-based progress tracking with live step updates
  • πŸ‘€ Character Selection: Browse and search 5328+ anime characters with thumbnails
  • 🎯 Smart Model Management: Auto-sync checkpoints and LoRAs from ComfyUI
  • πŸ–ΌοΈ Gallery System: Persistent gallery with favorites, batch operations, and metadata
  • πŸ“± Responsive Design: Mobile-first UI with touch-optimized controls
  • πŸŒ™ Dark Mode: Beautiful dark theme optimized for extended use

Character System

  • 5328+ Characters: Pre-loaded character database from WAI dataset
  • Custom Characters: Create and manage your own custom characters with images
  • Smart Search: Real-time search with fuzzy matching
  • Infinite Scroll: Smooth browsing with virtual scrolling
  • Thumbnail Gallery: Character previews with metadata
  • Right-Click Menu: Quick actions (send to prompt, delete, edit)

Generation Features

  • Advanced Settings: Steps, CFG, sampler, scheduler, resolution presets
  • πŸ’Ύ Preset System: Save and load complete generation settings
    • Save Presets: Capture all settings (checkpoint, prompts, LoRAs, steps, CFG, resolution, CLIP skip, hires fix, refiner)
    • Searchable Dropdown: Quick access with search and favorites (⭐)
    • One-Click Apply: Instantly restore your favorite configurations
    • Persistent Storage: Presets saved locally and sync across sessions
  • 🎨 CLIP Skip: Control text encoder layer selection
    • Range from -1 (last layer) to -12 (12th layer from end)
    • Default -2 (SDXL standard) for optimal quality
    • Fine-tune how the AI interprets your prompts
    • Saved with presets for consistent results
  • LoRA Management: Drag-and-drop LoRA slots with strength controls
  • 🎯 LoRA Trigger Words: Active trigger words displayed beneath prompt as clickable tags
    • Click individual tags to add to prompt
    • "Add All" button for quick insertion
    • Automatically reads from LoRA Manager .metadata.json and safetensors metadata
    • Shows combined trigger words from all selected LoRAs
  • Tag Autocomplete: Danbooru/E621 tag suggestions (ready for integration)
  • Wildcard Support: Random prompt generation from text files
  • View Tags: Angle, camera, background, and style tags
  • Batch Generation: Generate multiple images at once
  • Seed Control: Random or fixed seeds with manual override
  • Real-Time Progress: WebSocket connection shows actual step progress

Gallery & Organization

  • Persistent Storage: Images saved with full metadata in localStorage
  • Grid View: Adjustable 2-6 column layouts
  • Lightbox: Fullscreen viewer with keyboard navigation (ESC, arrows)
  • Favorites: Star important generations
  • Batch Operations: Multi-select for download/delete
  • Metadata Display: View all generation parameters

Models Management

  • Checkpoint Browser: View all available checkpoints with thumbnails
  • LoRA Browser: Browse LoRA library with metadata
  • CivitAI Integration: 🌐 Globe links to CivitAI model pages (uses LoRA Manager metadata)
  • πŸ”„ Model Re-scanning: One-click re-scan to discover new models and update metadata
    • Professional modal UI with loading/success/error states
    • Shows detailed statistics (checkpoints, LoRAs, embeddings, cached count, duration)
    • Automatically reloads trigger words and metadata after scan
    • Preserves previous scan settings (YAML path, CivitAI integration)
  • Quick Send: One-click send models to generation page
  • Folder Organization: Models grouped by directory structure
  • Auto-Sync: Real-time model list from ComfyUI API
  • Extra Model Paths: Automatically discovers models from extra_model_paths.yaml
  • Database Management: Vacuum, optimize, and backup database operations

πŸ“‹ Prerequisites

Required

  • Node.js 18+ (with npm)
  • ComfyUI with ComfyUI_Mira v0.4.9.2+
  • Python 3.10+ (for ComfyUI)

Optional (Recommended)

πŸš€ Installation

1. Clone the Repository

git clone git clone https://github.com/yourusername/kiko-creator.git
cd kiko-creator

2. Install Dependencies

# Install frontend dependencies
npm install

# Install backend dependencies
cd server
npm install
cd ..

3. Configure Environment

Create a .env file in the root directory:

# Frontend Environment Variables
VITE_API_URL=http://localhost:3001

# ComfyUI API URL
# For local ComfyUI:
VITE_COMFYUI_URL=http://127.0.0.1:8188

# For remote ComfyUI with HTTPS:
# VITE_COMFYUI_URL=https://your-comfyui-server.com

Create a server/.env file:

# Backend Environment Variables
PORT=3001
COMFYUI_API_URL=http://127.0.0.1:8188

# Optional: For CivitAI metadata and extra model paths support
# Requires ComfyUI-LoRA-Manager for enhanced metadata extraction
COMFYUI_MODELS_PATH=/path/to/ComfyUI/models
COMFYUI_DIR=/path/to/ComfyUI

4. Start the Application

# Development mode (frontend only - backend runs separately)
npm run dev

# In another terminal, start the backend:
cd server
npm run dev

# Or use convenience scripts:
./start.sh     # Start both servers in background
./status.sh    # Check server status
./stop.sh      # Stop all servers

5. Access the Application

Open your browser to http://localhost:5173

πŸ”§ ComfyUI Setup

Required Custom Nodes

  1. ComfyUI_Mira (v0.4.9.2 or higher)

    cd ComfyUI/custom_nodes
    git clone https://github.com/mirabarukaso/ComfyUI_Mira.git
  2. Install Dependencies

    cd ComfyUI_Mira
    pip install -r requirements.txt
  3. Enable DEV Mode in ComfyUI settings

Optional: CivitAI Metadata Support

For enhanced CivitAI integration with 🌐 globe links to model pages:

  1. Install ComfyUI-LoRA-Manager (recommended)

    cd ComfyUI/custom_nodes
    git clone https://github.com/willmiao/ComfyUI-Lora-Manager.git
  2. How it works:

    • Kiko Creator reads metadata from LoRA Manager's .metadata.json files
    • When you download models via LoRA Manager, it stores CivitAI model IDs
    • Globe icons (🌐) appear next to models with CivitAI metadata
    • Click the globe to view model details on CivitAI
  3. Configuration:

    • Set COMFYUI_MODELS_PATH in server/.env to enable metadata reading
    • Set COMFYUI_DIR to parse ComfyUI's extra_model_paths.yaml
    • Works for checkpoints, LoRAs, and embeddings

Workflow Configuration

Kiko Creator generates ComfyUI workflows programmatically. The workflow builder supports:

  • Text-to-Image: Standard SD/SDXL generation
  • LoRA Integration: Multi-LoRA support with strength controls
  • Hires Fix: Upscaling with customizable denoise
  • Refiner Support: SDXL refiner integration
  • Custom Resolutions: SDXL presets and custom sizes

The workflow is built in server/services/workflowBuilder.js and follows ComfyUI_Mira's node structure.

Example Workflow Nodes

The generated workflow includes these key nodes:

  • KikoPromptNode: Prompt processing with character injection
  • CheckpointLoaderSimple: Model loading
  • LoraLoader: LoRA application (multiple chained)
  • KSampler: Generation with progress tracking
  • VAEDecode: Latent to image conversion
  • SaveImage: Output with metadata

🌐 Remote ComfyUI Setup

WebSocket Requirements

Important: If you're running ComfyUI on a remote server and need WebSocket support for real-time progress tracking, the WebSocket connection must originate from localhost due to browser security policies.

Option 1: Using socat (Linux/Mac)

Create a local proxy that forwards WebSocket connections to your remote ComfyUI:

# Install socat
sudo apt-get install socat  # Ubuntu/Debian
brew install socat          # macOS

# Create WebSocket proxy (replace with your remote IP/domain)
socat TCP-LISTEN:8188,bind=127.0.0.1,fork TCP:10.0.140.30:8188

# Or for a remote domain:
socat TCP-LISTEN:8188,bind=127.0.0.1,fork TCP:comfy.yourdomain.com:443

This creates a local proxy at 127.0.0.1:8188 that forwards all traffic to your remote ComfyUI server.

Then configure your .env:

VITE_COMFYUI_URL=http://127.0.0.1:8188

Option 2: Using SSH Tunnel

# Forward remote ComfyUI to localhost
ssh -L 8188:localhost:8188 user@remote-comfyui-server

# Keep this terminal open while using Kiko Creator

Then configure your .env:

VITE_COMFYUI_URL=http://127.0.0.1:8188

Option 3: Nginx Reverse Proxy with SSL

If you control the remote server, set up Nginx to handle both HTTP and WebSocket with SSL:

server {
    listen 443 ssl http2;
    server_name comfy.yourdomain.com;

    ssl_certificate /path/to/cert.pem;
    ssl_certificate_key /path/to/key.pem;

    location / {
        proxy_pass http://localhost:8188;
        proxy_http_version 1.1;

        # WebSocket support
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";

        # Standard proxy headers
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;

        # Timeout settings for long-running generations
        proxy_read_timeout 600s;
        proxy_send_timeout 600s;
    }
}

Then configure your .env:

VITE_COMFYUI_URL=https://comfy.yourdomain.com

Why is this needed?

Modern browsers enforce Mixed Content Policy and Content Security Policy (CSP):

  • If your app is served over http://, WebSocket connections must use ws://
  • If your app is served over https://, WebSocket connections must use wss://
  • The WebSocket connection must be to an allowed origin in the CSP

By proxying through localhost or using proper SSL, you ensure the WebSocket connection meets these security requirements.

🐍 Python Helper Setup (Optional but Recommended)

Kiko Creator includes an optional Python helper for robust safetensors metadata reading. The app works perfectly without Python using a JavaScript fallback, but the Python helper provides better compatibility with large model files and edge cases.

Why Use Python Helper?

With Python Helper:

  • βœ… Uses the official safetensors library (same as ComfyUI)
  • βœ… Handles all format variations and edge cases automatically
  • βœ… Efficient reading of 7GB+ model files
  • βœ… Future-proof with library updates

Without Python Helper (JavaScript Fallback):

  • βœ… Still fully functional - no Python required!
  • βœ… Works for 99% of model files
  • βœ… 700,000x faster than old code (reads only 10KB vs entire file)
  • ⚠️ Manual format parsing (may miss rare edge cases)

Installation

Option 1: Virtual Environment (Recommended)

# Navigate to project root
cd kiko-creator

# Create virtual environment
python3 -m venv venv

# Activate virtual environment
source venv/bin/activate    # Linux/Mac
# OR
venv\Scripts\activate       # Windows

# Install Python dependencies
pip install -r requirements.txt

Option 2: Global Installation

# Install directly (not recommended for production)
pip install -r requirements.txt

Verifying Setup

After installation, restart the server and check the logs:

npm run dev:all

Look for one of these messages in the terminal:

  • βœ… [Safetensors] Using Python helper at /path/to/python - Python helper active!
  • ⚠️ [Safetensors] Python not found, using JavaScript fallback - JS fallback mode (still works!)
  • ⚠️ [Safetensors] Python found but safetensors library not installed - Need to run pip install

What Gets Improved?

The Python helper enhances:

  • LoRA Metadata Reading: Trigger words, base model info, descriptions
  • CivitAI Integration: Model/version IDs for 🌐 globe links
  • Large Model Support: Reads 7GB+ files without memory issues
  • Edge Case Handling: Unusual format variations handled automatically

Deactivating Virtual Environment

When you're done working with the project:

# Deactivate virtual environment
deactivate

Next time you work on the project, remember to activate the venv again:

source venv/bin/activate  # or venv\Scripts\activate on Windows

More Information

For detailed troubleshooting and testing instructions, see PYTHON_SETUP.md.

πŸ“ Project Structure

kiko-creator/
β”œβ”€β”€ src/                          # Frontend source
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ layout/              # Layout components
β”‚   β”‚   β”œβ”€β”€ wizard/              # Setup wizard
β”‚   β”‚   β”œβ”€β”€ ImageLightbox.jsx    # Image viewer
β”‚   β”‚   β”œβ”€β”€ TagAutocomplete.jsx  # Tag suggestions
β”‚   β”‚   └── WildcardMenu.jsx     # Wildcard selector
β”‚   β”œβ”€β”€ pages/
β”‚   β”‚   β”œβ”€β”€ CharactersPage.jsx   # Character browser
β”‚   β”‚   β”œβ”€β”€ GeneratePage.jsx     # Main generation UI
β”‚   β”‚   β”œβ”€β”€ GalleryPage.jsx      # Image gallery
β”‚   β”‚   β”œβ”€β”€ ModelsPage.jsx       # Model management
β”‚   β”‚   └── SettingsPage.jsx     # App settings
β”‚   β”œβ”€β”€ stores/
β”‚   β”‚   β”œβ”€β”€ settingsStore.js     # App configuration
β”‚   β”‚   β”œβ”€β”€ generationStore.js   # Generation state
β”‚   β”‚   β”œβ”€β”€ charactersStore.js   # Character data
β”‚   β”‚   └── galleryStore.js      # Gallery persistence
β”‚   └── styles/
β”‚       └── index.css            # Global styles & Tailwind
β”œβ”€β”€ server/                       # Backend API
β”‚   β”œβ”€β”€ routes/
β”‚   β”‚   β”œβ”€β”€ setup.js             # Setup endpoints
β”‚   β”‚   β”œβ”€β”€ generation.js        # Generation API
β”‚   β”‚   β”œβ”€β”€ comfyui.js          # ComfyUI proxy
β”‚   β”‚   β”œβ”€β”€ characters.js        # Character data
β”‚   β”‚   └── models.js            # Model scanning
β”‚   β”œβ”€β”€ services/
β”‚   β”‚   └── workflowBuilder.js   # ComfyUI workflow generation
β”‚   β”œβ”€β”€ utils/
β”‚   β”‚   β”œβ”€β”€ safetensors.js       # Safetensors metadata (hybrid JS/Python)
β”‚   β”‚   β”œβ”€β”€ safetensors_reader.py # Python safetensors helper
β”‚   β”‚   └── python_bridge.js     # Node.js ↔ Python bridge
β”‚   └── index.js                 # Express server
β”œβ”€β”€ data/                         # Data files (git-ignored)
β”‚   β”œβ”€β”€ wai_characters.csv       # Character database
β”‚   β”œβ”€β”€ wai_character_thumbs.json # Character thumbnails
β”‚   └── danbooru_e621_merged.csv # Tag autocomplete
β”œβ”€β”€ venv/                         # Python virtual environment (optional)
β”œβ”€β”€ requirements.txt              # Python dependencies
β”œβ”€β”€ PYTHON_SETUP.md              # Python helper documentation
└── referance/                    # Reference application
    └── character_select_stand_alone_app/

🎯 Usage

First-Time Setup

  1. Launch the App: Navigate to http://localhost:5173
  2. Setup Wizard: Configure ComfyUI connection and scan models
  3. Verify Connection: Green indicator shows ComfyUI is connected

Generating Images

  1. Select Character (optional): Browse characters page and click to send to prompt
  2. Configure Settings:
    • Choose checkpoint model from dropdown (synced from ComfyUI)
    • Adjust steps, CFG, sampler
    • Select resolution preset
    • Add LoRAs if desired
    • Adjust CLIP Skip (-2 is SDXL default, -1 for last layer, up to -12 for early layers)
  3. Enter Prompts: Common prompt + character-specific prompt
  4. Generate: Click generate and watch real-time progress
    • Progress bar shows actual steps (e.g., "15/20 - 75%")
    • WebSocket provides instant updates
  5. View Results: Images appear in preview and are saved to gallery

Using Presets

Save a Preset:

  1. Configure your desired settings (checkpoint, prompts, LoRAs, steps, CFG, resolution, CLIP skip, hires fix, refiner)
  2. Click the βš™οΈ Presets button in the top right
  3. Enter a preset name and click Save
  4. Your preset is now saved locally

Load a Preset:

  1. Click the dropdown next to the Presets button
  2. Search for your preset by name
  3. Click on a preset to instantly apply all saved settings
  4. Star (⭐) your favorite presets for quick access

Preset Features:

  • Complete Settings: Saves everything - checkpoint, prompts, LoRAs with strengths, generation parameters, CLIP skip, hires fix, and refiner settings
  • Search & Filter: Type to find presets quickly, filter by favorites
  • Persistent: Presets sync across browser sessions
  • Import/Export: Share presets with others (coming soon)

Managing Gallery

  • View All Images: Navigate to Gallery page
  • Adjust Grid: Use slider for 2-6 column layouts
  • Filter Favorites: Click "⭐ Favorites" to show starred images
  • Batch Operations: Enable selection mode for multi-delete/download
  • Lightbox: Click any image for fullscreen view
    • Press ESC to close
    • Use arrow keys to navigate
    • View full metadata

Model Management

  • Browse Models: Navigate to Models page
  • Switch Tabs: Toggle between Checkpoints and LoRAs
  • Search: Filter by name or folder
  • Send to Generation: Click "➀ Generate" on any model card
  • CivitAI Links: Click 🌐 globe icon to view model details on CivitAI (requires LoRA Manager)
  • View Details: Click "ℹ️ Info" for CivitAI metadata (when available)
  • Auto-Refresh: Models sync automatically from ComfyUI on page load
  • Dropdowns: Globe icons also appear in model/LoRA/embedding selection dropdowns for quick access

Using LoRA Trigger Words

  1. Select a LoRA: Add any LoRA to a slot in the generation page
  2. Trigger Words Appear: Tags automatically display beneath the positive prompt
  3. Click to Add: Click individual trigger word tags to add them to your prompt
  4. Add All: Use the "Add All" button to insert all trigger words at once
  5. Multiple LoRAs: Trigger words from all selected LoRAs are combined and deduplicated

Note: Trigger words are automatically extracted from:

  • LoRA Manager .metadata.json files (if installed)
  • Safetensors metadata embedded in model files
  • CivitAI metadata (if previously scanned with API key)

Re-scanning Models

When you add new models to ComfyUI or update existing ones:

  1. Navigate to Settings: Go to Settings page
  2. Find Model Management: Scroll to the "Model Management" section
  3. Click Re-scan: Press the "Re-scan Models" button
  4. Watch Progress: A modal shows the scanning progress with a spinner
  5. View Results: When complete, see statistics:
    • Checkpoints discovered
    • LoRAs discovered (with trigger words)
    • Embeddings discovered
    • Cached vs new models
    • Scan duration
  6. Automatic Reload: Models and trigger words update automatically after scan

πŸ™ Credits & Acknowledgments

Reference Application

Kiko Creator is inspired by and builds upon concepts from:

Character Select Stand Alone App by @mirabarukaso

This reference application provided invaluable patterns and concepts:

  • Character database structure and selection system
  • Tag autocomplete mechanism from Danbooru/E621
  • LoRA slot management patterns
  • ComfyUI workflow generation logic
  • CSV data file formats and processing

CivitAI Integration

ComfyUI-Lora-Manager by willmiao

Kiko Creator reads CivitAI metadata from LoRA Manager's .metadata.json files to provide:

  • Direct links to model pages on CivitAI
  • Model version information
  • Seamless integration with CivitAI's download workflow

Key Differences

While inspired by the reference app, Kiko Creator is a complete reimplementation with significant architectural changes:

Architecture

  • Web-First: React SPA instead of Electron desktop app
  • Modern Stack: React + Express instead of vanilla JS + Electron IPC
  • No Bundling: Vite HMR instead of Electron build process

Features

  • Real-Time Updates: WebSocket progress instead of HTTP polling
  • Persistent Gallery: localStorage with full metadata instead of temp preview
  • Responsive Design: Mobile-optimized UI with touch support
  • Model Browser: Visual model management vs filesystem scanning only
  • Dark Mode Only: Optimized single-theme design
  • Auto-Sync: Models sync from ComfyUI API vs manual file scanning

Technical Implementation

  • State Management: Zustand with persist vs vanilla state
  • API Layer: REST + WebSocket vs Electron IPC
  • Component System: React hooks vs vanilla DOM manipulation
  • Styling: Tailwind CSS + Framer Motion vs custom CSS

Data Sources

  • Character Database: WAI Characters dataset (5328+ characters)
  • Tag Database: Danbooru/E621 merged tag collection
  • Character Thumbnails: Curated thumbnail collection from reference app

Technologies

Frontend

  • React 18.3 - UI framework with hooks
  • Vite 5.x - Build tool and dev server
  • Tailwind CSS 3.x - Utility-first CSS
  • Framer Motion - Animation library
  • Zustand - Lightweight state management
  • React Router 6.x - Client-side routing

Backend

  • Node.js 18+ - JavaScript runtime
  • Express 4.x - Web server framework
  • Axios - HTTP client for ComfyUI API
  • YAML - Configuration file parsing

Integration

  • ComfyUI - Stable Diffusion backend
  • ComfyUI_Mira - Essential extension for workflow support
  • WebSocket - Real-time progress tracking

πŸ› Known Issues & Limitations

Current Limitations

  • Tag autocomplete requires CSV data files (auto-download planned)
  • CivitAI metadata requires ComfyUI-LoRA-Manager to be installed (see Setup)
  • WebSocket requires proxy for remote ComfyUI without HTTPS (see Remote Setup)
  • Gallery stored in browser localStorage (limited to ~10MB)

Workarounds

  • Remote WebSocket: Use socat or SSH tunnel (documented above)
  • Storage Limits: Clear old images when approaching browser limits
  • Model Sync: Refresh Models page if new models don't appear

🚧 Roadmap

Completed βœ…

  • Setup wizard with ComfyUI validation
  • Character selection with 5328+ characters
  • Custom character creation
  • Real-time generation with WebSocket progress
  • Persistent gallery with metadata
  • Model management (checkpoints + LoRAs)
  • LoRA slot system
  • LoRA trigger words display - Clickable tags beneath prompt with "Add All" button
  • Model re-scanning - One-click re-scan with professional modal UI
  • LoRA Manager integration - Reads trigger words from .metadata.json files
  • Metadata preservation - ComfyUI sync preserves database metadata
  • Preset system - Save/load complete generation settings with searchable dropdown and favorites
  • CLIP Skip control - Fine-tune text encoder layer selection (CLIPSetLastLayer node)
  • Mobile-responsive design
  • Batch operations
  • Favorites system
  • CivitAI metadata integration with 🌐 globe links
  • Extra model paths support (parses extra_model_paths.yaml)
  • Embeddings browser with recursive directory scanning
  • Database maintenance tools (vacuum, optimize, backup)

In Progress 🚧

  • Tag autocomplete with weight adjustment
  • Wildcard browser and editor

Planned πŸ“‹

  • Image-to-Image support
  • ControlNet integration
  • Batch character generation
  • Preset import/export functionality
  • Generation history timeline
  • Image comparison tools
  • Multi-language support

🀝 Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Development Guidelines

  • Follow existing code style
  • Add comments for complex logic
  • Test on both desktop and mobile
  • Update documentation as needed

πŸ“§ Support

For issues and questions:

πŸ“„ License

MIT License - See LICENSE file for details

🌟 Show Your Support

If you find this project useful:

  • ⭐ Star the repository
  • πŸ› Report bugs and suggest features
  • πŸ“’ Share with the ComfyUI community
  • 🀝 Contribute improvements

Made with ❀️ for the ComfyUI community

Inspired by and grateful to the Character Select Stand Alone App team for their excellent reference implementation.


πŸ”— Quick Links

About

A simple react based stable diffusion inference UI, uses ComfyUI under the covers.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages