Menu

Cards and zones

Cards are the boxes of a diagram; zones group them. Both take a title, classes and a few attributes.

Cards

{"skemo":1,"name":"cards.skemo","source":"diagram(dir=\"right\")\n card#plain Plain card\n card#typed.t2 Typed card\n | first line\n | 192.168.1.0/24 office\n card#tagged.t1(tag=\"Owner: ops\") With a tag\n | the chip shows the tag\n","theme":"light"}Plain cardT2Typed cardfirst line192.168.1.0/24officeT1With a tagOwner: opsthe chip shows the tag
{"skemo":1,"name":"cards.skemo","source":"diagram(dir=\"right\")\n card#plain Plain card\n card#typed.t2 Typed card\n | first line\n | 192.168.1.0/24 office\n card#tagged.t1(tag=\"Owner: ops\") With a tag\n | the chip shows the tag\n","theme":"dark"}Plain cardT2Typed cardfirst line192.168.1.0/24officeT1With a tagOwner: opsthe chip shows the tag
cards.skemo
diagram(dir="right")
  card#plain Plain card
  card#typed.t2 Typed card
    | first line
    | 192.168.1.0/24 office
  card#tagged.t1(tag="Owner: ops") With a tag
    | the chip shows the tag
WriteEffect
card#id Titlea card; the text after the tag is its title
| texta content line, indented under the card. A line that starts with an IPv4 address or a CIDR block shows it in monospace. (Preview) |.pill 8080 · http: the line takes its classes; the theme's .pill draws it as a pill tinted with the card's colour
.typethe card's type: its colour and badge come from CSS
tag="…"the text of the card's chip (an owner, a module, a port)
label="…" (preview)the card's category, above its name; by default the type's --label; label="" shows none. See Rich cards
icon="…", href="…"an icon before the title, a link: see Icons and links
at="x,y"a pinned position: see Layout

Keep titles short (under about 30 characters): a long title widens the card, while long lines wrap. Three or four lines per card read best.

A card without lines has its title centred; with lines, the title stays on the left above them. In a column of cards (a wrap="1" zone, a stack) where others have lines, a card without lines keeps the column's alignment.

Piles of cards (preview)

{"skemo":1,"name":"piles.skemo","source":"diagram(dir=\"right\")\n card#lb.t3(tag=\"ALB\") Load balancer\n to(api) HTTPS\n cards#api.t2(count=\"4\" tag=\"ECS\") api\n | 4 tasks\n to(db) 5432\n cards#jobs.t2 workers\n | autoscaled\n to(db)\n card#db.t1(tag=\"RDS\") orders\n","theme":"light"}T3Load balancerALBT2apiECS4 tasks×4T2workersautoscaledT1ordersRDSHTTPS5432
{"skemo":1,"name":"piles.skemo","source":"diagram(dir=\"right\")\n card#lb.t3(tag=\"ALB\") Load balancer\n to(api) HTTPS\n cards#api.t2(count=\"4\" tag=\"ECS\") api\n | 4 tasks\n to(db) 5432\n cards#jobs.t2 workers\n | autoscaled\n to(db)\n card#db.t1(tag=\"RDS\") orders\n","theme":"dark"}T3Load balancerALBT2apiECS4 tasks×4T2workersautoscaledT1ordersRDSHTTPS5432
piles.skemo
diagram(dir="right")
  card#lb.t3(tag="ALB") Load balancer
    to(api) HTTPS
  cards#api.t2(count="4" tag="ECS") api
    | 4 tasks
    to(db) 5432
  cards#jobs.t2 workers
    | autoscaled
    to(db)
  card#db.t1(tag="RDS") orders

cards instead of card draws a pile: several instances of one thing (the tasks of a service, the machines of a group). It is a card in every respect: lines, arrows, classes, chip. count="4" says how many: up to three cards are drawn, and a ×4 badge sits on the pile's bottom-right corner, at the same place in every look. Without count, three cards and no badge. The cards behind belong to the card's box: arrows end on them and the top card keeps the width of its neighbours.

zones instead of zone does the same for a group: several instances of one group (the clusters of a fleet, the replicas of a region) drawn as a pile of frames. What the zone holds is drawn once, in the frame on top; count reads as on cards.

Nodes

{"skemo":1,"name":"nodes.skemo","source":"diagram(dir=\"right\" look=\"header\")\n node#user(icon=\"user\") Customer\n | web and mobile\n to(api) HTTPS\n card#api.service(tag=\"ECS\") API\n | 3 tasks\n to(db cache)\n node#db.db(icon=\"database\") Orders\n | PostgreSQL 16\n | Multi-AZ, encrypted\n node#cache.cache(icon=\"zap\") Cache\n | Redis 7\n","css":[{"name":"nodes.css","content":"/* the card keeps its look; the nodes are drawn the same in every look */\n.service { --c: #3E6FC4; --label: \"Service\"; }\n.db { --c: #D9892B; }\n.cache { --c: #C94A44; }\n"}],"theme":"light"}Customerweb and mobileServiceECSAPI3 tasksOrdersPostgreSQL 16Multi-AZ, encryptedCacheRedis 7HTTPS
{"skemo":1,"name":"nodes.skemo","source":"diagram(dir=\"right\" look=\"header\")\n node#user(icon=\"user\") Customer\n | web and mobile\n to(api) HTTPS\n card#api.service(tag=\"ECS\") API\n | 3 tasks\n to(db cache)\n node#db.db(icon=\"database\") Orders\n | PostgreSQL 16\n | Multi-AZ, encrypted\n node#cache.cache(icon=\"zap\") Cache\n | Redis 7\n","css":[{"name":"nodes.css","content":"/* the card keeps its look; the nodes are drawn the same in every look */\n.service { --c: #3E6FC4; --label: \"Service\"; }\n.db { --c: #D9892B; }\n.cache { --c: #C94A44; }\n"}],"theme":"dark"}Customerweb and mobileServiceECSAPI3 tasksOrdersPostgreSQL 16Multi-AZ, encryptedCacheRedis 7HTTPS
nodes.skemo
diagram(dir="right" look="header")
  node#user(icon="user") Customer
    | web and mobile
    to(api) HTTPS
  card#api.service(tag="ECS") API
    | 3 tasks
    to(db cache)
  node#db.db(icon="database") Orders
    | PostgreSQL 16
    | Multi-AZ, encrypted
  node#cache.cache(icon="zap") Cache
    | Redis 7
nodes.css
/* the card keeps its look; the nodes are drawn the same in every look */
.service { --c: #3E6FC4; --label: "Service"; }
.db      { --c: #D9892B; }
.cache   { --c: #C94A44; }

node instead of card draws a thing by its icon rather than by a box: the icon on the left, the name beside it, the lines under the name; no frame, no band. Nodes and cards mix in one diagram: the diagram's look and a type's --look do not apply to a node. Every node's icon has the same size (32 px, --icon-size), centred on the height of its text and coloured by its type; arrows end in the middle of the icon. A node takes what a card takes (classes, icon, href, lines, arrows, at, markers), except tag and label: it has no chip nor category.

Zones

{"skemo":1,"name":"zones.skemo","source":"diagram(dir=\"down\")\n zone#site.cloud Datacenter\n zone#dmz.dmz DMZ\n card#web Web\n card#mail Mail\n zone#lan.lan LAN\n card#files Files\n card#print Printers\n","theme":"light"}DATACENTERDMZWebMailLANFilesPrinters
{"skemo":1,"name":"zones.skemo","source":"diagram(dir=\"down\")\n zone#site.cloud Datacenter\n zone#dmz.dmz DMZ\n card#web Web\n card#mail Mail\n zone#lan.lan LAN\n card#files Files\n card#print Printers\n","theme":"dark"}DATACENTERDMZWebMailLANFilesPrinters
zones.skemo
diagram(dir="down")
  zone#site.cloud Datacenter
    zone#dmz.dmz DMZ
      card#web Web
      card#mail Mail
    zone#lan.lan LAN
      card#files Files
      card#print Printers

A zone encloses everything indented below it, with a margin and room for its title. Zones nest. A zone gives its accent colour to the untyped cards it contains, and an empty zone keeps a visible frame. With at="x,y", a zone can also take an imposed size="w,h". (Preview) tag="…" on a zone adds a pill after its title (zone#pods(tag="172.30.0.0/16") Pods), as on a card. .tag-left and .tag-right on a card or a zone put its badge before or after the name. A stylesheet may set a zone's title at the bottom (zone.svc > .title { top: auto; bottom: 12px }): the room for it is then kept below the cards.

Title of the diagram (preview)

diagram
  title Kubernetes application architecture
    |.pill namespace mon_namespace

A title, written once directly under diagram, is drawn above the drawing on the left; each of its | lines is a subtitle line under it, each |.pill line a pill on the right of the same line. The title widens the image if needed and never moves a card. See the Kubernetes example in Layout.

Notes, chips and boxes

The theme provides secondary cards for annotations, and a frameless zone for captions:

{"skemo":1,"name":"secondary.skemo","source":"diagram(dir=\"right\")\n card#app.t2 Application\n | v2.4\n to(v10 v20)\n card#todo.note To migrate\n | before Q3\n to(app).link\n zone#vlans.bare Uplinks / VLAN\n card#v10.chip VLAN 10\n card#v20.chip VLAN 20\n","theme":"light"}T2Applicationv2.4To migratebefore Q3Uplinks / VLANVLAN 10VLAN 20
{"skemo":1,"name":"secondary.skemo","source":"diagram(dir=\"right\")\n card#app.t2 Application\n | v2.4\n to(v10 v20)\n card#todo.note To migrate\n | before Q3\n to(app).link\n zone#vlans.bare Uplinks / VLAN\n card#v10.chip VLAN 10\n card#v20.chip VLAN 20\n","theme":"dark"}T2Applicationv2.4To migratebefore Q3Uplinks / VLANVLAN 10VLAN 20
secondary.skemo
diagram(dir="right")
  card#app.t2 Application
    | v2.4
    to(v10 v20)
  card#todo.note To migrate
    | before Q3
    to(app).link
  zone#vlans.bare Uplinks / VLAN
    card#v10.chip VLAN 10
    card#v20.chip VLAN 20
ClassOnRendering
.notecardannotation: dashed border, tinted background, centred text, no badge
.chipcarda rounded pill on one line
.infocarda small, discreet box
.barezoneno frame; the title becomes a caption below, centred and in italics; without a title, nothing is drawn
.wide (preview)cardspans the width of its group, like a network or a bus bar; its arrows drop straight to it and end in a dot
.wide (preview)zonespans the width of its group too; its cards, on one row, share that width
.col-name (preview)card, zonea column: nodes of one .col-… class line up across the direction, from one zone to another (pods and services over the machine that hosts them)

They combine with your own types, and keep their plain style whatever the card look of the diagram. Use the .link arrow style to attach a note to a card.

Built-in types

The default theme ships a few network-flavoured types, handy for quick sketches: .t0 (red, "T0"), .t1 (orange), .t2 (blue), .t3 (grey) for cards, and .cloud, .dmz, .lan for zones. For anything else, define your own in a few lines of CSS.