Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions docs/adr/0002-monorepo-conversion.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# 2. Restructure ComfyUI_frontend as a monorepo
Copy link
Contributor

@arjansingh arjansingh Aug 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the record, I'm for this. PNPM + NX. (And in hindsight should have just done a full code review 😂)


Date: 2025-08-25

## Status

Proposed

<!-- [Proposed | Accepted | Rejected | Deprecated | Superseded by [ADR-NNNN](NNNN-title.md)] -->

## Context

[Most of the context is in here](https://github.com/Comfy-Org/ComfyUI_frontend/issues/4661)

TL;DR: As we're merging more subprojects like litegraph, devtools, and soon a fork of PrimeVue,
a monorepo structure will help a lot with code sharing and organization.

For more information on Monorepos, check out [monorepo.tools](https://monorepo.tools/)

## Decision

- Swap out NPM for PNPM
- Add a workspace for the PrimeVue fork
- Move the frontend code into its own app workspace
- Longer term: Extract and reorganize common infrastructure to take advantage of the new monorepo tooling

### Tools proposed

[PNPM](https://pnpm.io/) and [PNPM workspaces](https://pnpm.io/workspaces)

For monorepo management, I'd probably go with [Nx](https://nx.dev/), but I could be conviced otherwise.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've had good experiences with NX. I've heard good things lately about Turborepo.

Anecdotally what I have heard from friends that have used both is that NX is a little harder to setup and maintain than Turborepo. But it's got way faster performance.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I've heard decent things about both of them. A few folks I tend to trust settled on Nx, but if it does end up being too painful, we can try Turbo.

There's a [whole list here](https://monorepo.tools/#tools-review) if you're interested.

## Consequences

### Positive

- Adding new projects with shared dependencies becomes really easy
- Makes the process of forking and customizing projects more structured, if not strictly easier
- It *could* speed up the build and development process (not guaranteed)
- It would let us cleanly organize and release packages like `comfyui-frontend-types`

### Negative

- Monorepos take some getting used to
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main trade off I've experienced:

  1. Working between packages gets much simpler. You don't have to navigate cross-repo dependency structures.
  2. The complexity just gets pushed to your build and CI process. If you don't keep those in good shape and reliable your productivity across all monorepo projects suffer.

- Reviews and code contribution management has to account for the different projects' situations and constraints

<!-- ## Notes

Optional section for additional information, references, or clarifications. -->
1 change: 1 addition & 0 deletions docs/adr/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ An Architecture Decision Record captures an important architectural decision mad
| ADR | Title | Status | Date |
|-----|-------|--------|------|
| [0001](0001-merge-litegraph-into-frontend.md) | Merge LiteGraph.js into ComfyUI Frontend | Accepted | 2025-08-05 |
| [0002](0002-monorepo-conversion.md) | Restructure as a Monorepo | Proposed | 2025-08-25 |

## Creating a New ADR

Expand Down