Skip to content

Architecture Diagrams

Each organization in Taskbase can have architecture diagrams: drawings of its systems that people edit on a canvas and agents edit through MCP. A diagram is made of components (what something is: a service, a database, a queue…) and connections between them. Where things sit on the canvas is worked out by layout rules, so people rarely drag anything and agents never deal with coordinates. Why it works this way is recorded in ADR 0012.

What to put in a diagram — which level of detail, what a group stands for, how to label connections and in which order to build — is in Architecture-Diagram Conventions. Follow it whenever you draw or change a diagram.

Creating a diagram

  1. Open the organization and its Architecture tab. It shows the organization's diagrams as a grid of cards, each with its title, description, component count and when it last changed. An organization without diagrams shows "No architecture diagrams yet".
  2. Click + New diagram, give it a title (and optionally a description) and click Create diagram.
  3. Click anywhere on the diagram's card to open it (middle-click or the keyboard work as on any link). A new diagram is empty: drag a component from the palette onto the canvas to start, or let an agent draw it.

Rename (pencil) and Delete (bin) are small icon buttons in the top-right corner of each card. Rename edits the title and description inline in the card. Deleting removes the diagram's components, connections and history. Anyone with access to the organization can create, edit and delete its diagrams.

The full-screen view

A diagram opens full screen, without the app header, so the canvas gets the whole window. A slim top bar holds, from left to right:

  • ← Architecture, back to the organization's Architecture tab;
  • ← title, back to the diagram you came from, when you opened this one from a linked box;
  • the diagram's title and description;
  • Undo, Redo and Tidy up (editors only);
  • Labels, which shows every connection label (see Reading a busy diagram);
  • History;
  • Full screen, which also hides the browser's own toolbars using its Fullscreen API. It reads Exit full screen while active, and is only shown when the browser supports it.

Editors get the component palette as a rail of icon buttons on the left of the canvas, one per component type. Each button shows the type's icon, the same one the canvas draws on its components; hover over it to see the type's name, which is also what screen readers announce.

Read-only viewers get the same full-screen canvas, without the palette and the editing buttons.

Esc closes one thing at a time, in this order: the focus (see Focus), a new component you are still naming, then the selection, then the revision you are viewing, then the History panel. Once nothing is open, Esc leaves the view and goes back to the diagram you came from (after following a linked box), else to the Architecture tab. While you are typing in a field or a dialog is open, Esc does not do any of this.

Zoom: the zoom controls sit at the bottom left of the canvas, and Ctrl/Cmd +, − and 0 zoom in, out and to fit. On opening, the diagram is fitted to the view, but never below 50 %: a large diagram opens centred at 50 % and you pan from there. You can still zoom out further by hand. Below 60 % the canvas is an overview: technology lines and connection labels are hidden (except the labels of a focused connection), and names grow against the zoom so they stay readable (about 11 px on screen).

On mobile widths (below 768 px) the palette becomes a bar along the bottom of the screen, which scrolls sideways if the icons do not fit. The top bar wraps, and the "Architecture" label next to the back arrow and the description are hidden.

Component types

Type Use it for Notes
Group A system, cluster or network that contains other components Can nest. Sizes itself to its contents; dragging it moves everything inside
Service Something that runs code: an API, a UI, a worker, an operator
Data store A database, bucket or volume
Queue A queue or event bus
External system A third party, or another organization's system
Person A role or user group
Note Free text Cannot be connected

On the canvas, a component is drawn as a large icon of its type with its name as a caption underneath and its technology, if set, below that, inside a faint frame. The frame of an external system is dashed. Hover over a component to see its name, type and technology; screen readers announce its name. Groups keep their container look and notes their sticky-note look, each with a small icon of its type beside the name.

Text is sized to read at 100 % zoom: a component's name is 15 px and wraps to two lines (hover to see the full name); a group's title is 16 px bold; technology lines and connection labels are 13 px, and a connection label, when shown, sits on a pill.

A component has a key (a readable slug such as taskbase-api), a name, and optionally a technology, a description, a URL and a linked Taskbase project. The key is set when the component is added and never changes. The type cannot change either: to change it, delete the component and add it again.

Reading a busy diagram

A diagram with many connections would be a tangle of lines and words if everything were drawn at once. The canvas therefore draws less, by the same rules for every diagram. Nothing is removed: every component and connection stays in the diagram, and each one can be reached on the canvas. The rules only change what is drawn, never the diagram itself or where its components sit, so the same diagram always looks the same at the same zoom. Agents build diagrams exactly as before.

Labels on demand

At rest, connections are thin, muted lines with small arrowheads and no labels, at any zoom. A connection's label shows while it, or a component at one of its ends, is focused (see below).

To see every label at once, press Labels in the top bar; press it again to hide them. Your choice is remembered in this browser. In the overview (below 60 % zoom) labels stay hidden even with Labels on; only the labels of focused connections show there.

Focus

Focus a component or a connection to see how it is connected:

  • Hover over a component or a line (on a computer), or
  • click or tap it, or press Enter on a component that has keyboard focus.

A focused component's connections are drawn thicker in the accent colour, with their labels, and so are the components at their other ends. Focusing a connection does the same for it and its two ends. Everything else is dimmed to 25 % opacity. Hovering focuses only while the pointer is there; a click or tap keeps the focus until you click something else or clear it (hovering elsewhere shows that instead for as long as the pointer stays). Groups and notes are not focused by hovering, only by clicking them.

Esc, or a click on the empty canvas, clears the focus. Focus never moves anything.

Viewers who cannot edit can focus too: clicking a connection focuses it, without opening its panel.

Merged lines

All connections between the same two components are drawn as one line. It has an arrowhead at each end that one of its connections points to (both ends for a bidirectional one). Its label lists the connections' labels separated by " / ", or reads "3 connections" (or more) when there are three or more.

Click the line to open the connection panel. It lists every connection on the line, as "Gitea → Taskbase API" with its label; click one to edit or delete just that connection. The connections themselves stay separate: editing, deleting, undo and history work per connection, as before.

Hub chips

A hub is a component (not a group or note) that is connected to at least 6 different components, spread over at least 3 containers (a container is the group directly around a component, or the top level). Typical hubs are an API gateway, an identity provider or a Git server.

A connection between a hub and a component in another container that is not a hub itself is not drawn as a line. Instead that component shows a chip on the bottom edge of its box: the hub's icon and name (cut after 14 characters). Connections between two hubs, and between a hub and a component in the same container, stay lines.

  • A box shows at most 3 chips, ordered by the hub's key, then +N for the rest. Its tooltip lists the hubs it stands for.
  • Hover over a chip, or tab to it, to draw its connection with its label. Click it to keep that connection focused, or, for editors, to open its panel.
  • Focus the hub to draw all of its connections, chips included. Hovering over or clicking +N focuses the box itself, which draws all of its connections.
  • On phones (below 768 px) chips show only the hub's icon; tap one to focus its connection. Screen readers announce each chip with the hub's full name and the label, e.g. "Connected to Keycloak: OIDC login · OIDC".

Linked diagrams

A component can link to another diagram of the same organization that details it, such as a system on a landscape linking to its container diagram (Taskbase task #1092). When to set a link is in the conventions.

  • Open diagram: a linked box has a round button on its top right corner, labelled "Open diagram “title”" for screen readers and reached with Tab. It is there for viewers and editors alike. A click on the box itself still focuses and selects it, as on any box.
  • Details panel: the selected box's panel lists the linked diagram under Details, as a link.
  • Going back: the opened diagram's top bar adds ← title of the diagram you came from, and Esc goes back there before it goes to the Architecture tab.
  • Setting the link: editors choose a diagram under Opens diagram in the component's panel, or None to remove it, and click Save. The list holds the organization's other diagrams. Undo covers it, and History describes it as, for example, "linked group Taskbase to diagram “Containers of Taskbase”".
  • A link that leads nowhere: deleting the linked diagram clears the link, and restoring an old revision drops links to diagrams that are gone. A link to a diagram that is not in the organization's list of diagrams shows no button.

Editing on the canvas

  • Add a component: drag its icon from the palette onto the canvas, or onto a group to put it inside. Hover over an icon to see which type it is. Enter its name; the key follows the name until you edit it. Clicking an icon instead of dragging lets the layout rules place it.
  • Connect two components: hover over a component and drag from one of its edges to another component. Select the connection to give it a label and protocol, or make it bidirectional. If the two components already have a connection, the new one joins the same line. A connection drawn as a chip is selected by clicking the chip.
  • Edit details: select a component or connection to open its panel, change the fields and click Save.
  • Move a component: drag it. A dragged component is pinned where you put it. Dropping it in another group moves it into that group.
  • Delete: select something and press Delete or Backspace, or use Delete in its panel. Deleting a component also deletes its connections. Deleting a group that still contains something asks whether to keep them, move them out or delete them too.
  • Undo and redo: Undo/Redo in the top bar, or Ctrl/Cmd+Z and Ctrl/Cmd+Shift+Z (or Ctrl+Y). An undo is sent as a new change, so undoing an edit to components or connections adds a revision to the history. Moves, Tidy up and Reset position can be undone too.

Changes are shown at once and saved one at a time ("Saving…"). The canvas checks for changes by others every 10 seconds, and briefly highlights what changed. If someone else changed the diagram in the meantime, your change is applied on top of theirs; if it no longer fits (for example, they deleted the group you were adding to), it is dropped and you are told why.

Automatic layout

Every component's position is either manual (a person dragged it there) or automatic (the layout rules placed it). The rules are deterministic and run in the browser: the same diagram always looks the same, for everyone. No agent places anything.

What never moves on its own: anything that already has a position. Adding a component, by hand or by an agent, never reshuffles the rest. A manual component only moves when someone drags it. Two exceptions, both for automatic components: a group that grows pushes its automatic neighbours aside (see below), and an automatic component (not a group) that overlaps a sibling — for example because its position was stored before the boxes grew — is placed again by the rules, like a new one, and saved.

Where a new component goes:

  • inside its group, in the column for its type, left to right: person → service → queue → data store;
  • a column holds at most 6 components: from the 7th on, a type gets another column to its right (the first with room is used), and the columns of the next types start after those;
  • an external system that only receives connections goes in the rightmost column, otherwise in the leftmost; a note goes to the top right of its group;
  • level with the component it shares the most connections with, in the first free spot that does not overlap anything.

Its placement is then saved as automatic, so it stays put from then on.

Groups grow to fit their contents. A group that grows into an automatic neighbour pushes it right or down; it never pushes a manual one. An automatic component other than a group that overlaps a sibling is placed again by the rules above and saved; of two overlapping automatic components, the topmost (then leftmost) stays. Manual components never move. Connections are always routed automatically:

  • a connection never runs through a component that is neither its source nor its target (nor a group containing one of them); it keeps 20 px clear of it and goes around;
  • it prefers the sides of the two components that face each other, as few bends as possible, and stretches that no other connection already uses; connections that still have to share a corridor are spread out side by side in parallel lanes;
  • its label is placed on a stretch where it does not overlap another label or a component;
  • routing is deterministic, so everyone sees the same drawing, and nothing about it is saved;
  • while you drag a component, its connections are drawn as simple step lines; they are routed properly again once you drop it.

Connections that share an end are bundled: connections from the same component, or to the same component, may run along the same stretch, so a fan-out is drawn as one trunk that branches near its targets. Connections that share no end still get lanes of their own.

The column limit applies only when a new component is placed. Components that already have a position keep it, so a diagram that was laid out before only changes when someone presses Tidy up.

Tidy up (in the top bar) lays out every automatic component again from scratch, in tier columns, and may shrink groups. Manual components stay exactly where they are, and nothing ends up overlapping them. Use it when a diagram has grown untidy; undo reverts it. Only people can press it: agents never place or move anything, so a diagram an agent built keeps its positions until someone tidies it.

Reset position (in a component's panel) forgets where the component was put, manual or automatic, so the rules place it again as if it were new. Use it on a component you dragged somewhere that no longer fits.

History and restore

Every change to the components and connections is a revision, recording who made it (a person, or an agent's persona), when, and a summary. Moving components is not a revision: positions are not part of the history.

  1. Click History in the top bar. Revisions are listed newest first, 50 at a time (Load older revisions for more), each described in plain words.
  2. Click a revision to see the diagram as it was, read-only, compared with now: components added since are highlighted, components removed since are faded. Editing is paused while you look.
  3. Click Restore this version and confirm to make the diagram match it again, or Back to current to leave it.

A restore does not rewrite history: it adds a new revision equal to the old one, so it can itself be undone by restoring the revision before it. Components that come back with the restore have no position and are placed by the layout rules.

For agents: the MCP tools

Agents change diagrams through the Taskbase MCP server, within the organizations they are granted. They work with keys, types, names and connections only; they never see or send positions, and they cannot delete diagrams or restore revisions.

Tool What it does
list_diagrams An organization's diagrams, with revision and component count. Check here first: the system is usually in an existing diagram
get_diagram The current model — components, connections and the revision — without positions. A component's linked_diagram_id is included only when it is set
create_diagram A new, empty diagram at revision 0, only when no existing one covers the system
apply_diagram_ops One atomic batch of ops against base_revision, with a summary naming the task
check_diagram Warnings about the current model against the conventions. Only reads; never blocks a save
list_diagram_revisions The history, newest first, with each revision's author, summary and ops

The workflow is: get_diagram, then one apply_diagram_ops with its revision as base_revision, and check_diagram after the last batch. Reuse the keys already in the diagram rather than adding a duplicate under another key. A first draft is built one system per batch, as the conventions describe.

Ops (applied in order; later ops may refer to components added earlier in the batch):

Op Fields
add_component key, type, name (required); parent (a group's key, or null for top level), tech, description, url, project_id, linked_diagram_id (another diagram of this organization that details the component; see Linked diagrams)
update_component key, plus only the fields to change; null clears linked_diagram_id. The type cannot change
remove_component key. Also removes its connections; a group must be emptied first, in an earlier op
add_connection from, to (required); label, protocol, bidirectional. Its key, <from>--<to>, is returned in connection_keys_added
update_connection key, plus label, protocol, bidirectional. Its ends cannot change
remove_connection key

Example: add a notification service to an existing taskbase group, with a queue it publishes to and the API calling it:

{
  "diagram_id": 3,
  "base_revision": 14,
  "summary": "#712: add notification service",
  "ops": [
    {"op": "add_component", "key": "notifier", "type": "service", "name": "Notifier", "parent": "taskbase", "tech": "Go"},
    {"op": "add_component", "key": "notify-queue", "type": "queue", "name": "Notification queue", "parent": "taskbase", "tech": "NATS"},
    {"op": "add_connection", "from": "taskbase-api", "to": "notifier", "label": "sends notices", "protocol": "HTTP"},
    {"op": "add_connection", "from": "notifier", "to": "notify-queue", "label": "publishes", "protocol": "NATS"}
  ]
}

It answers with the new revision and connection_keys_added (taskbase-api--notifier, notifier--notify-queue). The new components appear for people within seconds, placed by the layout rules.

The batch is all or nothing. If it is refused, every problem is reported with its op, e.g. ops[2].from: no component with key "taskbase-apy" (did you mean "taskbase-api"?); fix them and send the corrected batch with the same base_revision. If the diagram moved on since get_diagram, the call fails with a conflict: fetch the diagram again, check the change against the current model and apply it anew rather than retrying the same call.

Checking a diagram

check_diagram takes a diagram_id and checks the diagram's current model against the authoring conventions: size, mixed levels, connections to groups, duplicates, labels, missing tech and descriptions, and fan-out hubs. It only reads. It never changes the diagram, and apply_diagram_ops never refuses a batch because of a warning, so a diagram with warnings saves as before.

Agents call it after their last apply_diagram_ops batch, before they finish, and fix what it reports in one more batch where their task allows. A warning left on purpose is fine.

Behind it is the REST route GET /api/diagrams/{id}/check, open to anyone who can read the diagram's organization, like GET /api/diagrams/{id}. An unknown id answers 404. The answer holds the revision it checked and a warnings list, empty when nothing was found. For a diagram with a group sys and a service api connected to it:

{
  "revision": 1,
  "warnings": [
    {
      "code": "connection_on_group",
      "keys": ["api--sys"],
      "message": "connection api--sys ends on group \"sys\"; connect the component inside it instead"
    },
    {
      "code": "missing_description",
      "keys": ["sys"],
      "message": "components without a description: sys"
    }
  ]
}

That output is from the route's test model in api/internal/diagram/check_test.go, run on 2026-10-18. Each warning code, its rule, its thresholds and the check's limits are listed in Architecture-Diagram Conventions.

Where it lives

Part Location in Skatzi/taskbase
API and op engine api/internal/diagram/ (ops.go validates and applies batches, check.go produces the check_diagram warnings)
Tables diagrams, diagram_components, diagram_connections, diagram_positions, diagram_revisions — see Database Schema
MCP tools mcp/internal/tools/diagrams.go
Layout rules ui/src/diagramLayout/ (pure functions; Tidy up uses ELK)
Canvas, editing and history ui/src/Diagrams.jsx, DiagramCanvas.jsx, DiagramEditing.jsx, DiagramHistory.jsx
Labels, focus, merged lines and hub chips ui/src/diagrams.js (focusSet), ui/src/diagramSimplify.js (mergeParallel, findHubs, hubChips); the rules are in docs/diagram-simplification.md