DESIGN-IT USER MANUAL ===================== design-it is a fast diagram editor for software architecture: structs, classes, interfaces, modules, services, storage, state machines and the relationships between them. It is keyboard first (vim style) but everything also works with the mouse. Diagrams are plain text files you can keep in git. This manual is built into the program. Open it any time with F1 or :help, jump to a topic with :help (for example :help edges, :help keys, :help dsl). Scroll with j / k, the mouse wheel, Page Up / Page Down. CONTENTS 1. Getting started 2. Opening files and drag and drop 3. The workspace: panels, tabs and views 4. Modes and the command bar 5. Canvas: mouse 6. Canvas: keyboard 7. Tables: outline, inspector, edges, layers, ... 8. Panels and tabs: keyboard 9. Nodes: kinds, sections and members 10. Edges: kinds, creating, routing, bends 11. Layout and alignment 12. Layers and focus mode 13. Saving and exporting (SVG, PNG, Mermaid, PlantUML) 14. The .dit.txt text format 15. Scanning C / C++ code 16. All commands 17. Settings and color schemes 18. Command line options 19. Platform notes: Windows, macOS, Linux 20. Troubleshooting 21. Documentation and source links 22. Copy and paste 23. Sequence diagrams 24. Mermaid and PlantUML 1. GETTING STARTED ------------------ Start design-it with no arguments and it opens a showcase diagram. To start from something else: - drag a .dit / .dit.txt / .mmd / .puml file onto the window (see 2) - type :open path/to/file.dit.txt and press Enter - type :tpl uml (or arch, ecs, microservices, compiler, stress) - drag a source folder onto the window to scan its C / C++ headers A first diagram in five steps: 1. press :clear Enter start empty 2. move the mouse onto the canvas, press a add a node, type a name, Enter 3. press a again somewhere else a second node 4. right-drag from one node onto the other connect them with an edge 5. :save my_design.dit.txt Enter save it as text Press Escape to cancel anything (typing, a command, a selection). Press u to undo and Ctrl+r (or Ctrl+z for undo) to redo. 2. OPENING FILES AND DRAG AND DROP ---------------------------------- Drag and drop works on every platform: - drop a .dit or .dit.txt file on the window: it opens - drop a folder: its C / C++ headers are scanned into a diagram (see 15) - drop several files: the first one opens (one diagram at a time) Opening replaces the current diagram, but it is undoable: press u to get the previous diagram back. Other ways to open: design-it file.dit.txt from a terminal :open file.dit.txt from the command bar (Tab completes) double click / "Open With" on macOS with the design-it.app bundle drop on the dock icon macOS, with the design-it.app bundle File types: .dit.txt readable text (recommended, diffable, editable by hand) .dit compact binary snapshot, loads instantly, not for editing .mmd Mermaid (class, flowchart, sequence, state, er diagrams) .puml PlantUML (class style and sequence diagrams) Mermaid and PlantUML files are converted when they open and laid out automatically. :save writes .dit.txt again (see 24). 3. THE WORKSPACE: PANELS, TABS AND VIEWS ---------------------------------------- The window is split into panels. Each panel holds tabs, each tab shows a view. Every view follows the same selection: click a node on the canvas and the outline, inspector and edges views jump to it. Views (open any with :view ): canvas the diagram. Open several, each has its own camera outline tree of modules > nodes > sections > members inspector every property of the selected node or edge, editable edges table of all relationships layers tags with node / edge counts, hide or dim them palette add nodes by kind, load templates source the live .dit.txt text of the diagram views list of every view, Enter opens one docs documentation and source link of the selection (21) help this manual appearance, colors, canvas, layout, behaviour, performance, info settings groups (see 17) frame, memory, heap, arenas, threads, process, gpu, fonts, diagram built in profiler Mouse: drag a tab onto another panel's middle join that panel's tabs drag a tab onto a panel's edge split the panel drag the gap between panels resize middle click a tab close it double click the empty tab bar maximize the window drag the empty tab bar move the window :reset puts the default layout back. 4. MODES AND THE COMMAND BAR ---------------------------- The status bar (bottom left) shows the mode: NORMAL keys are commands (this is where you are most of the time) EDIT you are typing a name, label or value: Enter accepts, Escape cancels COMMAND after pressing : type a command, Tab completes, Enter runs SEARCH after pressing / type to search, Enter jumps, n / N repeat Commands can be shortened to any unique prefix and show completions as you type. Section 16 lists all of them. Counts: like vim, a number before a key repeats it. 5j moves down five rows, 10l pans right ten steps. 5. CANVAS: MOUSE ---------------- Left click select a node or edge Shift + left click add to / remove from the selection Left drag on empty space box select Left drag a node move it (snaps to the grid when snap is on, shows alignment guides) Drag the bottom right corner of a node resize it Double click a node rename it Double click an edge edit its label Drag a selected edge's add a bend there (the dots in the middle of segment dots its segments); drag a square to move a bend, double click a square to remove it Drag along a lifeline draw a sequence message (23) Click the doc / link mark in a node header: edit its documentation / open its source link (21) Right drag node to node create an edge (of the current edge tool, e) Drag a port dot create an edge (port dots show on hover) Middle drag, or right drag on empty space pan Scroll wheel zoom toward the cursor Shift + wheel / touchpad sideways pan horizontally Minimap (bottom right) click or drag to jump around [-] / [+] on a header collapse / expand that section or module The floating inspector the card next to the selected node or edge (see below): click a value to edit it in place, click < > to change a choice 6. CANVAS: KEYBOARD ------------------- h j k l / arrows pan (with a count: 5l) H J K L nudge the selected node by one grid step + / - zoom in / out 0 zoom 100% f fit the whole diagram Z fit the selection a add a node at the mouse and rename it Enter step into the floating inspector (below) i rename the node, or edit the selected edge's label I floating inspector on / off c collapse / expand the selected node yy / Ctrl+c copy the selection (22) p / Ctrl+v paste at the mouse; P pastes in place x / Ctrl+x cut; dd also keeps what it deleted for p D duplicate the selected node gx / gf open the node's source link online / in your editor dd / Delete delete the selection u / Ctrl+r undo / redo (Ctrl+z also undoes) e cycle the edge tool (-> ..> -|> ..|> *-> o-> ...) r cycle default routing: orthogonal, straight, bezier L automatic layout (layered) F focus mode on / off (see 12) G grid style: dots, lines, off S snap to grid on / off m minimap on / off Tab select the next node and pan to it / search nodes, members, types and labels : command bar F1 this manual The floating inspector is a small card next to the selected node or edge. It holds the Inspector's everyday fields (name, kind, stereotype, color, tag, note, sections and members) so you can edit without leaving the canvas. It hides while you drag, when more than one node is selected, and when the selection scrolls out of view. Mouse click a value, member or section title to edit it in place; < and > step a choice (kind, routing); + on a section adds a member, x on a member deletes it; [-] collapses a section; the x in the corner closes the card until you click the node again. Clicking elsewhere keeps what you typed. Keys Enter steps in from the canvas, then j / k move h / l change a choice, collapse / expand a section Enter edit the value in place (Enter saves, Esc cancels) a / A add a member / a section dd, Delete delete the member or section Esc / Tab back to the canvas Turn it off for good with :set floating inspector=off (or :view canvas). 7. TABLES: OUTLINE, INSPECTOR, EDGES, LAYERS, ... -------------------------------------------------- Every view except the canvas is a table with a row cursor. j / k / arrows move the cursor gg / G first / last row (5G goes to row 5) Home / End first / last row Page Up / Down one page Ctrl+d / Ctrl+u half a page down / up l / Right expand a tree row, or next value of a choice h / Left collapse a tree row, or previous value of a choice Enter / Space / o activate: edit a value, toggle, open a inspector: add a member to the current section A inspector: add a section dd delete the row's item (member, section, node, edge) drag a column header reorder / resize columns (:columns shows hidden) Inspector, for a node: name, kind, stereotype, border, accent color, tag, note, documentation, source link, geometry, collapsed, pinned, then its sections and members. For an edge: relationship, routing, label, multiplicities, ports, tag, color, documentation, bends. With nothing selected: the diagram's title, routing, documentation and repo. Choice fields (kind, routing, ...) change with h / l. 8. PANELS AND TABS: KEYBOARD ---------------------------- Ctrl+h j k l focus the panel left / below / above / right Ctrl+w h j k l same Ctrl+w v split the panel vertically (same view, new tab) Ctrl+w s split horizontally Ctrl+w c close the focused tab Ctrl+w = make all splits equal gt / gT next / previous tab in the panel Ctrl+Tab next tab anywhere (Ctrl+Shift+Tab: previous) Ctrl+= / Ctrl+- bigger / smaller interface (Ctrl+0 resets) :vs split right with a view :sp split below with a view 9. NODES: KINDS, SECTIONS AND MEMBERS ------------------------------------- Kind Looks like Use it for struct card, accent bar data layouts, plain structs class card, accent bar classes, managers, controllers interface dashed border traits, protocols, interfaces enum double accent bar enums, tagged unions, variants module dashed frame around children packages, subsystems, processes system accent header services, engines, threads storage slab on top databases, queues, caches state rounded pill state machine states, phases note folded corner notes, decisions, legends lifeline box + dashed line down sequence diagram participant actor stick figure + line sequence diagram actor Change the kind any time: inspector, move to "kind", press h or l. Sections are named boxes inside a node (fields, methods, ports, memory, invariants: any name). A node can have any number of them. Members are the lines in a section. Type them like this: + rect[4] : f32 [0x00] | | | | | name | badge (optional, shown as a pill) | type (optional, after the colon) visibility (optional): + public - private # protected ~ package @ port / event * bullet Modules are containers: nodes inside a module move with it, and the module grows to fit them. Collapse a module with [-] to hide its children. 10. EDGES: KINDS, CREATING, ROUTING ----------------------------------- Symbol Kind Means -> association uses, references, calls ..> dependency weak / compile time dependency -|> inheritance extends ..|> implements implements an interface *-> composition owns (filled diamond at the owner) o-> aggregation holds, shared (hollow diamond) ==> dataflow hot data path, stream (thick line) ~> async message, event, queue <-> bidirectional two way -- link undirected ->> message sequence call (between lifelines) -->> reply sequence return, dashed Create: right-drag from a node onto another, or drag a port dot, or :connect . The new edge uses the current edge tool (press e to change it, the status bar shows edge:->). Edit: select the edge, then the inspector shows relationship, label, routing (auto / orthogonal / straight / bezier), multiplicities like 1 and 0..*, ports (north / south / east / west) and a tag. :route ortho|straight|bezier sets the default routing for the diagram. Bends: select an edge and small dots appear in the middle of its segments. Drag one to put a bend there; the edge then runs through its bends (with right angles when the routing is orthogonal). Drag the square of a bend to move it, double click it to remove it. Bends move with their nodes when both ends are dragged together. Up to 8 bends per edge. "bends" in the inspector (Enter) or :straighten removes them. Automatic layout removes bends, they would point at the old places. 11. LAYOUT AND ALIGNMENT ------------------------ L layered layout (top to bottom) :layout layered same :layout lr layered, left to right (good for pipelines) :layout force spring layout, untangles dense graphs :layout grid simple grid :layout sequence lifelines in a row, messages evenly spaced (:seq) Select several nodes (shift click or box select), then: :align left | right | top | bot | cx | cy line them up :align dh | dv distribute evenly Pinned nodes (inspector: pinned) are left alone by automatic layout. 12. LAYERS AND FOCUS MODE ------------------------- Give nodes and edges a tag (inspector: tag, or tag= in the text format). The layers view lists every tag with node / edge counts. Enter on a tag hides it (and everything carrying it), Enter again shows it. Focus mode (F) dims everything that isn't within one hop of the selected node. :set focus hops=2 widens it to two hops. 13. SAVING AND EXPORTING ------------------------ :save save to the opened file (or diagram.dit.txt) :save name.dit.txt save as readable text :save name.dit save as binary :export name.svg vector image in the current colors (links are clickable, docs show as hover text) :export name.png [2] picture, 2 pixels per unit by default; any size, it is drawn in window sized tiles (the window shows the tiles for a moment) :export name.mmd [style] Mermaid; style is class, flowchart or sequence (picked from the diagram when left out) :export name.md Mermaid in a ```mermaid block (GitHub renders it) :export name.puml PlantUML :export name.dit.txt the text format, without changing the open file :save picks the format by extension: .dit is binary, anything else is text. Exporting without a window: design-it file.dit.txt --export=out.svg (also .mmd .puml .dit.txt); --export=out.png needs a display. 14. THE .dit.txt TEXT FORMAT ---------------------------- A diagram file is plain text. The source view always shows the text of the current diagram, so the quickest way to learn it is to look there. diagram "Task Queue" routing=orthogonal module "Runtime" id=rt tag=core { interface "Job" id=job stereo="<>" { section "contract" { + run(ctx) : void [pure] } } struct "JobQueue" id=queue { note "lock free ring" section "fields" { + head : atomic [0x00] - slots : Job*[] [ring] } } } queue o-> job : "buffers" [1 -> 0..*] rt ==> job : "runs" route=bezier tag=hot Nodes: "" [id=key] [stereo="text"] [tag=name] [color=#RRGGBB] [link="path/file.c:42"] [x=N y=N] [w=N h=N] [collapsed=1] [pinned=1] [{ body }] Body: note "text", doc """ ... """, section "title" { members }, child nodes Edges: [: "label"] [[from -> to]] [route=mode] [from=north|south|east|west] [to=...] [tag=x] [color=#RRGGBB] [via=x,y;x,y] [y=N] [{ doc """ ... """ }] via= are the bends, y= the height of a sequence message Diagram: diagram "title" [routing=mode] [repo="url"] [ref="branch"] [root="path"], then an optional doc """ ... """ Docs: doc """ on its own line, the text, """ on its own line. The text keeps its line breaks; indentation up to the block's is removed. Strings in quotes escape \" and \\. Comments start with # or //. Leave out x= / y= and the diagram is laid out automatically when it loads, which makes the format easy to generate from scripts. 15. SCANNING C / C++ CODE ------------------------- :scan path/to/src, design-it --scan=path, or drop the folder on the window. Reads .h / .hpp files (four folder levels deep), skipping build, protocols and node_modules. Every node links to its file and line, and the repo url comes from the checkout's origin remote, so gx opens the definition online and gf in your editor (21). Every folder becomes a module; struct, class and enum definitions become nodes with their fields; base classes become inheritance edges, embedded fields composition edges and pointer fields association edges, attached to the field's row. The result is laid out automatically. Tips: press F and click a struct to see only its neighborhood, hide helper headers in the layers view, :save the result to keep your changes. 16. ALL COMMANDS ---------------- :help [topic] this manual, jump to a topic :open open .dit / .dit.txt / .mmd / .puml (or scan a folder) :import merge a file into this diagram :save [file] save (.dit binary, otherwise text) :export [opt] .svg .png [scale] .mmd [style] .md .puml :doc edit the documentation (21) :link set the node's source link :browse / :src open the link online / in the editor :repo [ref] | detect where links open online :root local checkout the links start from :copy / :paste clipboard (22) :straighten remove bends from the selected edges :seq re-space a sequence diagram :scan build a diagram from C / C++ headers :tpl arch ecs microservices compiler uml sequence stress :clear empty diagram :add add a node :connect connect two nodes by key :layout layered|lr|force|grid automatic layout :align left|right|top|bot|cx|cy|dh|dv :route ortho|straight|bezier default edge routing :focus focus mode on / off :fit fit the diagram in the canvas :view open or focus a view :vs / :sp split right / below with a view :set = change a setting (see 17) :zoom <0.6 - 3> interface size :columns show hidden table columns again :reset default panel layout :q quit (settings and layout are saved) 17. SETTINGS AND COLOR SCHEMES ------------------------------ Open a settings group as a view (:view appearance, colors, canvas, layout, behaviour, performance) and edit with h / l / Enter, or set by name: :set color scheme=nord :set grid style=lines :set font=Built-in Sans Color schemes: mono dark, mono light, amber, green phosphor, gruvbox, nord, solarized, high contrast, custom (edit single colors in :view colors). Some settings: zoom, color scheme, text weight, font, bold font, mono font, font size, small font size, grid style, grid size, snap to grid, default routing, minimap, edge labels, node shadows, smart guides, port handles, focus hops, row height, scroll smoothing, wheel lines, double click, frame rate. "reset all settings" in :view info restores the defaults. Fonts: design-it carries its own fonts (Built-in Sans, Built-in Sans Bold, Built-in Mono) and also lists the usual system fonts of your platform. Settings and the panel layout are saved when you quit, in: Windows %APPDATA%\design-it\state.bin macOS ~/Library/Application Support/design-it/state.bin Linux ~/.local/share/design-it/state.bin ($XDG_DATA_HOME if set) Delete that file to start over with defaults. 18. COMMAND LINE OPTIONS ------------------------ design-it [file.dit | file.dit.txt] [options] --template= start from a template (arch ecs microservices compiler uml stress) --scan= start from scanned C / C++ headers --export-svg= write an svg and exit (no window needed) --export= export by extension and exit: .svg .mmd .md .puml .dit.txt .dit without a window, .png with one --export-style= .mmd: class | flowchart | sequence, .png: scale --set="name=value" change a setting for this run (repeatable) --open= open or focus a view at startup --layer overlay window (no frame, always on top) --anchor= overlay position: top, bottom, left, right, top-right, ... (implies --layer) --screenshot= render one frame to a .ppm image and exit --manual print this manual and exit --help print the options and exit 19. PLATFORM NOTES ------------------ Every release build is a single executable with nothing to install. It needs a graphics driver with Vulkan, which every current driver for NVIDIA, AMD, Intel, Apple and Qualcomm GPUs includes. Windows (10 or newer, x64 or ARM64) - design-it.exe, double click it or drop a .dit file on it - the interface follows the display scale (125%, 150%, ...) macOS (11 or newer, Apple silicon and Intel) - the design-it binary runs from Terminal or Finder; design-it.app is the same program as a bundle, for "Open With", double clicking .dit files and dropping files on the dock icon - Cmd works like Ctrl: Cmd+z undo, Cmd+r redo, Cmd+w then v split, ... - Option types characters as usual (@, [, ~ on many layouts) - Cmd+q quits, Cmd+h hides, Cmd+m minimizes - a download from the internet may need right click > Open the first time (Gatekeeper) Linux (x86_64 or ARM64, glibc 2.35 or newer) - works on Wayland and on X11; Wayland is used when available - force one with DESIGN_IT_BACKEND=x11 or DESIGN_IT_BACKEND=wayland - needs libwayland-client, libxkbcommon and libX11, which every desktop has, plus the Vulkan loader (libvulkan.so.1) and your GPU's driver 20. TROUBLESHOOTING ------------------- "Vulkan was not found" / "could not start Vulkan" Install or update the graphics driver. On Linux install the Vulkan loader and driver (for example vulkan-loader and mesa-vulkan-drivers). In a virtual machine, enable 3D acceleration. The window opens but text looks wrong :set font=Built-in Sans and :set mono font=Built-in Mono Everything is too small or too big Ctrl+= / Ctrl+- or :zoom 1.4 I lost my panels :reset A file won't open Check the status bar message. Text files must follow section 14; the source view of any diagram shows correct examples. Start completely fresh Delete state.bin (see 17). 21. DOCUMENTATION AND SOURCE LINKS ---------------------------------- Every node, every edge and the diagram itself can carry documentation: as much text as you like, with line breaks. Nodes also carry a source link that points at the code they describe. Writing docs: - select a node or edge, then :doc, or Enter on "documentation" in the inspector or the floating card, or click the doc mark in the node's header (three short lines, shown when there is documentation) - with nothing selected :doc edits the diagram's own documentation The editor: type, Enter for a new line, arrows / Home / End / Page Up and Down move, Ctrl+v pastes, Ctrl+s (or Ctrl+Enter) saves, Esc cancels (with changes it asks for a second Esc). Reading docs: the docs view (:view docs) shows the selection's doc, link and repo, wrapped to the panel. Hover the doc mark on the canvas for a tooltip. / searches documentation text too. Source links: "path/in/repo.c:42" (also "file.c#L42", "file.c" or a full https:// url). Set one with :link, or "source link" in the inspector. A node with a link shows the link mark (an arrow out of a box). gx, :browse, click the mark open it online gf, :src open the file in your editor Online needs the repo: :repo https://github.com/you/project main, or :repo detect to read it from the git checkout (origin remote and the current branch). GitHub, GitLab, Gitea, Codeberg and Bitbucket urls are built for you; anything else takes a template with {path} {line} {ref}: :repo https://cgit.example.org/proj/tree/{path}?h={ref}#n{line} Locally, links start from :root when set (absolute, or relative to the diagram file), otherwise from the git checkout around the diagram file. gf opens the file with the system opener, or at the exact line with DESIGN_IT_EDITOR set, for example: export DESIGN_IT_EDITOR="code -g {file}:{line}" export DESIGN_IT_EDITOR="zed {file}:{line}" export DESIGN_IT_EDITOR="kitty nvim +{line} {file}" In exports: SVG nodes link to their url and show their docs on hover, Mermaid and PlantUML get click links and docs as comments. 22. COPY AND PASTE ------------------ yy (or Ctrl+c, :copy) copies the selected nodes, everything inside selected modules, and the edges between them. p (Ctrl+v) pastes at the mouse, P pastes at the original place. x / Ctrl+x cut. dd deletes and keeps the deleted nodes for p, without touching the system clipboard. The clipboard holds plain .dit.txt text: paste it into an editor, a chat or a commit message, and paste it into another design-it window. Pasting Mermaid or PlantUML text (from a README, an issue, a wiki) converts it and drops it at the mouse. In any text field Ctrl+v pastes the clipboard text. 23. SEQUENCE DIAGRAMS --------------------- Participants are lifeline (box) and actor (stick figure) nodes; :add lifeline Client, the palette, or :tpl sequence for an example. Messages are edges between lifelines, drawn as horizontal arrows: ->> message (call), solid with a filled arrow -->> reply, dashed with an open arrow ~> async message Draw one by dragging along a lifeline (below its box) onto another, or onto itself for a self call; it lands at the height you started at. Drag a message up or down to reorder it. Move a lifeline by its box; its messages follow. Lifelines grow to fit their messages. :seq (or :layout sequence) lines the participants up and spaces the messages evenly. Modules make fragment frames (loop, alt, ...) and notes work as anywhere else. 24. MERMAID AND PLANTUML ------------------------ Open (or drop, or :import to merge, or paste) .mmd / .mermaid and .puml / .plantuml files, or Markdown ```mermaid blocks: Mermaid classDiagram, flowchart / graph (subgraphs, shapes, link labels, click links), sequenceDiagram (participants, actors, notes, loop / alt / opt frames, autonumber), stateDiagram, erDiagram PlantUML class, interface, enum, abstract, entity, package, namespace, component, database, notes, [[links]], relations with multiplicities; sequence diagrams with participants, notes and alt / loop groups Styling (colors, classDef, skinparam) is dropped, structure, labels, multiplicities and links are kept. Export goes the other way with :export name.mmd / name.md / name.puml (13).