Docs / Diagram examples

Email delivery flow diagram, written as JSON

For anyone who wants a flow diagram without writing Python, this page draws email delivery from JSON: plain data that any programming language or AI agent can produce.

Updated

How an email is delivered

How an email is delivered. Drawn by open-diagram 0.6.2 from examples/email_delivery.json: 0 layout problems. Open in the editor · Source

The picture as text
How an email is delivered
Written as JSON: no Python needed. Draw it with: open-diagram draw examples/email_delivery.json
States shown: Live, Being built, In trial, Planned. Solid lines: data flows today.
This year: 1. Sign every message (Sending server); 2. Check every link (Receiving server).

Blocks, left to right:
- Mail app: Write; Attach files; Send
- Sending server [step 1] (The sender's provider): Queue; Digital signature (being built); Retry if busy
- Receiving server [step 2] (The recipient's provider): Check the sender; Spam filter; Link scanner (planned)
- Inbox: Phone; Laptop; Smartwatch (in trial)
Lines:
- Mail app -> Sending server
- Sending server -> Receiving server, labeled "over the internet"
- Receiving server -> Inbox
- Receiving server -> Sending server, labeled "If delivery fails, a bounce message goes back"

How does an email reach the inbox?

It passes from the mail app through two servers, the sender's provider and the recipient's. If delivery fails, a bounce message goes back along the bottom. The key numbers two changes planned for this year.

What does the JSON look like?

The whole file is 23 lines:

{
  "title": "How an email is delivered",
  "subtitle": "Written as JSON: no Python needed. Draw it with: open-diagram draw examples/email_delivery.json",
  "tag": "EXAMPLE",
  "steps": [[1, "Sign every message"], [2, "Check every link"]],
  "steps_label": "This year",
  "columns": [
    [{"id": "app", "title": "Mail app", "tiles": ["Write", "Attach files", "Send"], "cols": 1}],
    [{"id": "out", "title": "Sending server", "sub": "The sender's provider", "step": 1,
      "tiles": ["Queue", {"label": "Digital signature", "status": "building"}, "Retry if busy"], "cols": 1}],
    [{"id": "in", "title": "Receiving server", "sub": "The recipient's provider", "step": 2,
      "tiles": ["Check the sender", "Spam filter", {"label": "Link scanner", "status": "planned"}], "cols": 1}],
    [{"id": "inbox", "title": "Inbox", "tiles": ["Phone", "Laptop", {"label": "Smartwatch", "status": "trial"}],
      "cols": 1, "tone": "neutral"}]
  ],
  "gap": 130,
  "links": [
    {"from": "app", "to": "out"},
    {"from": "out", "to": "in", "label": "over the internet"},
    {"from": "in", "to": "inbox"},
    {"from": "in", "to": "out", "lane": "bottom", "label": "If delivery fails, a bounce message goes back"}
  ]
}
  • columns is a list of columns, each a list of panels.
  • Each panel has an id, which the links use.
  • A tile is a plain string, or an object with a label and a status.
  • "lane": "bottom" sends the bounce line under the panels.
  • "gap": 130 leaves room between the servers for the label "over the internet". At 100, the label sits on a panel and the check says so.

Why JSON instead of Python?

More tools can write it. The MCP server, which lets AI apps such as Claude Code and Cursor draw diagrams, accepts JSON and Mermaid only, never Python. Python is still needed for positions worked out while the script runs.

What happens when the JSON has a mistake?

open-diagram names the place. Misspell a key, say colour on the digital signature tile, and the check stops with:

error: columns[1][0].tiles[1]: unknown key(s) 'colour'; allowed: icon, label, status, sub

That is the second column, first panel, second tile. A missing title, or a link to an unknown id, is named the same way.

How do I make my own?

Open the example in the editor and change it in your browser. Or, after pip install open-diagram, copy examples/email_delivery.json, change the titles, tiles and links, and run open-diagram check email_delivery.json and open-diagram draw email_delivery.json. The JSON guide shows how to write the file from your own code.

See also