Simple API to manage and share ComfyUI workflows.
npm install
export ADMIN_API_KEY="super-secret"
npm startRequirements: Node.js v20.0.0 or higher
# Switch to Node 20 (if using nvm)
nvm use 20
# Login to Cloudflare
wrangler login
# The KV namespace is already configured in wrangler.toml!
# For local development, copy the example file
cp .dev.vars.example .dev.vars
# Edit .dev.vars and set your ADMIN_API_KEY
# Test locally (uses .dev.vars automatically)
wrangler dev
# For production, set the secret (one-time setup)
wrangler secret put ADMIN_API_KEY
# Deploy to production
wrangler deployGET /workflows– public, lists all workflowsGET /workflows/:id– public, retrieves a specific workflowPOST /workflows– requiresAuthorization: Bearer <ADMIN_API_KEY>PUT /workflows/:id– requiresAuthorization: Bearer <ADMIN_API_KEY>DELETE /workflows/:id– requiresAuthorization: Bearer <ADMIN_API_KEY>
docker build -t comfy-workflows-api .
docker run -p 8787:8787 -e ADMIN_API_KEY=super-secret comfy-workflows-apiThe repository includes a GitHub Actions workflow that automatically builds and pushes the Docker image to eliteencoder/comfy-workflows-api on Docker Hub when committing to main.
Setup:
- Go to your GitHub repository settings → Secrets and variables → Actions
- Add the following secrets:
DOCKERHUB_USERNAME– Your Docker Hub usernameDOCKERHUB_TOKEN– Your Docker Hub access token (create one here)
PORT– Server port (default: 8787)ADMIN_API_KEY– Required for write operationsCORS_ALLOW_ORIGIN– CORS origin (default: *)DATA_FILE– Path to workflows JSON file (default: ./workflows.json)
Note: When using Docker Compose, the workflows data is stored in a ./data directory which is mounted as a volume. This ensures data persistence across container restarts.