A diagram is the central entity in MC Modeler — it holds a complete BPMN 2.0 model serialised as XML, plus metadata such as a thumbnail preview, an element count, and versioning information. Diagrams live either at the top level (loose) or inside a project, and multiple diagrams can be open simultaneously in the tabbed editor.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Aston2710/mc-modeler/llms.txt
Use this file to discover all available pages before exploring further.
The Diagram interface
The
schemaVersion field is reserved for future data migrations. All diagrams created today start at version 1. When the XML schema changes in a future release, a migration routine will increment this value so older diagrams can be automatically upgraded on first open.Creating a diagram
Click the + New diagram button in the toolbar or the Create diagram card at the top-left of the diagram grid. Either path opens the New diagram modal where you enter a name, then the store callscreateDiagram(name, projectId?):
.bpmn or .bpm file, the XML is first normalised through a canonical serialiser and any base64-embedded images are extracted to Storage before the Diagram is saved — ensuring the persisted XML never contains large inline blobs.
The DiagramList view
The home screen renders diagrams as a responsive grid of cards or a compact list of rows — toggle between them with the grid/list buttons in the top-right of the content area. Each DiagramCard shows:- A thumbnail preview (SVG data URL) or a file-text placeholder icon when no thumbnail has been generated yet.
- The diagram name.
- A relative timestamp of the last modification and the element count.
- Live presence avatars showing collaborators currently editing the diagram (cloud mode only).
- A ⋯ kebab menu with Open and Delete actions.
DiagramCard and DiagramRow components in DiagramList.tsx. A global search field (⌘K / Ctrl+K) filters by name across all diagrams and folders simultaneously.
Thumbnail auto-generation
Thumbnails are generated as SVG data URLs directly from the bpmn-js canvas after each save. The utilitybuildThumbnail in src/utils/thumbnailUtils.ts renders the diagram in light theme regardless of the user’s current theme preference, ensuring consistent preview images.
For diagrams with two or more pools, only the top pool (lowest y coordinate) is used as the thumbnail crop, keeping the preview readable when the full diagram would be too small to identify.
Thumbnails are stored separately from the diagram XML via dedicated repository methods, keeping the main list query lean:
saveThumbnail returns the new updatedAt value if the database trigger bumped it (first thumbnail for a diagram). The caller must adopt this value as the current CAS token to avoid phantom conflicts on the next save.
On initial load, thumbnails are hydrated in the background after the diagram cards are already visible — the list never blocks on thumbnail fetches.
Renaming a diagram
Rename a diagram through its context menu or the properties panel. The store callsrenameDiagram(id, name), which delegates to the targeted repository method setDiagramName:
setDiagramName issues a narrowly scoped UPDATE that only touches the name column. The full save(diagram) path is intentionally not used for renaming because it would write the in-memory XML — which may be stale in a collaborative session — risking a silent overwrite of another user’s work.Duplicating a diagram
Select Duplicate from the ⋯ menu. The store fetches the source diagram’s XML if it is not already in memory, copies all Storage images to a new path under the duplicate’s ID (viarehomeImages), then saves the copy as a new Diagram with a fresh UUID, createdAt/updatedAt, and a (copia) name suffix. The duplicate starts with no thumbnail.
Opening a diagram and tabs
Clicking a diagram card callsopenDiagram(id), which adds a DiagramTab entry if one does not already exist and sets it as the active tab. The TabsBar at the top of the editor shows all open tabs simultaneously.
closeTab(id), which focuses the nearest remaining tab.
The XML for a diagram is not loaded when the list populates — it is fetched on demand the first time a diagram is opened via ensureXml(id) and cached in memory. If the XML is already cached from a previous open, it is returned immediately without a network round trip.
Auto-save and the unsavedChanges flag
The editor runs an auto-save timer (default 20 seconds) after any change that sets the unsavedChanges flag. A random jitter of 0–5 seconds is added to decorrelate save attempts from different collaborators editing the same diagram simultaneously, reducing CAS conflicts. While unsaved changes exist, the unsavedChanges flag in UIState is true and the status bar shows an Unsaved changes indicator.
Saves are serialised through a saveChain promise so that concurrent auto-saves from the same client never race against each other.
Optimistic CAS: conflict detection
Every save callsIDiagramRepository.save(diagram, expectedUpdatedAt). The expectedUpdatedAt argument is the updatedAt value the client loaded. If another writer has saved between the client’s load and this save, the server updated_at will differ and the repository throws a DiagramConflictError.
updatedAt and continues. If the content genuinely differs, the store retries once with the fresh updatedAt. On a second conflict, it emits a flujo:save-conflict custom DOM event so the UI can offer the user a choice between loading the server version or saving their copy as a duplicate.
Sub-process diagrams
A sub-process element on a BPMN diagram can link to a dedicated child diagram. The childDiagram records:
parentDiagramId— the UUID of the parent diagram.subProcessElementId— the ID of thebpmn:SubProcesselement within the parent’s XML.
getChildren(parentId) and getChildByElement(parentId, subProcessElementId) let the editor navigate the sub-process hierarchy. deleteWithChildren(id) recursively soft-deletes a parent and all its descendant sub-process diagrams.
Filters and sort reference
| Filter value | Behaviour |
|---|---|
all | All diagrams in the current scope |
recent | Modified within the last 7 days |
own | Diagrams you own (not shared with you) |
shared | Diagrams shared with you by another user |
| Sort key | Default direction |
|---|---|
updated | Newest first |
created | Newest first |
name | A–Z (locale-aware, case-insensitive) |
elements | Most elements first |
UserPreferences.diagramSort and survive page reloads. Clicking the active sort option toggles between ascending and descending.