Merlive

C4 diagrams

A person, a system, a container or a component is a box that says what it is and a sentence of what it does; a boundary is a group. Held to the same measure.

Declared with C4Context. Of 41 features Mermaid documents for a C4 diagram, 25 drawn as written, 16 drawn less something. See all 41 drawn both ways, or draw one yourself.

Mermaid
C4 diagram, as Mermaid draws it
Merlive
C4 diagram, as Merlive draws it

What is read

C4Context, C4Container, C4Component, C4Dynamic and C4Deployment are read into the same boxes and links as a flowchart, so everything else on this page holds for them: the rules, the design, Merlive's own lines. An element is a box that says what it is over its name and what it does under it; a boundary is a group; a relation is a link. In Merlive's own lines an element is its alias (%% note erp: …, %% main: buyer>erp).

WrittenRead as
Person(buyer, "Buyer", "Raises orders")A person: a box with the drawing of a person, «person» over its name, and what they do as its text
System(erp, "ERP", "Holds orders")A system: «system» over its name
Container(api, "Order API", "C#", "Checks orders"), Component(…)A container or a component, with what it is made in: «container: C#», «component: Repository»
SystemDb, ContainerDb, ComponentDbThe same, drawn as a cylinder, of the kind that holds data: «container database: SQL Server»
SystemQueue, ContainerQueue, ComponentQueueThe same, drawn as a pill, of the kind that holds data: «container queue: Service Bus»
Person_Ext, System_Ext, ContainerDb_Ext and every other _ExtSomeone else's: of the kind external, and said so over its name («external system»)
System(erp), System(erp, "ERP<br/>live")An element with no label is called by its alias; a <br/> in a label is a new line, and in a description a space
An element declared twiceThe same element, said anew: the later line is what it is
Boundary(firm, "The firm") { … }, Enterprise_Boundary, System_Boundary, Container_BoundaryA group of what is declared inside it, called by its label. The { may be on the line below
Boundary(dept, "Buying", "department") { … }A type that is written is added to the name: Buying [department]. One that is only implied (Enterprise_Boundary) is not
Deployment_Node(azure, "Azure", "West Europe") { … }, Node, Node_L, Node_RA node of a deployment is a group too, called Azure [West Europe]
A boundary inside a boundaryA group inside a group
A boundary or a node with nothing in itA box of its name, «boundary» or «node: nginx» over it, with what it was described as for its text
Rel(buyer, erp, "Raises orders in")A link with an arrowhead, and its words
Rel(web, api, "Calls", "HTTPS")How it is made, after its words: Calls [HTTPS]. What a relation is described as beyond that is read past, as Mermaid reads past it
BiRel(erp, bank, "Reconciles with")A link with an arrowhead at both ends
Rel_Back(buyer, erp, "Is told by")A link from the second to the first
Rel_U, Rel_Up, Rel_D, Rel_Down, Rel_L, Rel_Left, Rel_R, Rel_RightA relation like any other: where a box goes is Merlive's to say
Rel(…) in a C4Dynamic diagram, RelIndex(7, web, api, "Sends")Numbered in the order written, as Mermaid numbers them: 1: Sends. The index a relation is given is read past, as Mermaid reads past it
Two relations between the same twoBoth drawn. Mermaid keeps only the last
A relation with a boundaryA link to where the boundary begins, or from where it ends, as a link to any group is
$descr="…", $techn="…", $type="…"An argument given by name, wherever it stands
"", or nothing between two commasAn argument left out
"Raises orders, chases them (daily)"Words in quotes keep their commas and brackets, and may run on down the lines
$link="…", $tags="…", $sprite="…"Read past: a page runs nothing of an author's, and Mermaid draws neither tags nor sprites
UpdateElementStyle(erp, $bgColor="#b3261e")A colour written as #rrggbb makes the element of the kind named for its hue, as a flowchart's style does; an element that is someone else's or holds data stays what it is. The colour of its words and its shadow are the design's
UpdateRelStyle(buyer, erp, $offsetX="5"), UpdateLayoutConfig($c4ShapeInRow="2")Read past: where a link's words sit and how many boxes are in a row are Merlive's to place
title Ordering, in context, title: in front matterWhat the picture is called, drawn above a still picture and as the heading of a page
accTitle, accDescr, %% commentsAs in a flowchart

Not read, each named in a note, line when met: what a node of a deployment is described as when it has elements in it (a group has a name and nothing more); a colour given by name ($bgColor="grey": write it as #rrggbb); a colour for a boundary or for a link (UpdateRelStyle(…, $lineColor="blue")), which are the design's. A relation that names something nothing declares makes a box of that name, and says so. A line that is none of the above is said with its line number and nothing is drawn from it.

Merlive reads more kindly than Mermaid in three places, none of which changes a diagram Mermaid can draw: a last argument written without quotes (System(erp)), a comment after a line, and a relation with no words.

Feature by feature

Every feature Mermaid’s own pages set out for a C4 diagram, each with a sample of it in the corpus. A sample is drawn when every box, link and word it has is read and every rule passes. Drawn, less something is the same with one thing known to be missing, named beside it.

FeatureResultWhat is missing
A system in its context: a person, a system and one that is someone else'sDrawn
People: one of the firm and one outside itDrawn
Systems: a system, one that is a database and one that is a queueDrawn, less somethingA queue is drawn as a pill: there is no cylinder on its side yet
Systems that are someone else's, a database and a queue among themDrawn, less somethingA queue is drawn as a pill: there is no cylinder on its side yet
Containers, with what each is made in and what it doesDrawn, less somethingA queue is drawn as a pill: there is no cylinder on its side yet
Containers that are someone else'sDrawn, less somethingA queue is drawn as a pill: there is no cylinder on its side yet
Components, with what each is made in and what it doesDrawn, less somethingA queue is drawn as a pill: there is no cylinder on its side yet
Components that are someone else'sDrawn, less somethingA queue is drawn as a pill: there is no cylinder on its side yet
A boundary round some of the elementsDrawn
A boundary that says what kind of boundary it isDrawn
An enterprise's boundary with a system's boundary inside itDrawn, less somethingMermaid writes [ENTERPRISE] and [SYSTEM] under the names of these boundaries; a type that was not written is not added
A container's boundaryDrawn, less somethingMermaid writes [CONTAINER] under the name of this boundary; a type that was not written is not added
Boundaries three deepDrawn, less somethingMermaid writes [ENTERPRISE], [SYSTEM] and [CONTAINER] under the names of these boundaries; a type that was not written is not added
A boundary whose { is on the line below itDrawn
A deployment: nodes inside a node, and what runs on eachDrawn
Nodes written as Node, Node_L and Node_RDrawn
A node that is described as well as namedDrawn, less somethingWhat a node is described as is not drawn: a group has a name and nothing more
A relationDrawn
A relation that says how it is made, and one that is describedDrawn
A relation that runs both waysDrawn
A relation that runs back, from the second to the firstDrawn
Relations that say which way Mermaid should draw themDrawn, less somethingUp, down, left and right are read past: where a box goes is Merlive's to say
A dynamic diagram: what happens, in orderDrawn
Relations given an indexDrawn
Arguments given by nameDrawn
Tags, links and spritesDrawn, less somethingA link is not followed: a page runs nothing of an author's. Tags and sprites are read past, as Mermaid reads past them
Arguments left emptyDrawn
An element given colours of its ownDrawn, less somethingIts fill is the colour written, as the nearest colour of the design; the colours of its words and its edge are the design's
An element given colours by nameDrawn, less somethingA colour given by name is not read: only one written as #rrggbb is
A relation given colours of its own, and its words movedDrawn, less somethingA link's colour is the design's; where its words sit is Merlive's to place
A relation whose words are movedDrawn
How many elements and boundaries Mermaid should put in a rowDrawn
A titleDrawn
Front matter with a titleDrawn
accTitle and accDescrDrawn
Comments on lines of their ownDrawn
Commas, brackets and %% inside quotesDrawn
A line break in a label and in a descriptionDrawn
Words in quotes that run on down the linesDrawn
An element declared twiceDrawn
A whole diagram: people, a boundary of containers, a database, a queue and a system outsideDrawn, less somethingA queue is drawn as a pill: there is no cylinder on its side yet

Written from skills/merlive/reference.md in the repository, so the two cannot disagree.

Before: Requirement diagramsNext: Architecture diagrams