Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Getting started

This page takes you from nothing to a rendered SVG in about five minutes. You need a Rust toolchain (cargo); drumlin has no other dependencies.

Install

Install the published crate from crates.io:

cargo install drumlin

This puts drumlin into Cargo’s binary folder (usually ~/.cargo/bin, which must be on your PATH). If you only want to use drumlin (without checking out the source), continue at Your first diagram.

Build from source

To work on drumlin, or to run a version that is not released yet, get the source and build it:

git clone https://github.com/davidpettersson/drumlin.git
cd drumlin
cargo build --release

The binary is target/release/drumlin. To run it as drumlin from anywhere, install it into Cargo’s binary folder (usually ~/.cargo/bin, which must be on your PATH):

cargo install --path . --locked

The commands below assume drumlin is on your PATH. Otherwise, write target/release/drumlin instead.

Your first diagram

Create a file hello.uml:

diagram component "Hello"

component Client { requires IGreeting }
component Server { provides IGreeting }
Hello Client Server IGreeting

Render it:

drumlin render hello.uml -o hello.svg

Open hello.svg in a browser to see the drawing above. Both components name IGreeting, so drumlin wires the socket on Client to the lollipop on Server with a dashed dependency arrow. You did not draw that line. (Between two ports with one interface each, drumlin draws a joined ball-and-socket instead. See Interface.)

Check a file

drumlin check reads a file and reports the first error, without writing anything. It exits with 0 when the file is valid, so it suits scripts, editors and coding agents.

drumlin check hello.uml

A mistake is reported with its line and column, and a suggestion where drumlin has one. If you add a fifth line, Client --> Sever, drumlin says:

hello.uml:5:12: error: unknown element `Sever`; did you mean `Server`?

Errors lists the common ones.

Grow the diagram

Add a package and an ordinary connector, -->, with a label after ::

diagram component "Hello, again"

package "Backend" {
  component Server { provides IGreeting }
  component Store <<database>>
  Server --> Store : read
}

component Client { requires IGreeting }
Hello, again Backend Server «database» Store Client IGreeting read

Choose a style

Drawings use the pens style unless you ask for another. Two more styles exist: plain, with one line weight, and lettering, with hand-lettered text. Try one from the command line:

drumlin render hello.uml -o hello.svg --style lettering

See Styles for pictures of each.

Component, package and state diagrams can also take a different layout engine with --layout. The default suits nearly every diagram; File basics explains when to try the other.

Where next