comfyanonymous/ComfyUI
Packages
Top-level Python packages in the repo. Each lives at the repository root and is treated as an internal library by the rest of the codebase. There is no monorepo tooling — they share a single virtualenv and are imported by relative module path.
| Package | Lines | Purpose |
|---|---|---|
comfy/ |
84,388 | The diffusion engine. Models, samplers, text encoders, LoRA, VAE, model loading, memory, quantization |
comfy_api_nodes/ |
40,092 | Built-in nodes that call paid third-party AI APIs (Kling, Veo, Stability, BFL, …) |
comfy_extras/ |
27,126 | The standard library of "extra" built-in nodes — one file per feature/model family |
app/ |
9,054 | App-level managers: users, models, custom nodes, frontend, assets DB |
comfy_api/ |
5,842 | The versioned public API surface for custom nodes (latest, v0_0_1, v0_0_2) |
comfy_execution/ |
2,037 | Graph execution: traversal, caching, jobs, progress |
api_server/ |
180 | The aiohttp /internal/* routes used only by the frontend |
The top-level files (main.py, server.py, execution.py, nodes.py, folder_paths.py, etc.) are not a package but are documented as if they were one — they hold the runtime entry points and the standard node library.
Import conventions
comfy/is imported with the barecomfyname from anywhere in the tree.comfy_extras/modules are loaded bynodes.init_extra_nodesat startup; they exposeNODE_CLASS_MAPPINGS(V1) or acomfy_entrypoint()(V3).comfy_api/is the surface custom nodes are encouraged to import from. Internal types live incomfy_api/internal/.app/is internal to the runtime and is not part of the custom-node API.
Reading order
If you're new to the codebase:
comfy_execution/— small, central, sets up the mental model for caching and graph traversal.comfy_api/— the public node-authoring surface.- Top-level files —
main.py→server.py→execution.py→nodes.py. comfy/— start withsd.py, thensamplers.py, thenmodel_management.pyandmodel_patcher.py.app/— the rest is mostly small, focused managers.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.