Merlive

The library / C4 diagrams

C4 diagrams, drawn twice

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.

41 samples: 25 drawn as written, 16 drawn less something. Mermaid’s side is mermaid-cli 12.2.0 as it comes, on white. Merlive’s is 0.6.1 in its own look. What is read of a C4 diagram.

Systems: a system, one that is a database and one that is a queue

Drawn, less something A queue is drawn as a pill: there is no cylinder on its side yet

Mermaid
Systems: a system, one that is a database and one that is a queue, as Mermaid draws it
Merlive
Systems: a system, one that is a database and one that is a queue, as Merlive draws it
The Mermaid
C4Context
  System(erp, "ERP", "Holds orders and stock")
  SystemDb(ledger, "Ledger", "Every posting, kept for good")
  SystemQueue(jobs, "Job queue", "Work waiting to be done")
  Rel(erp, ledger, "Posts to")
  Rel(erp, jobs, "Queues work on")
Draw it yourself

Systems that are someone else's, a database and a queue among them

Drawn, less something A queue is drawn as a pill: there is no cylinder on its side yet

Mermaid
Systems that are someone else's, a database and a queue among them, as Mermaid draws it
Merlive
Systems that are someone else's, a database and a queue among them, as Merlive draws it
The Mermaid
C4Context
  System(erp, "ERP")
  System_Ext(bank, "Bank", "Pays suppliers")
  SystemDb_Ext(rates, "Exchange rates", "Kept by the bank")
  SystemQueue_Ext(feed, "Payment feed", "Payments as they clear")
  Rel(erp, bank, "Pays through")
  Rel(bank, rates, "Reads")
  Rel(bank, feed, "Writes to")
Draw it yourself

Containers, with what each is made in and what it does

Drawn, less something A queue is drawn as a pill: there is no cylinder on its side yet

Mermaid
Containers, with what each is made in and what it does, as Mermaid draws it
Merlive
Containers, with what each is made in and what it does, as Merlive draws it
The Mermaid
C4Container
  Container(web, "Web shop", "React", "Where buyers raise orders")
  Container(api, "Order API", "C#, ASP.NET", "Checks and saves orders")
  ContainerDb(db, "Orders", "SQL Server", "Every order and its lines")
  ContainerQueue(bus, "Order events", "Azure Service Bus", "Tells the rest what happened")
  Rel(web, api, "Calls")
  Rel(api, db, "Reads and writes")
  Rel(api, bus, "Publishes to")
Draw it yourself

Containers that are someone else's

Drawn, less something A queue is drawn as a pill: there is no cylinder on its side yet

Mermaid
Containers that are someone else's, as Mermaid draws it
Merlive
Containers that are someone else's, as Merlive draws it
The Mermaid
C4Container
  Container(api, "Order API", "C#")
  Container_Ext(mail, "Mail service", "SMTP", "Sends confirmations")
  ContainerDb_Ext(crm, "Customer records", "Dynamics", "Who the buyers are")
  ContainerQueue_Ext(hook, "Web hooks", "HTTPS", "Tells partners")
  Rel(api, mail, "Sends through")
  Rel(api, crm, "Looks up buyers in")
  Rel(api, hook, "Publishes to")
Draw it yourself

Components, with what each is made in and what it does

Drawn, less something A queue is drawn as a pill: there is no cylinder on its side yet

Mermaid
Components, with what each is made in and what it does, as Mermaid draws it
Merlive
Components, with what each is made in and what it does, as Merlive draws it
The Mermaid
C4Component
  Component(check, "Order checker", "C# class", "Checks an order against its budget")
  Component(save, "Order store", "Repository", "Saves an order and its lines")
  ComponentDb(cache, "Price cache", "Redis", "Prices read in the last hour")
  ComponentQueue(out, "Outbox", "Table", "Events waiting to be sent")
  Rel(check, cache, "Reads prices from")
  Rel(check, save, "Hands a good order to")
  Rel(save, out, "Writes to")
Draw it yourself

Components that are someone else's

Drawn, less something A queue is drawn as a pill: there is no cylinder on its side yet

Mermaid
Components that are someone else's, as Mermaid draws it
Merlive
Components that are someone else's, as Merlive draws it
The Mermaid
C4Component
  Component(check, "Order checker", "C# class")
  Component_Ext(tax, "Tax rules", "NuGet package", "Bought in")
  ComponentDb_Ext(codes, "Tax codes", "SQLite", "Shipped with the package")
  ComponentQueue_Ext(audit, "Audit trail", "Kafka", "Run by another team")
  Rel(check, tax, "Asks")
  Rel(tax, codes, "Reads")
  Rel(check, audit, "Writes to")
Draw it yourself

A boundary round some of the elements

Drawn

Mermaid
A boundary round some of the elements, as Mermaid draws it
Merlive
A boundary round some of the elements, as Merlive draws it
The Mermaid
C4Context
  Person(buyer, "Buyer")
  Boundary(firm, "The firm") {
    System(erp, "ERP")
    System(stock, "Stock control")
  }
  Rel(buyer, erp, "Raises orders in")
  Rel(erp, stock, "Checks stock with")
Draw it yourself

An enterprise's boundary with a system's boundary inside it

Drawn, less something Mermaid writes [ENTERPRISE] and [SYSTEM] under the names of these boundaries; a type that was not written is not added

Mermaid
An enterprise's boundary with a system's boundary inside it, as Mermaid draws it
Merlive
An enterprise's boundary with a system's boundary inside it, as Merlive draws it
The Mermaid
C4Context
  Enterprise_Boundary(firm, "The firm") {
    Person(buyer, "Buyer")
    System_Boundary(core, "Core systems") {
      System(erp, "ERP")
      System(stock, "Stock control")
    }
  }
  Rel(buyer, erp, "Raises orders in")
  Rel(erp, stock, "Checks stock with")
Draw it yourself

A container's boundary

Drawn, less something Mermaid writes [CONTAINER] under the name of this boundary; a type that was not written is not added

Mermaid
A container's boundary, as Mermaid draws it
Merlive
A container's boundary, as Merlive draws it
The Mermaid
C4Container
  Person(buyer, "Buyer")
  Container_Boundary(shop, "Web shop") {
    Container(web, "Pages", "React")
    Container(api, "Order API", "C#")
  }
  Rel(buyer, web, "Uses")
  Rel(web, api, "Calls")
Draw it yourself

Boundaries three deep

Drawn, less something Mermaid writes [ENTERPRISE], [SYSTEM] and [CONTAINER] under the names of these boundaries; a type that was not written is not added

Mermaid
Boundaries three deep, as Mermaid draws it
Merlive
Boundaries three deep, as Merlive draws it
The Mermaid
C4Container
  Enterprise_Boundary(firm, "The firm") {
    System_Boundary(erp, "ERP") {
      Container_Boundary(orders, "Ordering") {
        Container(api, "Order API", "C#")
        ContainerDb(db, "Orders", "SQL Server")
      }
      Container(stock, "Stock service", "C#")
    }
  }
  Rel(api, db, "Saves to")
  Rel(api, stock, "Asks")
Draw it yourself

A deployment: nodes inside a node, and what runs on each

Drawn

Mermaid
A deployment: nodes inside a node, and what runs on each, as Mermaid draws it
Merlive
A deployment: nodes inside a node, and what runs on each, as Merlive draws it
The Mermaid
C4Deployment
  Deployment_Node(azure, "Azure", "West Europe") {
    Deployment_Node(app, "App Service", "Linux") {
      Container(api, "Order API", "C#", "Checks and saves orders")
    }
    Deployment_Node(sql, "Azure SQL", "General purpose") {
      ContainerDb(db, "Orders", "SQL Server", "Every order and its lines")
    }
  }
  Rel(api, db, "Reads and writes", "TDS")
Draw it yourself

Nodes written as Node, Node_L and Node_R

Drawn

Mermaid
Nodes written as Node, Node_L and Node_R, as Mermaid draws it
Merlive
Nodes written as Node, Node_L and Node_R, as Merlive draws it
The Mermaid
C4Deployment
  Node(dc, "Data centre", "Leeds") {
    Node_L(web, "Web server", "nginx") {
      Container(site, "Web shop", "React")
    }
    Node_R(appsrv, "App server", "IIS") {
      Container(api, "Order API", "C#")
    }
  }
  Rel(site, api, "Calls", "HTTPS")
Draw it yourself

A node that is described as well as named

Drawn, less something What a node is described as is not drawn: a group has a name and nothing more

Mermaid
A node that is described as well as named, as Mermaid draws it
Merlive
A node that is described as well as named, as Merlive draws it
The Mermaid
C4Deployment
  Deployment_Node(phone, "Buyer's phone", "iOS or Android", "Whatever the buyer carries") {
    Container(app, "Ordering app", "React Native", "Raises orders on the move")
  }
  Deployment_Node(cloud, "Cloud", "Azure") {
    Container(api, "Order API", "C#")
  }
  Rel(app, api, "Calls", "HTTPS")
Draw it yourself

A relation

Drawn

Mermaid
A relation, as Mermaid draws it
Merlive
A relation, as Merlive draws it
The Mermaid
C4Context
  Person(buyer, "Buyer")
  System(erp, "ERP")
  Rel(buyer, erp, "Raises orders in")
Draw it yourself

Relations that say which way Mermaid should draw them

Drawn, less something Up, down, left and right are read past: where a box goes is Merlive's to say

Mermaid
Relations that say which way Mermaid should draw them, as Mermaid draws it
Merlive
Relations that say which way Mermaid should draw them, as Merlive draws it
The Mermaid
C4Context
  System(erp, "ERP")
  System(stock, "Stock control")
  System(ledger, "Ledger")
  System(mail, "Mail")
  System(bank, "Bank link")
  Rel_U(erp, stock, "Checks stock with")
  Rel_Up(stock, ledger, "Values stock in")
  Rel_D(erp, ledger, "Posts to")
  Rel_Down(ledger, bank, "Pays through")
  Rel_L(erp, mail, "Sends through")
  Rel_Left(mail, bank, "Copies")
  Rel_R(erp, bank, "Asks")
  Rel_Right(stock, mail, "Warns through")
Draw it yourself

A dynamic diagram: what happens, in order

Drawn

Mermaid
A dynamic diagram: what happens, in order, as Mermaid draws it
Merlive
A dynamic diagram: what happens, in order, as Merlive draws it
The Mermaid
C4Dynamic
  title Raising an order
  Person(buyer, "Buyer")
  Container(web, "Web shop", "React")
  Container(api, "Order API", "C#")
  ContainerDb(db, "Orders", "SQL Server")
  Rel(buyer, web, "Fills in the order")
  Rel(web, api, "Sends it", "HTTPS")
  Rel(api, db, "Saves it")
  Rel(api, web, "Answers with its number")
Draw it yourself

Relations given an index

Drawn

Mermaid
Relations given an index, as Mermaid draws it
Merlive
Relations given an index, as Merlive draws it
The Mermaid
C4Dynamic
  Container(web, "Web shop", "React")
  Container(api, "Order API", "C#")
  ContainerDb(db, "Orders", "SQL Server")
  RelIndex(1, web, api, "Sends the order")
  RelIndex(2, api, db, "Saves it")
  RelIndex(5, api, web, "Answers with its number")
Draw it yourself

Arguments given by name

Drawn

Mermaid
Arguments given by name, as Mermaid draws it
Merlive
Arguments given by name, as Merlive draws it
The Mermaid
C4Container
  Person(buyer, "Buyer", $descr="Raises purchase orders")
  Container(api, "Order API", $techn="C#", $descr="Checks and saves orders")
  ContainerDb(db, "Orders", $techn="SQL Server")
  Rel(buyer, api, "Raises orders through", $techn="HTTPS")
  Rel(api, db, "Saves to", $descr="One row an order")
Draw it yourself

Arguments left empty

Drawn

Mermaid
Arguments left empty, as Mermaid draws it
Merlive
Arguments left empty, as Merlive draws it
The Mermaid
C4Container
  Container(web, "Web shop", "", "Where buyers raise orders")
  Container(api, "Order API",, "Checks and saves orders")
  ContainerDb(db, "Orders", "SQL Server")
  Rel(web, api, "Calls", "")
  Rel(api, db, "Saves to")
Draw it yourself

An element given colours of its own

Drawn, less something Its fill is the colour written, as the nearest colour of the design; the colours of its words and its edge are the design's

Mermaid
An element given colours of its own, as Mermaid draws it
Merlive
An element given colours of its own, as Merlive draws it
The Mermaid
C4Context
  Person(buyer, "Buyer")
  System(erp, "ERP")
  System(old, "Old stock system")
  Rel(buyer, erp, "Raises orders in")
  Rel(erp, old, "Still reads")
  UpdateElementStyle(old, $fontColor="#ffffff", $bgColor="#b3261e", $borderColor="#7a1f12")
Draw it yourself

An element given colours by name

Drawn, less something A colour given by name is not read: only one written as #rrggbb is

Mermaid
An element given colours by name, as Mermaid draws it
Merlive
An element given colours by name, as Merlive draws it
The Mermaid
C4Context
  Person(buyer, "Buyer")
  System(erp, "ERP")
  Rel(buyer, erp, "Raises orders in")
  UpdateElementStyle(buyer, $fontColor="red", $bgColor="grey", $borderColor="red")
Draw it yourself

A relation given colours of its own, and its words moved

Drawn, less something A link's colour is the design's; where its words sit is Merlive's to place

Mermaid
A relation given colours of its own, and its words moved, as Mermaid draws it
Merlive
A relation given colours of its own, and its words moved, as Merlive draws it
The Mermaid
C4Context
  Person(buyer, "Buyer")
  System(erp, "ERP")
  Rel(buyer, erp, "Raises orders in")
  UpdateRelStyle(buyer, erp, $textColor="blue", $lineColor="blue", $offsetX="5", $offsetY="-10")
Draw it yourself

A title

Drawn

Mermaid
A title, as Mermaid draws it
Merlive
A title, as Merlive draws it
The Mermaid
C4Container
  title Containers of the ordering system
  Container(web, "Web shop", "React")
  Container(api, "Order API", "C#")
  Rel(web, api, "Calls")
Draw it yourself

Front matter with a title

Drawn

Mermaid
Front matter with a title, as Mermaid draws it
Merlive
Front matter with a title, as Merlive draws it
The Mermaid
---
title: Ordering, from the front matter
---
C4Context
  Person(buyer, "Buyer")
  System(erp, "ERP")
  Rel(buyer, erp, "Raises orders in")
Draw it yourself

accTitle and accDescr

Drawn

Mermaid
accTitle and accDescr, as Mermaid draws it
Merlive
accTitle and accDescr, as Merlive draws it
The Mermaid
C4Context
  accTitle: Who orders, and in what
  accDescr: A buyer raises orders in the ERP
  Person(buyer, "Buyer")
  System(erp, "ERP")
  Rel(buyer, erp, "Raises orders in")
Draw it yourself

Comments on lines of their own

Drawn

Mermaid
Comments on lines of their own, as Mermaid draws it
Merlive
Comments on lines of their own, as Merlive draws it
The Mermaid
%% who is in the picture
C4Context
  %% the one who orders
  Person(buyer, "Buyer")
  System(erp, "ERP")
  %% and what they do
  Rel(buyer, erp, "Raises orders in")
Draw it yourself

Commas, brackets and %% inside quotes

Drawn

Mermaid
Commas, brackets and %% inside quotes, as Mermaid draws it
Merlive
Commas, brackets and %% inside quotes, as Merlive draws it
The Mermaid
C4Context
  Person(buyer, "Buyer (purchasing)", "Raises orders, chases them, and closes them")
  System(erp, "ERP [live]", "Holds orders; says %% nothing of stock")
  Rel(buyer, erp, "Raises orders in (daily, mostly)")
Draw it yourself

An element declared twice

Drawn

Mermaid
An element declared twice, as Mermaid draws it
Merlive
An element declared twice, as Merlive draws it
The Mermaid
C4Context
  Person(buyer, "Buyer")
  System(erp, "ERP")
  Rel(buyer, erp, "Raises orders in")
  System(erp, "ERP, the new one", "Replaces the old stock system")
Draw it yourself

A whole diagram: people, a boundary of containers, a database, a queue and a system outside

Drawn, less something A queue is drawn as a pill: there is no cylinder on its side yet

Mermaid
A whole diagram: people, a boundary of containers, a database, a queue and a system outside, as Mermaid draws it
Merlive
A whole diagram: people, a boundary of containers, a database, a queue and a system outside, as Merlive draws it
The Mermaid
C4Container
  title Ordering: who uses it and what it is made of
  Person(buyer, "Buyer", "Raises and chases purchase orders")
  Person_Ext(rep, "Sales rep", "Answers for the supplier")
  System_Boundary(ordering, "Ordering") {
    Container(web, "Web shop", "React", "Where orders are raised")
    Container(api, "Order API", "C#, ASP.NET", "Checks and saves orders")
    ContainerDb(db, "Orders", "SQL Server", "Every order and its lines")
    ContainerQueue(bus, "Order events", "Azure Service Bus", "What happened, for the rest to hear")
  }
  System_Ext(portal, "Supplier portal", "Takes orders from firms")
  Rel(buyer, web, "Raises orders in", "HTTPS")
  Rel(web, api, "Calls", "JSON over HTTPS")
  Rel(api, db, "Reads and writes")
  Rel(api, bus, "Publishes to")
  BiRel(api, portal, "Trades orders and answers with")
  Rel(rep, portal, "Answers orders in")
Draw it yourself