Skip to content
hxyulinPublic

About

Authored architecture diagrams to SVG and interactive HTML (Mermaid replacement)

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Layup logo

Layup

Diagrams for explaining software, written as code.

Rust stable Rust edition 2024 Node.js 22 or newer pnpm 12.9.1 CI status Documentation status MIT or Apache-2.0

Documentation · Live playground · Examples · Changelog

Write a .layup file to describe your system, then render a self-contained SVG, an interactive HTML page, or a JSON scene. Layup measures text with real font metrics, arranges nodes, routes connections, and reports layout problems with source locations. Use automatic placement or author the layout yourself. The Rust engine also runs in JavaScript through WebAssembly.

A slide-sized pipeline: Client sends a Request to API, which sends a Query to Storage.

Edit this diagram live · View its source

Explain Layup supports
Software structure Architecture cards, containers, typed edges, shared models and named views
Control flow Decision trees, process nodes, labeled branches and merges
Runtime behavior State machines, composite states, cycles and sequence diagrams
Presentations Slide sizing, progressive reveal, pan/zoom and interactive selection
International text Four graph directions, LTR/RTL text, Unicode and system/user CJK fonts
Your workflow CLI, Rust and JavaScript APIs, Markdown/VitePress, linting and formatting
More examples: decisions and sequences A support-routing decision tree with labeled branches.

Decision source · Edit decisions

A sequence diagram showing a request, retry loop and alternative responses.

Sequence source · Edit sequences

Quickstart

Layup 0.4 uses the named-diagram grammar shown below. Source files written for 0.3 need migration; see the language guide.

Try the playground to edit examples and download diagrams without installing anything. See the changelog for release history.

Install the CLI and render your first diagram

Install Rust stable and the CLI:

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

The installed command is named layup. See the release binaries and checksums for Linux, macOS and Windows.

Save this as hello.layup:

diagram main "A request" type=graph layout=auto flow-direction=right {
  node client "Client" style=process palette=blue
  node api "API" style=process palette=green
  node store "Storage" style=process palette=purple
  ::client -> ::api "Request"
  ::api -> ::store "Query"
}
layup render hello.layup --theme auto          # hello.svg
layup render hello.layup --html --theme auto   # hello.html, with pan/zoom
layup check hello.layup --strict               # fail on layout warnings
layup lint hello.layup                         # source and authoring diagnostics
layup fmt hello.layup --check                  # check source formatting

--theme auto follows the viewer's color scheme. Use --theme light or --theme dark for a fixed palette. GitHub previews above use separate light and dark SVGs so they follow the reader's theme too.

Continue with the DSL walkthrough and output formats.

Use the Rust/JavaScript APIs or run the docs locally

Install the JavaScript/WASM package, including its compiled engine:

pnpm add @hxyulin/layup@0.4.0
# Or: npm install @hxyulin/layup@0.4.0

The API guide covers Rust, Node.js and browser WASM. The Markdown guide covers build-time diagrams and interactive VitePress integration.

For the local playground, use Rust stable, Node 22+, and the pnpm version pinned in package.json:

git clone https://github.com/hxyulin/layup.git
cd layup
rustup target add wasm32-unknown-unknown
pnpm install --frozen-lockfile
pnpm docs:dev  # http://localhost:5173/layup/

See CONTRIBUTING.md for repository setup and checks, and docs development for production previews and GitHub Pages deployment.

Contributing

Bug reports, examples, documentation and implementation changes are welcome.

  • CONTRIBUTING.md covers setup, validation, visual review and pull requests.
  • For layout issues, include the .layup source, expected result and a screenshot.
  • The architecture guide introduces the engine.
  • AGENTS.md records repository conventions for coding assistants.

License

Layup is available under either the MIT license or the Apache License 2.0, at your option.

About

Authored architecture diagrams to SVG and interactive HTML (Mermaid replacement)

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages