Skip to content

Repository files navigation

ComfyUI Deployment Builder

A comprehensive web application for creating and managing automated ComfyUI installation scripts for cloud platforms like RunPod. Streamlines the configuration of custom nodes, models from CivitAI and HuggingFace, and generates production-ready deployment scripts.

🎯 Project Overview

The ComfyUI Deployment Builder solves the time-consuming and error-prone process of manually configuring ComfyUI environments by providing:

  • Curated Database: Comprehensive catalog of custom nodes and models
  • Visual Builder: Intuitive interface for creating deployment configurations
  • Script Generation: Automated creation of RunPod-compatible installation scripts
  • Template System: Shareable deployment templates for common use cases

πŸ“‹ Features

Phase 1: Foundation (Weeks 1-8)

  • βœ… User authentication and role-based access control
  • βœ… Admin interface for content curation
  • βœ… CivitAI API integration for model discovery
  • βœ… HuggingFace repository integration
  • βœ… ComfyUI Manager database synchronization
  • βœ… Basic deployment builder interface

Phase 2: Advanced Features (Weeks 9-16)

  • πŸ”„ Enhanced deployment builder with dependency resolution
  • πŸ”„ Script generation engine with multiple output formats
  • πŸ”„ Template system and community sharing
  • πŸ”„ Automated URL validation and monitoring

Phase 3: Polish & Advanced (Weeks 17-24)

  • ⏳ Performance optimization and caching
  • ⏳ Advanced search with Elasticsearch
  • ⏳ Public API and webhook system
  • ⏳ Progressive Web App features

Phase 4: Production & Scaling (Weeks 25-32)

  • ⏳ Production deployment with PostgreSQL
  • ⏳ Security hardening and compliance
  • ⏳ Load testing and auto-scaling
  • ⏳ Documentation and launch preparation

πŸ—οΈ Architecture

Frontend (Next.js)     Backend API (Next.js)     Database (SQLite/PostgreSQL)
β”œβ”€β”€ React Components   β”œβ”€β”€ Authentication        β”œβ”€β”€ Users & Roles
β”œβ”€β”€ TypeScript         β”œβ”€β”€ CRUD Operations       β”œβ”€β”€ Custom Nodes
β”œβ”€β”€ shadcn/ui          β”œβ”€β”€ External API Clients  β”œβ”€β”€ Models & Metadata
└── Tailwind CSS      └── Script Generation     └── Deployments

External Integrations
β”œβ”€β”€ CivitAI API (Model discovery)
β”œβ”€β”€ HuggingFace API (Repository analysis)  
β”œβ”€β”€ ComfyUI Manager (Node database sync)
└── GitHub API (Repository validation)

πŸ› οΈ Technology Stack

  • Frontend: Next.js 14, React, TypeScript, shadcn/ui, Tailwind CSS
  • Backend: Next.js API Routes, NextAuth.js, Prisma ORM
  • Database: SQLite (development) β†’ PostgreSQL (production)
  • External APIs: CivitAI, HuggingFace, GitHub, ComfyUI Manager
  • Deployment: Vercel, Docker, GitHub Actions

πŸ“Š Database Schema

Key entities and relationships:

Users (authentication, roles)
β”œβ”€β”€ ApiTokens (CivitAI, HuggingFace credentials)
└── Deployments (user configurations)
    β”œβ”€β”€ DeploymentNodes (selected custom nodes)
    β”œβ”€β”€ DeploymentModels (selected models)
    └── SystemPackages (apt/pip dependencies)

CustomNodes (GitHub repositories)
β”œβ”€β”€ Metadata (description, author, tags)
β”œβ”€β”€ Dependencies (requirements.txt, setup.py)
└── Validation (URL health, verification)

Models (CivitAI, HuggingFace)
β”œβ”€β”€ Source information (ID, URL, type)
β”œβ”€β”€ Download metadata (filename, size, auth)
└── Rich metadata (previews, stats, versions)

πŸš€ Getting Started

Prerequisites

  • Node.js 18+
  • npm or yarn
  • Git

Installation

  1. Clone the repository

    git clone https://github.com/yourusername/comfyui-deployment-builder.git
    cd comfyui-deployment-builder
  2. Install dependencies

    npm install
  3. Set up environment variables

    cp .env.example .env.local
    # Edit .env.local with your configuration
  4. Initialize database

    npx prisma generate
    npx prisma db push
    npx prisma db seed
  5. Start development server

    npm run dev

Visit http://localhost:3000 to see the application.

Environment Variables

# Database
DATABASE_URL="file:./dev.db"

# Authentication  
NEXTAUTH_SECRET="your-secret-key"
NEXTAUTH_URL="http://localhost:3000"

# External APIs (optional for development)
CIVITAI_API_TOKEN="your-civitai-token"
HUGGINGFACE_API_TOKEN="your-hf-token"
GITHUB_API_TOKEN="your-github-token"

πŸ“ Project Structure

comfyui-deployment-builder/
β”œβ”€β”€ app/                      # Next.js App Router
β”‚   β”œβ”€β”€ (auth)/              # Protected routes
β”‚   β”‚   β”œβ”€β”€ admin/           # Admin interface
β”‚   β”‚   β”œβ”€β”€ dashboard/       # User dashboard  
β”‚   β”‚   └── builder/         # Deployment builder
β”‚   β”œβ”€β”€ api/                 # API endpoints
β”‚   β”‚   β”œβ”€β”€ auth/            # Authentication
β”‚   β”‚   β”œβ”€β”€ civitai/         # CivitAI integration
β”‚   β”‚   β”œβ”€β”€ models/          # Model management
β”‚   β”‚   └── deployments/     # Deployment CRUD
β”‚   β”œβ”€β”€ components/          # React components
β”‚   β”‚   β”œβ”€β”€ ui/              # shadcn/ui components
β”‚   β”‚   β”œβ”€β”€ forms/           # Form components
β”‚   β”‚   └── builders/        # Deployment builder UI
β”‚   └── lib/                 # Utilities
β”‚       β”œβ”€β”€ clients/         # API clients
β”‚       β”œβ”€β”€ db.ts           # Database client
β”‚       └── auth.ts         # Auth configuration
β”œβ”€β”€ prisma/                  # Database schema
β”‚   β”œβ”€β”€ schema.prisma       # Prisma schema
β”‚   └── migrations/         # Database migrations
β”œβ”€β”€ scripts/                 # Utility scripts
└── templates/              # Script generation templates

πŸ”§ API Integration

CivitAI Integration

const client = new CivitAIClient({ token: process.env.CIVITAI_API_TOKEN });

// Search models
const models = await client.searchModels({
  query: "anime style",
  types: ["Checkpoint", "LORA"],
  limit: 20
});

// Get model details  
const model = await client.getModel(modelId);

HuggingFace Integration

const client = new HuggingFaceClient({ token: process.env.HUGGINGFACE_API_TOKEN });

// Search repositories
const repos = await client.searchRepositories({
  search: "stable diffusion",
  filter: "diffusers"
});

// Analyze repository
const info = await client.analyzeRepository(repoUrl);

ComfyUI Manager Sync

const manager = new ComfyUIManagerClient();

// Sync latest node database
const nodes = await manager.getNodeDatabase();
await syncToDatabase(nodes);

πŸ“œ Script Generation

Example generated RunPod script:

#!/bin/bash

# Auto-generated by ComfyUI Deployment Builder
# Configuration: My SDXL Workflow

APT_PACKAGES=(
    "git" "python3-pip" "python3-venv" "build-essential" "ffmpeg"
)

PIP_PACKAGES=(
    "torch" "torchvision" "torchaudio" "transformers>=4.28.1"
    "safetensors>=0.4.2" "diffusers" "xformers"
)

NODES=(
    "https://github.com/ltdrdata/ComfyUI-Manager"
    "https://github.com/cubiq/ComfyUI_essentials"
    "https://github.com/ltdrdata/ComfyUI-Impact-Pack"
)

CHECKPOINT_MODELS=(
    "https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0.safetensors"
)

# Installation function
function provisioning_start() {
    # [Generated installation logic]
}

provisioning_start

πŸ§ͺ Testing

# Run all tests
npm test

# Run specific test suite
npm test -- --grep "CivitAI"

# Run tests with coverage
npm run test:coverage

# Run E2E tests
npm run test:e2e

πŸ“– Documentation

🀝 Contributing

  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 TypeScript strict mode
  • Use Prettier for code formatting
  • Write tests for new features
  • Update documentation for API changes
  • Follow conventional commit messages

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • ComfyUI - The amazing node-based UI for Stable Diffusion
  • ComfyUI Manager - Extension management system
  • CivitAI - Community platform for AI art models
  • HuggingFace - Platform for machine learning models
  • RunPod - Cloud GPU platform for AI workloads

πŸ“ž Support


Status: 🚧 In Development | Version: 1.0.0-alpha | Last Updated: January 2025

About

A comprehensive web application for creating and managing automated ComfyUI installation scripts for cloud platforms like RunPod

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages