The Ultimate Guide to ComfyUI 'Subgraph' and 'Blueprints'

Terin

Blog Manger

Terin

Blog Manger

Title

Escape the Node Spaghetti Hell! The Ultimate Guide to ComfyUI 'Subgraph' and 'Blueprints' 🧩✨


Introduction

Hello, creators! When you try to build a workflow yourself, you've probably experienced your eyes spinning at the sight of dozens of nodes and lines tangled up in what's known as 'node spaghetti'.

"Can't I just combine frequently used node groups into one?"

To answer this desperate plea, ComfyUI has the 'Subgraph' feature and the 'Blueprints' feature to save them permanently! Today, from an absolute beginner's perspective, I will show you in detail and how to use these magical features to compress a complex workspace into a single node and drastically reduce your working time.


Part 1: Compress the Screen Neatly! Creating a 'Subgraph'

If you analyze the image_z_image_turbo template photo and the App Builder screen you captured in previous conversations, you can see numerous nodes like Load Diffusion Model, CLIP Text Encode, ModelSamplingAuraFlow, KSampler, and VAE Decode tangled with complex lines just to generate one image.

A subgraph is a feature that compresses a bundle of these tangled nodes into a 'single node', much like a single capsule pill.



Step 1: Select the nodes to combine

  1. Open the part of the workflow you want to compress on the ComfyUI screen (e.g., the core generation node bundle of Z-Image-Turbo in the photo you showed).


  1. Drag your mouse to highlight (select) all the nodes you want to group together.


Step 2: Compress into a Subgraph

  1. Right-click on the selected nodes.

  2. Click Create Subgraph from the menu that appears.


  1. Ta-da! Over 10 nodes instantly disappear from the screen and transform into a single, large integrated node containing all the grouped functions!


Step 3: Grouped by mistake? Unpacking it (Unpack)

"Oops, what if I want to slightly change the node settings inside?" Don't worry.



  1. Select the created subgraph node and right-click.

  2. Click Unpack subgraph from the menu, and the compressed nodes will safely pour out in their original form. Feel free to modify them and group them again.


Part 2: Permanently Preserve Your Own Nodes! 'Blueprints'

You've made a subgraph, but wouldn't it be too annoying if you had to recreate it every time you opened a new workflow? Now, I will tell you the exact way to make the subgraph you created into a 'Blueprint' that is permanently registered like an official ComfyUI node and can be loaded from anywhere (Global) at any time.

There is no need to forcefully create a new folder. You just need to use the official folder that ComfyUI has already prepared for this.


The Exact Way to Save a Blueprint:


  1. Export as JSON file: Right-click on the subgraph node you made in Part 1 earlier, and Export the subgraph to your computer as a JSON file format. (e.g., my_z_image_turbo.json)

  2. Find the blueprints folder: Go to the main folder (directory) where ComfyUI is installed on your computer. If you look at the folder list, you will see that a folder named blueprints already exists by default.

  3. Paste the file: Simply paste the JSON file you exported in step 1 directly into this blueprints folder, and you're done!



  1. Check the result: Completely close and restart the ComfyUI program. Now, if you double-click on an empty screen to bring up the node search bar, the subgraph you just put in the blueprints folder will appear in the search list like an official node (Blueprint). With just a single click, you can conveniently pull out your ultimate secret settings!


Conclusion & Expectations

Great job! The Subgraph and Blueprints features you learned today are core technologies that dramatically lower the complex visual fatigue of ComfyUI.

Even the complex connection structures of ModelSamplingAuraFlow or KSampler in the photos you uploaded can now be compressed well just once and placed in the blueprints folder, so you can just pop them out as a single node and use them with one click from next time. Try accumulating your own secret node combinations one by one as blueprints. Your AI content creation speed will become overwhelmingly faster than ever before!