Diagram format

Every Lineout diagram is plain JSON. A page is a list of nodes and a list of arrows:

{ "nodes": [], "arrows": [] }

This is what the code panel shows, what a JSON export holds, what the CLI renders, what synced pages read and what MCP clients write.

Documents#

To import several pages as one diagram, wrap them in a document. pages needs at least one page, and every page a name:

{
  "pages": [
    { "name": "Request flow", "nodes": [], "arrows": [] },
    { "name": "Network", "nodes": [], "arrows": [] }
  ]
}

A file with a single page is imported as a diagram with one page, "Page 1".

Coordinates and ids#

  • Positions and sizes are in world units. x grows to the right and y down, and a node's position is its top-left corner.
  • The editor snaps to a 8-unit grid, so multiples of 8 keep a diagram aligned.
  • Node ids must be unique among the page's nodes, and arrow ids among its arrows. Short ids such as "api" or "a1" are fine.

Reference#

PageCovers
NodesIcons, groups, frames, text, shapes and images
ArrowsEndpoints, pinned routes and labels
StylesText, borders, fills, lines, arrowheads and colors
Cost settingsPricing panel settings on nodes and a page's cost stages
MermaidThe Mermaid diagrams Lineout converts

Validation errors#

Lineout reports the first problem it finds, with the path of the field:

nodes[2].position.x must be a number
arrows[0].end.nodeId "db" does not match any node
pages[1].nodes[3].id "api" is duplicated

Example#

A static site and an API behind CloudFront, inside an AWS Cloud group. The arrow to the API is pinned to a vertical line, so it runs between the columns.

{
  "nodes": [
    {
      "id": "cloud",
      "type": "group",
      "icon": "AWS-Cloud",
      "position": { "x": 128, "y": 48 },
      "size": { "width": 768, "height": 360 },
      "label": "AWS Cloud"
    },
    {
      "id": "users",
      "icon": "Users",
      "position": { "x": 0, "y": 120 },
      "label": "Users"
    },
    {
      "id": "cdn",
      "icon": "Amazon-CloudFront",
      "position": { "x": 192, "y": 120 },
      "label": "CloudFront"
    },
    {
      "id": "site",
      "icon": "Amazon-Simple-Storage-Service",
      "position": { "x": 384, "y": 120 },
      "label": "Static site"
    },
    {
      "id": "api",
      "icon": "Amazon-API-Gateway",
      "position": { "x": 384, "y": 280 },
      "label": "API Gateway"
    },
    {
      "id": "fn",
      "icon": "AWS-Lambda",
      "position": { "x": 576, "y": 280 },
      "label": "Orders handler"
    },
    {
      "id": "table",
      "icon": "Amazon-DynamoDB",
      "position": { "x": 768, "y": 280 },
      "label": "Orders table"
    }
  ],
  "arrows": [
    {
      "id": "a1",
      "start": { "nodeId": "users", "side": "right", "offset": 0 },
      "end": { "nodeId": "cdn", "side": "left", "offset": 0 },
      "label": { "text": "HTTPS", "position": 0.25, "side": "over" }
    },
    {
      "id": "a2",
      "start": { "nodeId": "cdn", "side": "right", "offset": 0 },
      "end": { "nodeId": "site", "side": "left", "offset": 0 }
    },
    {
      "id": "a3",
      "start": { "nodeId": "cdn", "side": "right", "offset": 16 },
      "end": { "nodeId": "api", "side": "left", "offset": 0 },
      "frozen": [{ "orientation": "vertical", "value": 320 }],
      "label": { "text": "/api/*", "position": 0.5, "side": "over" }
    },
    {
      "id": "a4",
      "start": { "nodeId": "api", "side": "right", "offset": 0 },
      "end": { "nodeId": "fn", "side": "left", "offset": 0 },
      "label": { "text": "Invoke", "position": 0.5, "side": "over" }
    },
    {
      "id": "a5",
      "start": { "nodeId": "fn", "side": "right", "offset": 0 },
      "end": { "nodeId": "table", "side": "left", "offset": 0 }
    }
  ]
}

For layouts that read well, put icons on a grid with columns 192 units apart and rows 160 apart, run the main flow from left to right and connect the sides that face each other.