1.8 KiB
1.8 KiB
LayerForge frontend architecture
The TypeScript files under src/ are the frontend source of truth. The
tracked JavaScript files under js/ are generated by build.bat and must not
be edited independently.
Domain responsibilities
| Domain | Responsibility |
|---|---|
app/ |
ComfyUI extension registration, node lifecycle, and application composition |
canvas/ |
Canvas state, layers, rendering, interaction, tools, and layer panel |
io/ |
Input connections, tensor/image transport, and canvas output transport |
mask/ |
Mask editing, pixel processing, SAM, and matting integrations |
media/ |
Image/blob conversion, in-memory image cache, preview, upload, and export helpers |
persistence/ |
IndexedDB state, reference tracking, and state worker |
shared/ |
Cross-domain types, configuration, errors, and logging adapters |
utils/ |
Small compatibility and UI helpers that have not yet earned a domain |
log_system/ |
Canonical logging implementation |
Dependency direction
app/ is the composition layer and may depend on the other frontend domains.
The lower-level domains remain independent of application composition:
shared/must not import frontend domains at runtime;media/must not importapp/,canvas/,io/,mask/, orpersistence/;persistence/must not importapp/,io/,mask/, ormedia/;- type-only imports may describe relationships without creating runtime dependencies;
- ComfyUI-provided modules under
scripts/are external runtime dependencies.
The root src/CanvasView.ts file is the single served bootstrap. It invokes
the registration function from src/app/CanvasView.ts; the implementation
module itself must not register the extension as an import side effect.
The dependency rules are covered by tests/test_architecture_boundaries.mjs.