Skip to content

Write your first diagram ​

Layup turns a .layup text file into a diagram. Start with a few named nodes and relationships, then add layout and detail as your explanation grows.

1. Describe a small system ​

Hello Layup{"languageVersion":1,"diagramId":"main","diagrams":["main"],"manifest":[{"id":"main","diagramType":"graph","status":"selected","reason":null,"annotations":[],"span":{"start":0,"end":261,"line":1,"column":1,"endLine":13,"endColumn":2}}],"targets":[],"diagnostics":[],"diagram":{"declaration":"diagram","attributes":{"type":{"value":{"type":"choice","value":"graph"},"span":{"start":27,"end":37,"line":1,"column":28,"endLine":1,"endColumn":38},"valueSpan":{"start":32,"end":37,"line":1,"column":33,"endLine":1,"endColumn":38},"nameSpan":{"start":27,"end":31,"line":1,"column":28,"endLine":1,"endColumn":32}}},"path":null,"authoredId":null,"documentation":null,"sourceLocations":[],"metadata":{},"annotations":[],"paint":{"paletteOrigin":null,"fillColor":null,"strokeColor":null,"textColor":null,"backgroundColor":null,"strokeStyle":null,"strokeWidth":null}},"objects":{"object:[\"api\"]":{"declaration":"node","attributes":{},"path":["api"],"authoredId":"api","documentation":null,"sourceLocations":[],"metadata":{},"annotations":[],"paint":{"paletteOrigin":null,"fillColor":null,"strokeColor":null,"textColor":null,"backgroundColor":null,"strokeStyle":null,"strokeWidth":null}},"object:[\"store\"]":{"declaration":"node","attributes":{},"path":["store"],"authoredId":"store","documentation":null,"sourceLocations":[],"metadata":{},"annotations":[],"paint":{"paletteOrigin":null,"fillColor":null,"strokeColor":null,"textColor":null,"backgroundColor":null,"strokeStyle":null,"strokeWidth":null}},"object:[\"worker\"]":{"declaration":"node","attributes":{},"path":["worker"],"authoredId":"worker","documentation":null,"sourceLocations":[],"metadata":{},"annotations":[],"paint":{"paletteOrigin":null,"fillColor":null,"strokeColor":null,"textColor":null,"backgroundColor":null,"strokeStyle":null,"strokeWidth":null}}},"relationships":{"anonymous:0":{"declaration":"edge","attributes":{},"path":null,"authoredId":null,"documentation":null,"sourceLocations":[],"metadata":{},"annotations":[],"paint":{"paletteOrigin":null,"fillColor":null,"strokeColor":null,"textColor":null,"backgroundColor":null,"strokeStyle":null,"strokeWidth":null}},"anonymous:1":{"declaration":"edge","attributes":{"label":{"value":{"type":"choice","value":"style"},"span":{"start":237,"end":248,"line":12,"column":23,"endLine":12,"endColumn":34},"valueSpan":{"start":243,"end":248,"line":12,"column":29,"endLine":12,"endColumn":34},"nameSpan":{"start":237,"end":242,"line":12,"column":23,"endLine":12,"endColumn":28}},"style":{"value":{"type":"choice","value":"uses"},"span":{"start":249,"end":259,"line":12,"column":35,"endLine":12,"endColumn":45},"valueSpan":{"start":255,"end":259,"line":12,"column":41,"endLine":12,"endColumn":45},"nameSpan":{"start":249,"end":254,"line":12,"column":35,"endLine":12,"endColumn":40}}},"path":null,"authoredId":null,"documentation":null,"sourceLocations":[],"metadata":{},"annotations":[],"paint":{"paletteOrigin":null,"fillColor":null,"strokeColor":null,"textColor":null,"backgroundColor":null,"strokeStyle":null,"strokeWidth":null}}}}Copyright © 2017 IBM Corp. with Reserved Font Name "Plex" This Font Software is licensed under the SIL Open Font License, Version 1.1. This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL ----------------------------------------------------------- SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 ----------------------------------------------------------- PREAMBLE The goals of the Open Font License (OFL) are to stimulate worldwide development of collaborative font projects, to support the font creation efforts of academic and linguistic communities, and to provide a free and open framework in which fonts may be shared and improved in partnership with others. The OFL allows the licensed fonts to be used, studied, modified and redistributed freely as long as they are not sold by themselves. The fonts, including any derivative works, can be bundled, embedded, redistributed and/or sold with any software provided that any reserved names are not used by derivative works. The fonts and derivatives, however, cannot be released under any other type of license. The requirement for fonts to remain under this license does not apply to any document created using the fonts or their derivatives. DEFINITIONS "Font Software" refers to the set of files released by the Copyright Holder(s) under this license and clearly marked as such. This may include source files, build scripts and documentation. "Reserved Font Name" refers to any names specified as such after the copyright statement(s). "Original Version" refers to the collection of Font Software components as distributed by the Copyright Holder(s). "Modified Version" refers to any derivative made by adding to, deleting, or substituting -- in part or in whole -- any of the components of the Original Version, by changing formats or by porting the Font Software to a new environment. "Author" refers to any designer, engineer, programmer, technical writer or other person who contributed to the Font Software. PERMISSION & CONDITIONS Permission is hereby granted, free of charge, to any person obtaining a copy of the Font Software, to use, study, copy, merge, embed, modify, redistribute, and sell modified and unmodified copies of the Font Software, subject to the following conditions: 1) Neither the Font Software nor any of its individual components, in Original or Modified Versions, may be sold by itself. 2) Original or Modified Versions of the Font Software may be bundled, redistributed and/or sold with any software, provided that each copy contains the above copyright notice and this license. These can be included either as stand-alone text files, human-readable headers or in the appropriate machine-readable metadata fields within text or binary files as long as those fields can be easily viewed by the user. 3) No Modified Version of the Font Software may use the Reserved Font Name(s) unless explicit written permission is granted by the corresponding Copyright Holder. This restriction only applies to the primary font name as presented to the users. 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font Software shall not be used to promote, endorse or advertise any Modified Version, except to acknowledge the contribution(s) of the Copyright Holder(s) and the Author(s) or with their explicit written permission. 5) The Font Software, modified or unmodified, in part or in whole, must be distributed entirely under this license, and must not be distributed under any other license. The requirement for fonts to remain under this license does not apply to any document created using the Font Software. TERMINATION This license becomes null and void if any of the above conditions are not met. DISCLAIMER THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.Hello LayupdefaultusesRequestsGET /itemsWorkerpoll()Storeitems.put()sendsuses
text
diagram main "Hello Layup" type=graph {
  node api "Requests" {
    code "GET /items"
  }
  node worker "Worker" {
    code "poll()"
  }
  node store "Store" {
    code "items.put()"
  }
  ::api -> ::worker "sends"
  ::worker -> ::store label=style style=uses
}

diagram supplies the title. node api "Requests" separates the stable ID api from the displayed title. code adds a monospace line, and -> connects two IDs. style=uses selects a relationship style; label=style requests its default caption. Omitted colors receive automatic tones.

2. Change it live ​

Rename a title, add a node, or put layout=auto flow-direction=right after the diagram title. The renderer updates after a short pause in typing.

Diagram Loading renderer…
Your diagram appears here. The renderer loads once and runs in your browser.

Ctrl+Enter renders now · Tab moves focus · Click a diagnostic to select its source · Expand for pan, zoom and presentation controls

Use your own fallback fonts

CJK uses your system fonts by default. Choose standalone .ttf/.otf faces for exact measurement and embedding. Files stay in this browser; share links do not include fonts.

If a change is invalid, diagnostics point to its source while the last successful diagram remains visible. Format normalizes indentation without changing strings or comments. Download source saves your current edits.

3. Render a file ​

Install Rust stable and the 0.4 CLI:

sh
cargo install layup-cli --version 0.4.0 --locked
# Or install a supported prebuilt binary:
cargo binstall layup-cli --version 0.4.0

Layup 0.4 uses named diagrams and explicit properties. Source written for 0.3 needs migration to the shared document language.

Save your source as hello.layup, then run:

sh
layup render hello.layup
layup render hello.layup --html --theme auto
layup check hello.layup --strict

The first command writes hello.svg; --html writes an interactive page. check reports layout problems, and --strict makes warnings fail in CI.

Choose what to explain next ​

Your explanationStart here
Services, components, interfaces, or package boundariesArchitecture diagrams
Validation, routing rules, or an algorithm with branchesDecisions and flowcharts
An object's lifecycle or nested operating statesState machines
Requests, responses, retries, and asynchronous callsSequence diagrams
A talk that introduces a system graduallySlides and reveal

Continue with the source language to learn IDs, blocks, strings, and attributes.

MIT OR Apache-2.0 · Bundled fonts: SIL OFL 1.1