Diagram guide
Start with the short reading guide. The rest of this page is the authoring reference for the boxes, groups, arrows and Mermaid notation used in the architecture diagrams.
Reading a diagram
- Read the title first. Each diagram answers one question; the paragraph above it states the scope.
- Follow solid arrows for the main flow. Dotted arrows show a dependency, side effect or supporting call.
- Use the label at the top of a box to identify its kind, such as App, System App, Entry point or Database.
- Use “Where to look” after the diagram to move from the picture to the exact source files.
- For ER, class, sequence and use case notation, jump to the matching section on this page.
Authoring a flowchart box
- Start the text with the title in
<b>…</b>, then<br>and a short description. - End the line with the box type:
:::systemApp. The type sets the colour, icon and pill. - Use the brackets of the type's shape: cards
["…"], circles(("…")), the action shape{{"…"}}. <i>…</i>draws a small pill, mostly for the technology under a data store (<i>mysql</i>) or a person's role (<i>Admin</i>).- Keep circles short (a title, a pill and at most one line): a circle grows with its longest line.
- A note needs no title; write the remark itself, with
<br>where a line should break. - These boxes are for flowcharts. ER, class, sequence and use case diagrams have their own notation, shown at the end of this page.
Flowchart box catalog
Every box type the kit knows, built from COMPONENT_TYPES in
diagram-kit.js: a new type shows up here by itself. "From Figma" types copy
the Figma components; "Added" ones follow the same design in UI kit colours.
Framework window
A framework install, drawn as the Figma Framework window: a grey header with the title
and an Instance pill. Put the apps and parts that run inside the install in
the group, and add the class as the last line of the diagram (Mermaid
ignores it before an arrow to the group). The Figma has two variants:
class <id> framework: the plain window ("DB=No" in the Figma).class <id> frameworkDb: a database icon in the header, for an install drawn with its own database ("DB=Yes").
Plain
With its own database
Sections
Any other group (data stores, outside services, the parts of an app) is a plain light section with its title on top. It only groups boxes; it adds no meaning of its own.
direction LRinside a group lays its boxes out left to right, but Mermaid ignores it as soon as an arrow joins a box inside the group to one outside. Draw such arrows to the group itself (stores --> …) to keep the direction.- Groups can sit inside groups, e.g. an "Apps" section inside a Framework window.
Arrows
- Solid
-->: the main flow, a call or data moving. - Dotted
-.->: something used along the way, a link, or a side effect. - Both ways
<-->: reads and writes, e.g. the heartbeat and its task table. - Text on an arrow
-- "text" -->,-. text .->or<-->|"text"|: what happens there, in a few words. - To a whole group
install --> stores: when every part of a group is involved, point at the group rather than drawing many arrows. - Invisible
~~~: draws nothing, only places one box above (or beside) another. Use it to tidy loose boxes, e.g. stacking a manifest, an App class and migrations.
ER diagrams
How data is stored: one box per table with its columns, and a line per relationship.
Mermaid's erDiagram, in DoCloud colours.
- A box is a table; write its real name with the app prefix, e.g.
xp_users_roles. - Inside the box:
type column, withPKfor the primary key andFKfor a foreign key. - The line ends say how many:
||exactly one,o|zero or one,}|one or more,o{zero or more. The text after:names the relationship. - Show the key columns and the ones the docs talk about, not every column.
Class diagrams
How the code is organised: classes with their public methods, and how they extend
or use each other. Mermaid's classDiagram.
<<abstract>>or<<interface>>on the first line inside the box says what kind of class it is.+method() typeis a public method; list the ones a developer calls or overrides, at most six.A <|-- B: B extends A.A <|.. B: B implements A.A ..> B : text: A uses B.
Sequence diagrams
What happens over time between parts: who calls whom, in order. Mermaid's
sequenceDiagram. Use it where a flowchart would hide the back-and-forth.
participant B as Browsernames a column; put real file or class names in the label.A->>B: textis a call,B-->>A: texta reply.alt … else … endshows the branches, e.g. a 401 or a 503;Note over A,B: textadds a remark.
Use case diagrams
Who uses the system and for what. Mermaid's usecase-beta (new in Mermaid 12;
the keyword includes -beta).
actor Userdeclares a person or an outside system;Admin --|> Usersays an admin can do everything a user can.systemBoundary "Main app" … endgroups the use cases of one part of the system.User --> "Sign in"links an actor to a use case. Quote names with spaces.- Include and extend links are not drawn; say it in the prose instead.