### Install Dependencies and Start Development Environment Source: https://context7.com/comfy-deploy/comfydeploy/llms.txt Installs all workspace dependencies using Bun and copies environment variable templates for the app and API. This is the initial setup step for local development. ```bash bun i cp apps/app/.env.example apps/app/.env cp apps/api/.env.example apps/api/.env ``` -------------------------------- ### Install Project Dependencies with Bun Source: https://github.com/comfy-deploy/comfydeploy/blob/main/README.md Installs project dependencies using Bun. Ensure Bun is installed before running. ```bash bun i ``` -------------------------------- ### Run Development Server with Bun Source: https://github.com/comfy-deploy/comfydeploy/blob/main/README.md Starts the development server using Bun. This command is used for local development. ```bash bun run dev ``` -------------------------------- ### Copy Environment Variable Examples Source: https://github.com/comfy-deploy/comfydeploy/blob/main/README.md Copies example environment files to actual environment files for both the app and API. These files need to be created before running the application. ```bash cp apps/app/.env.example apps/app/.env cp apps/api/.env.example apps/api/.env ``` -------------------------------- ### Deploy ComfyDeploy Components Source: https://context7.com/comfy-deploy/comfydeploy/llms.txt Commands to deploy the frontend to Vercel, backend to Railway, and Modal GPU workers. ```bash vercel --cwd apps/app ``` ```bash railway up --service api ``` ```bash modal deploy apps/api/modal_app.py ``` -------------------------------- ### Frontend Environment Configuration Source: https://context7.com/comfy-deploy/comfydeploy/llms.txt Configuration for the Next.js frontend application, specifying the API URL and Clerk publishable key for authentication. Also includes the ngrok tunnel URL for API webhook callbacks during local development. ```bash # URL of the local API server NEXT_PUBLIC_CD_API_URL=http://localhost:3011 # Clerk publishable key (from Clerk dashboard) NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_your-clerk-publishable-key # ngrok tunnel URL for the API (used for webhook callbacks in local dev) NEXT_PUBLIC_NGROK_CD_API_URL=https://your-subdomain.ngrok-free.app ``` -------------------------------- ### Modal Environment Configuration Source: https://github.com/comfy-deploy/comfydeploy/blob/main/README.md Environment variables for Modal, a platform for building and deploying machine learning models. Requires setting up a Modal account. ```env MODAL_ENVIRONMENT="main" MODAL_TOKEN_ID="" MODAL_TOKEN_SECRET="" ``` -------------------------------- ### Clerk Authentication Configuration Source: https://github.com/comfy-deploy/comfydeploy/blob/main/README.md Environment variables for Clerk authentication. A free account is sufficient. ```env CLERK_PUBLIC_JWT_KEY= CLERK_SECRET_KEY= ``` -------------------------------- ### NGROK Tunneling Configuration Source: https://github.com/comfy-deploy/comfydeploy/blob/main/README.md Environment variables for NGROK, used for tunneling. A free account is sufficient. ```env NGROK_AUTHTOKEN= NGROK_DOMAIN= ``` -------------------------------- ### Clone ComfyDeploy Monorepo with Submodules Source: https://context7.com/comfy-deploy/comfydeploy/llms.txt Clones the main repository and initializes all git submodules recursively. If the repository was already cloned without submodules, this command initializes them. ```bash git clone --recurse-submodules https://github.com/comfy-deploy/comfydeploy ``` ```bash git submodule update --init --recursive ``` -------------------------------- ### GitHub Token Configuration Source: https://github.com/comfy-deploy/comfydeploy/blob/main/README.md Environment variable for GitHub token. This is typically a personal access token (PAT). ```env GITHUB_TOKEN=github_pat_ ``` -------------------------------- ### API Environment Configuration Source: https://context7.com/comfy-deploy/comfydeploy/llms.txt Configuration for the API application, including secrets for S3 storage, authentication, JWT/encryption keys, Redis, Modal GPU compute, and the public tunnel URL. Ensure sensitive values are kept secure. ```bash # S3-compatible object storage (DigitalOcean Spaces, AWS S3, etc.) SPACES_BUCKET_V2=my-comfydeploy-bucket SPACES_ENDPOINT_V2=https://nyc3.digitaloceanspaces.com SPACES_REGION_V2=nyc3 SPACES_KEY_V2=your-spaces-access-key SPACES_SECRET_V2=your-spaces-secret-key # Ngrok tunnel (for local dev — free account works) NGROK_AUTHTOKEN=your-ngrok-auth-token NGROK_DOMAIN=your-subdomain.ngrok-free.app # Clerk authentication (free account works) CLERK_PUBLIC_JWT_KEY=your-clerk-public-jwt-key CLERK_SECRET_KEY=sk_test_your-clerk-secret-key # JWT and encryption secrets # Generate JWT secret: openssl rand -hex 32 JWT_SECRET="$(openssl rand -hex 32)" # Generate encryption key: python3 -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())" SECRET_ENCRYPTION_KEY=your-fernet-encryption-key # GitHub token for workflow/package access GITHUB_TOKEN=github_pat_your-token-here # Upstash Redis (all three can point to the same local Redis instance in dev) UPSTASH_REDIS_META_REST_URL="http://localhost:8079" UPSTASH_REDIS_META_REST_TOKEN="example_token" UPSTASH_REDIS_REST_URL_LOG="http://localhost:8079" UPSTASH_REDIS_REST_TOKEN_LOG="example_token" UPSTASH_REDIS_REST_URL_REALTIME="http://localhost:8079" UPSTASH_REDIS_REST_TOKEN_REALTIME="example_token" REDIS_URL_LOG=redis://localhost:6379/0 REDIS_URL_REALTIME=redis://localhost:6379/0 # Public API URL — point to your ngrok tunnel for local dev CURRENT_API_URL="https://your-subdomain.ngrok-free.app" # Modal GPU compute (free account works for dev) MODAL_ENVIRONMENT="main" MODAL_TOKEN_ID="your-modal-token-id" MODAL_TOKEN_SECRET="your-modal-token-secret" ``` -------------------------------- ### S3 Environment Variables Configuration Source: https://github.com/comfy-deploy/comfydeploy/blob/main/README.md Configuration for AWS S3 or compatible storage. It's recommended to use a hosted version for development. ```env # S3 SPACES_BUCKET_V2= SPACES_ENDPOINT_V2= SPACES_REGION_V2= SPACES_KEY_V2= SPACES_SECRET_V2= ``` -------------------------------- ### Upstash Redis Configuration Source: https://github.com/comfy-deploy/comfydeploy/blob/main/README.md Configuration for Upstash Redis instances, including separate URLs and tokens for meta, logs, and real-time data. Also includes fallback Redis URLs. ```env UPSTASH_REDIS_META_REST_URL="http://localhost:8079" UPSTASH_REDIS_META_REST_TOKEN="example_token" UPSTASH_REDIS_REST_URL_LOG="http://localhost:8079" UPSTASH_REDIS_REST_TOKEN_LOG="example_token" UPSTASH_REDIS_REST_URL_REALTIME="http://localhost:8079" UPSTASH_REDIS_REST_TOKEN_REALTIME="example_token" REDIS_URL_LOG=redis://localhost:6379/0 REDIS_URL_REALTIME=redis://localhost:6379/0 ``` -------------------------------- ### Current API URL Configuration Source: https://github.com/comfy-deploy/comfydeploy/blob/main/README.md Sets the base URL for the current API, typically used for local development with tunneling services like NGROK. ```env CURRENT_API_URL="https://" ``` -------------------------------- ### Turborepo Task Pipeline Configuration Source: https://context7.com/comfy-deploy/comfydeploy/llms.txt Defines the task pipeline in `turbo.json` for orchestrating build and development tasks across workspaces. The `dev` task depends on `migrate-local`, while `tunnel` and `docker-compose` run persistently. ```json { "$schema": "https://turborepo.com/schema.json", "ui": "tui", "tasks": { "dev": { "dependsOn": ["migrate-local"], "cache": false, "persistent": true }, "tunnel": { "cache": false, "persistent": true }, "docker-compose": { "cache": false, "persistent": true }, "migrate-local": { "cache": false } } } ``` -------------------------------- ### Next.js Application Environment Variables Source: https://github.com/comfy-deploy/comfydeploy/blob/main/README.md Client-side environment variables for the Next.js application, including API URLs and Clerk publishable key. ```env NEXT_PUBLIC_CD_API_URL=http://localhost:3011 NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY= NEXT_PUBLIC_NGROK_CD_API_URL=https:// ``` -------------------------------- ### JWT Secret and Encryption Key Generation Source: https://github.com/comfy-deploy/comfydeploy/blob/main/README.md Configuration for JWT secret and a secret encryption key. Instructions for generating these are provided in comments. ```env # generate using -> openssl rand -hex 32 JWT_SECRET="test-secret-key" # python3 -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode('utf-8'))" SECRET_ENCRYPTION_KEY= ``` -------------------------------- ### Update Git Submodules Source: https://context7.com/comfy-deploy/comfydeploy/llms.txt Updates all git submodules to their latest tracked commits. This is useful for ensuring all parts of the monorepo are up-to-date. ```bash git submodule update --remote --merge ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.