|
| 1 | +# Contributing to ComfyUI Frontend |
| 2 | + |
| 3 | +We're building this frontend together and would love your help — no matter how you'd like to pitch in! You don't need to write code to make a difference. |
| 4 | + |
| 5 | +## Ways to Contribute |
| 6 | + |
| 7 | +- **Pull Requests:** Add features, fix bugs, or improve code health. Browse [issues](https://github.com/Comfy-Org/ComfyUI_frontend/issues) for inspiration. Look for the `Good first issue` label if you're new to the project. |
| 8 | +- **Vote on Features:** Give a 👍 to the feature requests you care about to help us prioritize. |
| 9 | +- **Verify Bugs:** Try reproducing reported issues and share your results (even if the bug doesn't occur!). |
| 10 | +- **Community Support:** Hop into our [Discord](https://discord.com/invite/comfyorg) to answer questions or get help. |
| 11 | +- **Share & Advocate:** Tell your friends, tweet about us, or share tips to support the project. |
| 12 | + |
| 13 | +Have another idea? Drop into Discord or open an issue, and let's chat! |
| 14 | + |
| 15 | +## Development Setup |
| 16 | + |
| 17 | +### Prerequisites & Technology Stack |
| 18 | + |
| 19 | +- **Required Software**: |
| 20 | + - Node.js (v16 or later; v20/v22 strongly recommended) and npm |
| 21 | + - Git for version control |
| 22 | + - A running ComfyUI backend instance |
| 23 | + |
| 24 | +- **Tech Stack**: |
| 25 | + - [Vue 3.5 Composition API](https://vuejs.org/) with [TypeScript](https://www.typescriptlang.org/) |
| 26 | + - [Pinia](https://pinia.vuejs.org/) for state management |
| 27 | + - [PrimeVue](https://primevue.org/) with [TailwindCSS](https://tailwindcss.com/) for UI |
| 28 | + - litegraph.js (integrated in src/lib) for node editor |
| 29 | + - [zod](https://zod.dev/) for schema validation |
| 30 | + - [vue-i18n](https://github.com/intlify/vue-i18n) for internationalization |
| 31 | + |
| 32 | +### Initial Setup |
| 33 | + |
| 34 | +1. Clone the repository: |
| 35 | + ```bash |
| 36 | + git clone https://github.com/Comfy-Org/ComfyUI_frontend.git |
| 37 | + cd ComfyUI_frontend |
| 38 | + ``` |
| 39 | + |
| 40 | +2. Install dependencies: |
| 41 | + ```bash |
| 42 | + npm install |
| 43 | + ``` |
| 44 | + |
| 45 | +3. Configure environment (optional): |
| 46 | + Create a `.env` file in the project root based on the provided [.env.example](.env.example) file. |
| 47 | + |
| 48 | + **Note about ports**: By default, the dev server expects the ComfyUI backend at `localhost:8188`. If your ComfyUI instance runs on a different port, update this in your `.env` file. |
| 49 | + |
| 50 | +### Dev Server Configuration |
| 51 | + |
| 52 | +To launch ComfyUI and have it connect to your development server: |
| 53 | + |
| 54 | +```bash |
| 55 | +python main.py --port 8188 |
| 56 | +``` |
| 57 | + |
| 58 | +### Git pre-commit hooks |
| 59 | + |
| 60 | +Run `npm run prepare` to install Git pre-commit hooks. Currently, the pre-commit hook is used to auto-format code on commit. |
| 61 | + |
| 62 | +### Dev Server |
| 63 | + |
| 64 | +Note: The dev server will NOT load any extension from the ComfyUI server. Only core extensions will be loaded. |
| 65 | + |
| 66 | +- Start local ComfyUI backend at `localhost:8188` |
| 67 | +- Run `npm run dev` to start the dev server |
| 68 | +- Run `npm run dev:electron` to start the dev server with electron API mocked |
| 69 | + |
| 70 | +#### Access dev server on touch devices |
| 71 | + |
| 72 | +Enable remote access to the dev server by setting `VITE_REMOTE_DEV` in `.env` to `true`. |
| 73 | + |
| 74 | +After you start the dev server, you should see following logs: |
| 75 | + |
| 76 | +``` |
| 77 | + |
| 78 | +> vite |
| 79 | +
|
| 80 | +
|
| 81 | + VITE v5.4.6 ready in 488 ms |
| 82 | +
|
| 83 | + ➜ Local: http://localhost:5173/ |
| 84 | + ➜ Network: http://172.21.80.1:5173/ |
| 85 | + ➜ Network: http://192.168.2.20:5173/ |
| 86 | + ➜ press h + enter to show help |
| 87 | +``` |
| 88 | + |
| 89 | +Make sure your desktop machine and touch device are on the same network. On your touch device, |
| 90 | +navigate to `http://<server_ip>:5173` (e.g. `http://192.168.2.20:5173` here), to access the ComfyUI frontend. |
| 91 | + |
| 92 | +## Development Workflow |
| 93 | + |
| 94 | +### Architecture Decision Records |
| 95 | + |
| 96 | +We document significant architectural decisions using ADRs (Architecture Decision Records). See [docs/adr/](docs/adr/) for all ADRs and the template for creating new ones. |
| 97 | + |
| 98 | +### Backporting Changes to Release Branches |
| 99 | + |
| 100 | +When you fix a bug that affects a version in feature freeze, we use an automated backport process to apply the fix to the release candidate branch. |
| 101 | + |
| 102 | +#### Real Example |
| 103 | + |
| 104 | +- Subgraphs feature was released in v1.24 |
| 105 | +- While developing v1.25, we discovered a bug in subgraphs |
| 106 | +- v1.24 is in feature freeze (only accepting bug fixes, no new features) |
| 107 | +- The fix needs to be applied to both main (v1.25) and the v1.24 release candidate |
| 108 | + |
| 109 | +#### How to Backport Your Fix |
| 110 | + |
| 111 | +1. Create your PR fixing the bug on `main` branch as usual |
| 112 | +2. Before merging, add these labels to your PR: |
| 113 | + - `needs-backport` - triggers the automated backport workflow |
| 114 | + - `1.24` - targets the `core/1.24` release candidate branch |
| 115 | + |
| 116 | +3. Merge your PR normally |
| 117 | +4. The automated workflow will: |
| 118 | + - Create a new branch from `core/1.24` |
| 119 | + - Apply your changes to that branch |
| 120 | + - Open a new PR to `core/1.24` |
| 121 | + - Comment on your original PR with a link to the backport PR |
| 122 | + |
| 123 | +#### When to Use Backporting |
| 124 | + |
| 125 | +- Bug fixes for features already released |
| 126 | +- Security fixes |
| 127 | +- Critical issues affecting existing functionality |
| 128 | +- Never for new features (these wait for the next release cycle) |
| 129 | + |
| 130 | +#### Handling Conflicts |
| 131 | + |
| 132 | +If the automated cherry-pick fails due to conflicts, the workflow will comment on your PR with: |
| 133 | +- The list of conflicting files |
| 134 | +- Instructions to manually cherry-pick to the release candidate branch |
| 135 | + |
| 136 | +See [PR #4616](https://github.com/Comfy-Org/ComfyUI_frontend/pull/4616) for the actual subgraph bugfix that was backported from v1.25 to v1.24. |
| 137 | + |
| 138 | +## Code Editor Configuration |
| 139 | + |
| 140 | +### Recommended Setup |
| 141 | + |
| 142 | +This project includes `.vscode/launch.json.default` and `.vscode/settings.json.default` files with recommended launch and workspace settings for editors that use the `.vscode` directory (e.g., VS Code, Cursor, etc.). |
| 143 | + |
| 144 | +We've also included a list of recommended extensions in `.vscode/extensions.json`. Your editor should detect this file and show a human friendly list in the Extensions panel, linking each entry to its marketplace page. |
| 145 | + |
| 146 | +### MCP Integrations |
| 147 | + |
| 148 | +#### Playwright Browser Automation |
| 149 | + |
| 150 | +The Playwright MCP server enables LLM coding assistants (like Copilot, Claude Code, etc.) to control and inspect web browsers programmatically. This allows assistants to navigate websites, take screenshots, and interact with web pages on your behalf. |
| 151 | + |
| 152 | +For ComfyUI_frontend development, you can ask coding assistants to use Playwright screenshots to continuously verify that your code changes produce the expected visual results. |
| 153 | + |
| 154 | +##### Setup for Claude Code |
| 155 | + |
| 156 | +After installing dependencies with `npm i`, the Playwright MCP server will be automatically available when you start Claude Code locally. |
| 157 | + |
| 158 | +Here's how Claude Code can use the Playwright MCP server to inspect the interface of the local development server (assuming you're running the dev server at `localhost:5173`): |
| 159 | + |
| 160 | +``` |
| 161 | +> navigate to localhost:5173 and take a screenshot. |
| 162 | + tell me the items in the menubar |
| 163 | +
|
| 164 | +● I'll navigate to localhost:5173 and take a |
| 165 | + screenshot to see the menubar items. |
| 166 | +
|
| 167 | +● playwright:playwright_navigate (MCP)(url: … |
| 168 | + "http://local |
| 169 | + host:5173") |
| 170 | + ⎿ Navigated to http://localhost:5173 |
| 171 | +
|
| 172 | +● playwright:playwright_screenshot (MCP)(name: "lo… |
| 173 | + alhost_5173 |
| 174 | + _menubar") |
| 175 | +
|
| 176 | + ⎿ Screenshot saved to: ../../../Downloads/localho |
| 177 | + st_5173_menubar-2025-05-30T17-23-00-942Z.png |
| 178 | + ⎿ Screenshot also stored in memory with name: |
| 179 | + 'localhost_5173_menubar' |
| 180 | +
|
| 181 | +● Read(../../../Downloads/localhost_5173_menubar-2… |
| 182 | + 25-05-30T17-23-00-942Z.png) |
| 183 | + ⎿ Read image (94.3KB) |
| 184 | +
|
| 185 | +● Based on the screenshot, I can see the menubar at |
| 186 | + the top of the ComfyUI interface contains the |
| 187 | + following items: |
| 188 | +
|
| 189 | + Main Menubar Items: |
| 190 | + - Workflow - Menu for workflow-related actions |
| 191 | + - Edit - Menu for editing operations |
| 192 | + - Help - Menu for help and documentation |
| 193 | +
|
| 194 | + Additional UI Elements: |
| 195 | + - ComfyUI Logo - On the far left |
| 196 | + - Workflow Tab - Shows "Unsaved Workflow" with a |
| 197 | + dropdown and close button |
| 198 | + - Layout Controls - On the far right (grid view |
| 199 | + and hamburger menu icons) |
| 200 | +
|
| 201 | + The interface shows a typical ComfyUI workflow |
| 202 | + graph with nodes like "Load Checkpoint", "CLIP |
| 203 | + Text Encode (Prompt)", "KSampler", and "Empty |
| 204 | + Latent Image" connected with colored cables. |
| 205 | +``` |
| 206 | + |
| 207 | +## Testing |
| 208 | + |
| 209 | +### Unit Tests |
| 210 | + |
| 211 | +- `npm i` to install all dependencies |
| 212 | +- `npm run test:unit` to execute all unit tests |
| 213 | + |
| 214 | +### Component Tests |
| 215 | + |
| 216 | +Component tests verify Vue components in `src/components/`. |
| 217 | + |
| 218 | +- `npm run test:component` to execute all component tests |
| 219 | + |
| 220 | +### Playwright Tests |
| 221 | + |
| 222 | +Playwright tests verify the whole app. See [browser_tests/README.md](browser_tests/README.md) for details. |
| 223 | + |
| 224 | +### Running All Tests |
| 225 | + |
| 226 | +Before submitting a PR, ensure all tests pass: |
| 227 | + |
| 228 | +```bash |
| 229 | +npm run test:unit |
| 230 | +npm run test:component |
| 231 | +npm run test:browser |
| 232 | +npm run typecheck |
| 233 | +npm run lint |
| 234 | +npm run format |
| 235 | +``` |
| 236 | + |
| 237 | +## Code Style Guidelines |
| 238 | + |
| 239 | +### TypeScript |
| 240 | +- Use TypeScript for all new code |
| 241 | +- Avoid `any` types - use proper type definitions |
| 242 | +- Never use `@ts-expect-error` - fix the underlying type issue |
| 243 | + |
| 244 | +### Vue 3 Patterns |
| 245 | +- Use Composition API for all components |
| 246 | +- Follow Vue 3.5+ patterns (props destructuring is reactive) |
| 247 | +- Use `<script setup>` syntax |
| 248 | + |
| 249 | +### Styling |
| 250 | +- Use Tailwind CSS classes instead of custom CSS |
| 251 | +- Follow the existing dark theme pattern: `dark-theme:` prefix (not `dark:`) |
| 252 | + |
| 253 | +### Internationalization |
| 254 | +- All user-facing strings must use vue-i18n |
| 255 | +- Add translations to `src/locales/en/main.json` |
| 256 | +- Use translation keys: `const { t } = useI18n(); t('key.path')` |
| 257 | + |
| 258 | +## Custom Icons |
| 259 | + |
| 260 | +The project supports custom SVG icons through the unplugin-icons system. Custom icons are stored in `src/assets/icons/custom/` and can be used as Vue components with the `i-comfy:` prefix. |
| 261 | + |
| 262 | +For detailed instructions on adding and using custom icons, see [src/assets/icons/README.md](src/assets/icons/README.md). |
| 263 | + |
| 264 | +## Working with litegraph.js |
| 265 | + |
| 266 | +Since Aug 5, 2025, litegraph.js is now integrated directly into this repository. It was merged using git subtree to preserve the complete commit history ([PR #4667](https://github.com/Comfy-Org/ComfyUI_frontend/pull/4667), [ADR](docs/adr/0001-merge-litegraph-into-frontend.md)). |
| 267 | + |
| 268 | +### Important Notes |
| 269 | + |
| 270 | +- **Issue References**: Commits from the original litegraph repository may contain issue/PR numbers (e.g., #4667) that refer to issues/PRs in the original litegraph.js repository, not this one. |
| 271 | +- **File Paths**: When viewing historical commits, file paths may show the original structure before the subtree merge. In those cases, just consider the paths relative to the new litegraph folder. |
| 272 | +- **Contributing**: All litegraph modifications should now be made directly in this repository. |
| 273 | + |
| 274 | +The original litegraph repository (https://github.com/Comfy-Org/litegraph.js) is now archived. |
| 275 | + |
| 276 | +## Submitting Changes |
| 277 | + |
| 278 | +### Pull Request Process |
| 279 | + |
| 280 | +1. Ensure your branch is up to date with main |
| 281 | +2. Run all tests and ensure they pass |
| 282 | +3. Create a pull request with a clear title and description |
| 283 | +4. Use conventional commit format for PR titles: |
| 284 | + - `[feat]` for new features |
| 285 | + - `[fix]` for bug fixes |
| 286 | + - `[docs]` for documentation |
| 287 | + - `[refactor]` for code refactoring |
| 288 | + - `[test]` for test additions/changes |
| 289 | + - `[chore]` for maintenance tasks |
| 290 | + |
| 291 | +### PR Description Template |
| 292 | + |
| 293 | +``` |
| 294 | +## Description |
| 295 | +Brief description of the changes |
| 296 | +
|
| 297 | +## Type of Change |
| 298 | +- [ ] Bug fix |
| 299 | +- [ ] New feature |
| 300 | +- [ ] Breaking change |
| 301 | +- [ ] Documentation update |
| 302 | +
|
| 303 | +## Testing |
| 304 | +- [ ] Unit tests pass |
| 305 | +- [ ] Component tests pass |
| 306 | +- [ ] Browser tests pass (if applicable) |
| 307 | +- [ ] Manual testing completed |
| 308 | +
|
| 309 | +## Screenshots (if applicable) |
| 310 | +Add screenshots for UI changes |
| 311 | +``` |
| 312 | + |
| 313 | +### Review Process |
| 314 | + |
| 315 | +1. All PRs require at least one review |
| 316 | +2. Address review feedback promptly |
| 317 | +3. Keep PRs focused - one feature/fix per PR |
| 318 | +4. Large features should be discussed in an issue first |
| 319 | + |
| 320 | +## Questions? |
| 321 | + |
| 322 | +If you have questions about contributing: |
| 323 | +- Check existing issues and discussions |
| 324 | +- Ask in our [Discord](https://discord.com/invite/comfyorg) |
| 325 | +- Open a new issue for clarification |
| 326 | + |
| 327 | +Thank you for contributing to ComfyUI Frontend! |
0 commit comments