Give your app an image workflow
Connect a form to ComfyUI, track the job, and display its output.
What you will make
One form submission becomes one tracked job and one authorized image result, with understandable failure states.
Before you start
A working API workflow from the image guide, a local ComfyUI server, Node.js 20+, and a web app with server-side code.
1. Define a small request
Expose the positive prompt and a bounded seed or size choice. Keep model selection and graph structure on the server. Do not accept arbitrary graphs from public visitors.
2. Submit one job
From the trusted app server, import runComfy from the job client and pass an explicit root, known workflow, allowed scalar overrides, output folder, and bounded waitMs. Store promptId and comfyNode with the requesting user when the tool returns a running job. Never accept arbitrary workflows, output paths, or server URLs from visitors.
3. Track the result
For a running response, call runComfy again with the saved promptId, workflow, output folder, and machine selection. This collects the existing job. Keep your application's queued/running/complete/failed states distinct and record terminal errors. Never retry an ambiguous submission automatically.
4. Retrieve the image
Read the output metadata for the completed job and retrieve that image through the server. Authorize access to the job before returning a result. Give each output a stable application ID instead of exposing filesystem paths.
5. Exercise failures
Test an invalid prompt, unreachable server, failed node, duplicate submit, and timeout. Keep ComfyUI behind the application; local ComfyUI should not become an unauthenticated public service.
Vibes for this guide
Use the materials that help with your next step.