A visual, node-based deep learning pipeline builder. Design CNN, RNN, Transformer, and RL architectures by dragging nodes onto a canvas, connecting them into a DAG, and executing the pipeline — all from the browser.
- Visual Graph Editor — Drag-and-drop nodes, connect ports with type-safe edges, real-time validation
- 94 Built-in Nodes across 15 categories (CNN, RNN, Transformer, RL, Data, Data Flow, Training, IO, Control, Utility, Normalization, Tensor Operations, LLM, Classical, Diffusion)
- Teaching Inspector — Record full per-node outputs, inspect input→output tensor diffs side-by-side, and wrap a subgraph with the Compare Segment bubble to focus on just head-input vs tail-output. Drop in a
TensorInputnode with an inline grid editor to feed the pipeline and watch each transformation - Preset System — Pre-built model templates for quick start; export your own subgraphs as reusable presets
- Multi-Tab Workspace — Multiple independent canvases, each with its own execution context
- WebSocket Execution — Real-time per-node progress, Print node output displayed in the Execution Log panel
- Partial Re-Execution — Dirty node tracking: only re-runs changed nodes and their downstream dependencies
- Quick Node Search — Double-click the canvas to open an instant search panel for adding nodes and presets
- Custom Node Manager — GUI for uploading, enabling/disabling, and deleting custom nodes
- Model File Management — Upload, list, and delete model weight files (.pt, .pth, .safetensors, .ckpt, .bin) via REST API
- CLI Graph Runner — Execute graph.json directly from the command line with
run_graph.py - Results Panel — Tabbed panel (Execution Log / Training), resizable, with live loss chart
- i18n — English and 繁體中文, with responsive
rem-based font sizing - Persistence — Auto-saves all tabs to
localStorage; import/export graph JSON files - Dark Theme — Fully styled dark UI with color-coded categories
One-liner install:
# macOS / Linux
curl -fsSL https://raw.githubusercontent.com/treeleaves30760/CodefyUI/main/install.sh | bash# Windows (PowerShell)
powershell -ExecutionPolicy ByPass -c "irm https://raw.githubusercontent.com/treeleaves30760/CodefyUI/main/install.ps1 | iex"Installs only what's needed to run the app: git, uv, and Python (via uv). The frontend bundle is downloaded prebuilt from the latest GitHub release — no Node.js or pnpm required for end users. After install, open a new terminal and run from anywhere:
cdui startOpen http://localhost:8000. The single uvicorn process serves both the API and the prebuilt React app.
| Command | Description |
|---|---|
cdui install |
Install backend deps; download prebuilt frontend (or local build if pnpm available) |
cdui update |
Pull latest main and re-fetch the frontend bundle |
cdui start |
Production mode — single uvicorn on :8000 (no Node needed) |
cdui dev |
Developer mode — backend :8000 + Vite HMR :5173 (requires Node + pnpm) |
cdui build |
Build the frontend bundle locally (requires Node + pnpm) |
cdui stop |
Stop all services |
cdui test |
Run backend tests |
cdui clean |
Remove virtualenv, node_modules, and frontend/dist |
cdui uninstall |
Clean + remove the PATH launcher |
cdui plugin install <name|url> |
Install a plugin pack (catalog name like C2, owner/repo[@ref], or full GitHub URL) |
cdui plugin list |
List installed plugin packs |
cdui plugin uninstall <id> |
Remove an installed plugin pack |
cduiis a thin launcher (cdui.cmdon Windows) placed at~/.local/bin/cduiby the installer. If you didn't restart your terminal yet, invoke the absolute path:~/CodefyUI/cdui start.python scripts/dev.py <cmd>still works too —dev.pyre-execs into the venv's Python automatically.
Contributors: if you want hot-reload (cdui dev), pass CODEFYUI_FORCE_BUILD=1 to the installer or install Node 24+ and pnpm separately. Pin a specific release with CODEFYUI_RELEASE_TAG=<tag>.
Both install.sh/install.ps1 and cdui install (after first install) accept the same set of choices, either as CLI flags or pre-set environment variables. Defaults are interactive when stdin is a TTY, and the safe choices when not.
| Flag | Env var | Values | Purpose |
|---|---|---|---|
--gpu <choice> |
CODEFYUI_GPU |
auto / cu118 / cu121 / cu124 / cu128 / rocm6.1 / rocm6.2 / cpu / mps / skip |
Select PyTorch wheel index. auto detects via nvidia-smi / rocm-smi / Apple Silicon. skip installs no torch (advanced — for users with a custom torch already in the venv). |
--dev / --no-dev |
CODEFYUI_DEV |
1 / 0 |
Install the [dev] extra (pytest, httpx, httpx-ws). Required for cdui test. Default off for end users, on for contributors. |
--yes |
— | — | Accept all defaults non-interactively (CI / headless). |
--lang <code> |
CODEFYUI_LANG |
en / zh-TW |
Localise the installer prompts. |
| — | CODEFYUI_DIR |
path | Install directory (default: ~/CodefyUI). |
| — | CODEFYUI_RELEASE_TAG |
tag | Pin the frontend bundle to a specific release (default: latest). |
| — | CODEFYUI_FORCE_BUILD |
1 |
Skip the prebuilt-dist download and build locally with pnpm. |
This quick start assumes an NVIDIA GPU with CUDA 12.4. For CPU, Apple Silicon, AMD, or detailed troubleshooting, see the full setup guide.
Run a graph directly from the command line without starting the server:
cd backend
python run_graph.py ../examples/Usage_Example/CNN-MNIST/TrainCNN-MNIST/graph.json
python run_graph.py ../examples/Model_Architecture/ResNet-SkipConnection-CNN/graph.json --validate-onlyfrontend/ React 19 · TypeScript · React Flow 12 · Zustand 5 · Vite 6
backend/ Python 3.10+ · FastAPI · PyTorch
| Principle | Detail |
|---|---|
| Backend-authoritative | GET /api/nodes returns all node definitions. Adding a backend node auto-appears in the UI. |
| Single BaseNode component | One React component renders all node types, parameterized by backend definitions. |
| WebSocket execution | ws://host/ws/execution streams per-node status. REST handles graph CRUD. |
| Topological execution | Kahn's algorithm for DAG sort + cycle detection. Parallel execution of independent nodes. |
| Category | Nodes | Count |
|---|---|---|
| CNN | Conv2d, Conv1d, ConvTranspose2d, MaxPool2d, AvgPool2d, AdaptiveAvgPool2d, BatchNorm2d, Dropout, Activation | 9 |
| RNN | LSTM, GRU, RNNCell | 3 |
| Transformer | MultiHeadAttention, TransformerEncoder, TransformerDecoder, MoELayer | 4 |
| RL | DQN, PPO, EnvWrapper, RewardModel, KLDivergence | 5 |
| Data | Dataset, DataLoader, Transform, HuggingFaceDataset, KaggleDataset, TensorInput, TextInput, CSVReader, ColumnSelector, Normalize, SyntheticDataset, TrainTestSplit | 12 |
| Data Flow | Map, Reduce, Switch | 3 |
| Training | Optimizer, Loss, TrainingLoop, LRScheduler, SequentialModel, BackwardOnce | 6 |
| IO | ImageReader, ImageWriter, ImageBatchReader, FileReader, CheckpointSaver, CheckpointLoader, ModelLoader, ModelSaver, Inference | 9 |
| Control | Start | 1 |
| Utility | Print, Reshape, Concat, Flatten, Linear, Visualize, Embedding | 7 |
| Normalization | BatchNorm1d, LayerNorm, GroupNorm, InstanceNorm2d | 4 |
| Tensor Operations | Add, MatMul, Mean, Multiply, Permute, Softmax, Split, Squeeze, Stack, TensorCreate, Unsqueeze | 11 |
| LLM | Tokenizer, WordVector, EmbeddingScatter, CosineSimilarity, AttentionMask, AttentionHeatmap, PositionalEncoding | 7 |
| Classical | KNN, LinearRegression, LogisticRegression, DecisionTreeClassifier, SVMClassifier, MLPClassifier, Accuracy | 7 |
| Diffusion | Upsample, TimestepEmbedding, Lerp, GaussianNoise, DDPMSampler, DiffusionUNet | 6 |
Pre-built example workflows organized in examples/:
| Category | Examples |
|---|---|
| Model Architecture | ResNet, ConvNeXt, EfficientNet, UNet, ViT, SwinTransformer, BERT, GPT, LLaMA, DiT, LSTM TimeSeries, BiGRU SpeechRecognition, Seq2Seq Attention, DQN Atari, PPO Robotics |
| Usage Example | CNN-MNIST Training, CNN-MNIST Inference, GPT-Mini Training, ResNet-CIFAR10 Training |
| LLM | Word Embedding Analogy (king − man + woman ≈ queen with the offline demo-16d backend) |
CodefyUI can be used as an interactive lesson — students see the exact tensor that flows through every node.
- Drag a TensorInput node onto the canvas (Data category). Set
value_mode: explicitand fill the inline grid with the numbers you want the pipeline to see. - Wire it through any chain of tensor-op nodes (e.g.
Reshape → Softmax → Print). - Drag a
Startnode onto the canvas and connect its trigger output (the diamond handle on the right side of the Start node) to the first node you want executed — typically theTensorInput. Without a Start → first-node trigger edge the graph is a draft andRunwill reject it with a "No start node defined" toast. Only nodes reachable from a Start are executed. - Open the toolbar Settings (⚙) popover and switch Record outputs ON, then click Run. Every completed node's full output is captured in server memory, keyed by the run.
- Click any node — the right-hand Inspector panel fetches that node's input and output, showing shape, dtype, min/max/mean and the actual values stacked top-to-bottom. Cells that changed are heat-coloured.
- Shift-select two nodes and use Compare Segment (also under ⚙ Settings → Inspection) to focus on just the head-input and tail-output; the canvas wraps them in a light-orange bubble with HEAD / TAIL badges so the scope is obvious.
- Switch Record outputs OFF before a heavy training run if you don't want each epoch captured — previously captured runs stay fetchable until the server restarts.
Captured data is per-session RAM (LRU, last 20 runs). Segment markers are saved with the graph JSON.
The toolbar ⚙ Settings popover groups every per-tab teaching/training switch in one place — same idea as VS Code's Settings UI:
| Toggle | What it does |
|---|---|
| Record outputs | Capture each completed node's full output for the Inspector. Off by default for heavy training runs. |
| Verbose mode | Backend records intermediate algorithmic steps (attention scores, softmax temperatures, etc.) alongside outputs — feeds the Inspector "Steps" tab. |
| Compare Segment | Wraps two shift-selected nodes in a HEAD/TAIL bubble so the Inspector shows only that subgraph's boundaries. |
| Persist weights between runs | Keep Conv2d/Linear/Attention weights across Run clicks (so the model actually learns). When off, every run reinitialises. |
| Reset all weights now | Drop every cached weight for this tab; next Run starts fresh. |
| Capture gradients | Run forward + .backward() and store each layer's gradient for the Inspector "Backward" tab. |
| Auto-synthesize loss | When the graph has no Loss/BackwardOnce node, synthesize one so .backward() can run. |
| Grid snap | Snap dragged nodes to the canvas grid. |
| Show node tooltips | Reveal the description card when hovering nodes on the canvas. |
| Node category mode | Basic shows only essential categories in the sidebar; All shows every category. |
Lesson-specific and educational nodes ship as installable plugin packs so a default install keeps the palette focused on production nodes:
cdui plugin install C1 C2 C3 C4 C5 C6 # full textbook companion (12 Edu nodes)
cdui plugin list
cdui plugin info C4 # manifest, lessons covered, node names
cdui plugin search attention # query the catalog
cdui plugin install foo/bar # third-party pack from GitHub
cdui plugin uninstall C4Built-in chapter packs live in plugins/<id>/ inside this repo (activated
in place, no copies). Third-party packs are downloaded as a pinned-SHA
tarball into <USER_DATA>/plugins/<id>/ and AST-validated before install.
The lockfile at <USER_DATA>/plugins/installed.json records every install
and lets cdui start rediscover them on the next launch.
| Pack | Chapter | Lessons | Edu nodes |
|---|---|---|---|
c1 |
基本資訊 | C1-2 (tabular) | EduColumnStats |
c2 |
經典 AI | C2-2 (classifiers) | EduKNN, EduLinearRegression, EduLogisticRegression |
c3 |
圖像處理 | C3-2 (UNet), C3-3 (Diffusion) | EduCrossAttention, EduResBlock |
c4 |
序列處理 | C4-2 (attention), C4-3 (Transformer) | EduTokenEmbedding, EduSelfAttention, EduMultiHeadAttention, EduFFN |
c5 |
強化學習 | C5-1, C5-2 (PPO) | EduPolicyGradient |
c6 |
前沿技術 | C6-2 (ViT) | EduPatchify |
Each Edu node decomposes a single lesson concept into a chain of named steps
that the Teaching Inspector renders one row at a time — EduColumnStats
shows the population-std formula as sum → divide → deviations² → variance → sqrt; EduPolicyGradient exposes softmax → gather → log → baseline → loss; EduPatchify makes unfold → permute → flatten visible. Switch
Verbose mode in the toolbar ⚙ Settings popover to capture them.
Fork the Official Plugin Template — a working, MIT-licensed plugin with two example nodes, a sample example graph, a test suite, and a fully-commented manifest. The README there walks you through every field and the AST security gate.
# Install the template itself to see the pattern live
cdui plugin install treeleaves30760/CodefyUI-Plugin-Official
# After forking
cdui plugin install your-username/your-forkBREAKING (v0.2): the
Edu*nodes that used to ship inbackend/app/nodes/have moved into per-chapter plugins. Existing graph JSONs that referenceEduKNN,EduSelfAttention,EduCrossAttention, etc. will fail to run until youcdui plugin install C2 C3 C4.
Drop a .py file in backend/app/custom_nodes/ extending BaseNode:
from app.core.node_base import BaseNode, DataType, PortDefinition
class MyNode(BaseNode):
NODE_NAME = "MyNode"
CATEGORY = "Custom"
DESCRIPTION = "Does something"
@classmethod
def define_inputs(cls):
return [PortDefinition(name="input", data_type=DataType.TENSOR)]
@classmethod
def define_outputs(cls):
return [PortDefinition(name="output", data_type=DataType.TENSOR)]
def execute(self, inputs, params):
return {"output": inputs["input"]}Hot-reload via POST /api/nodes/reload or the Reload Nodes button in the toolbar. Or use the Custom Node Manager GUI to upload, enable/disable, and delete custom nodes.
| Action | Key |
|---|---|
| Delete node | Delete |
| Multi-select | Shift + click |
| Quick add node | Double-click canvas |
| Rename node | Right-click → Rename |
| Duplicate node | Right-click → Duplicate |
| Undo | Ctrl/Cmd + Z |
| Redo | Ctrl/Cmd + Shift + Z / Ctrl/Cmd + Y |
| Copy nodes | Ctrl/Cmd + C |
| Paste nodes | Ctrl/Cmd + V |
| Auto Layout | Shift + L |
| Show shortcuts | ? |
| Endpoint | Method | Description |
|---|---|---|
/api/health |
GET | Health probe — returns nodes_loaded, presets_loaded |
/api/nodes |
GET | List all node definitions |
/api/nodes/{node_name} |
GET | Get a single node definition |
/api/nodes/reload |
POST | Hot-reload all built-in and custom nodes |
/api/presets |
GET | List preset definitions |
/api/presets/{name} |
GET | Get a single preset definition |
/api/presets/create |
POST | Create a new preset from selected nodes |
/api/graph/validate |
POST | Validate a graph |
/api/graph/save |
POST | Save a graph |
/api/graph/load/{name} |
GET | Load a saved graph |
/api/graph/list |
GET | List saved graphs |
/api/graph/export |
POST | Export graph as Python script |
/api/examples/list |
GET | List example graphs |
/api/examples/load |
GET | Load an example graph |
/api/custom-nodes |
GET | List custom nodes |
/api/custom-nodes/upload |
POST | Upload a custom node |
/api/custom-nodes/toggle |
POST | Enable/disable a custom node |
/api/custom-nodes/{filename} |
DELETE | Delete a custom node |
/api/plugins |
GET | List installed plugin packs |
/api/plugins/{id} |
GET | Get a plugin's manifest + README |
/api/plugins/reload |
POST | Hot-reload all node and preset sources |
/api/models |
GET | List uploaded model files |
/api/models/upload |
POST | Upload a model weight file |
/api/models/download/{filename} |
GET | Download a model weight file (supports nested paths) |
/api/models/{filename} |
DELETE | Delete a model file |
/api/images |
GET | List uploaded image files |
/api/images/upload |
POST | Upload an image file |
/api/images/download/{filename} |
GET | Download an image file |
/api/images/{filename} |
DELETE | Delete an image file |
/api/execution/outputs/{run_id} |
GET | List ports captured for a run |
/api/execution/outputs/{run_id} |
DELETE | Clear a captured run |
/api/execution/outputs/{run_id}/{node_id}/{port} |
GET | Fetch a captured tensor (supports ?slice=0,:,:) |
/api/execution/outputs/{run_id}/{node_id}/__steps_index |
GET | Step-trace metadata for a node (Inspector → Steps tab) |
/api/execution/outputs/{run_id}/{node_id}/__grad_index |
GET | Captured gradient metadata (Inspector → Backward tab) |
/api/execution/state/reset |
POST | Reset persisted layer weights (per-node or per-graph) |
/api/execution/state/list |
GET | List how many modules are persisted (diagnostic) |
/ws/execution |
WebSocket | Real-time graph execution (accepts run_id, record_outputs) |
cd backend
source .venv/bin/activate
pytest tests/ -vCodefyUI uses a dual path licensing model:
- Open source path: AGPL-3.0-only for individual developers, small teams, education, research, community use, and any other use case that can comply with AGPL-3.0.
- Commercial path: proprietary, closed-source, SaaS, OEM, enterprise, or other use cases that need terms outside AGPL-3.0 should contact the maintainers for a commercial license.
Commercial licensing contact: https://github.com/treeleaves30760/CodefyUI/issues
