Inkline
Menu
Docs / Start here

Your first diagram

An Inkline diagram is a short text file, usually ending in .ink. The first line names the diagram type; every other line declares a box or connects two boxes.

Write six lines

diagram architecture "Checkout platform"
  person  shopper "Customer"
  service api     "Orders API"
  store   orders  "Orders DB"
  shopper -> api    : HTTPS
  api     -> orders : SQL
Checkout platform 3 items and 2 connections. HTTPS SQL Customer Orders API Orders DB
Checkout platform, drawn from the text above
  • diagram architecture "Checkout platform" picks the type and gives the diagram a title.
  • person shopper "Customer" declares a box: its kind (person), an id you use in arrows (shopper), and an optional label that is drawn.
  • shopper -> api : HTTPS draws an arrow between two ids, with a label after the colon.

Indentation is only for reading; Inkline ignores it. Lines starting with # are comments.

See it drawn

Paste the text into the playground. The drawing updates as you type and problems are underlined, with a message such as INK2004 api2 is used but never declared. Did you mean api?. Nothing is uploaded: the engine runs in your browser.

Or, with the CLI installed (install guide):

$ ink render checkout.ink -o checkout.png --scale 2
$ ink render checkout.ink -o checkout.svg

The CLI and the playground use the same engine, so both produce the same picture.

Group boxes

zone and group take a block in braces. Boxes declared inside are drawn inside.

diagram architecture "Checkout platform"
  direction right
  theme slate

  person shopper "Customer"
  zone aws "AWS eu-west-1" {
    service api    "Orders API"
    store   orders "Orders DB"
    queue   events "Order events"
  }

  shopper -> api    : HTTPS
  api     -> orders : SQL
  api     ~> events : publish   # ~> is async
Checkout platform 4 items and 3 connections. AWS eu-west-1 HTTPS SQL publish Customer Orders API Orders DB Order events
Checkout platform, drawn from the text above

Other diagram types

The same rules work for flowcharts, sequence diagrams and entity-relationship diagrams. Change the first line to diagram flow, diagram sequence or diagram erd and use that type's kinds. The language reference lists every kind, arrow and setting.

Next