Structured elements
When a box and a label leave out details readers need, choose a structured element for a table's columns or an endpoint's parameters. Its editor keeps those fields together on the canvas.
Editing these elements requires docs:write.
Choose an element
Press Shift+N and choose an entry under Diagram Elements.
| Element | What it records |
|---|---|
| ERD Entity (table) | A table name, columns, types and constraints. |
| REST endpoint | An HTTP method and path, parameters, headers and body schema. |
| gRPC method | A service and method, streaming type, metadata and message names. |
| Sequence diagram | Participants and the messages between them. |
| Service card | A service's name, technology and description. |
C4 cards also include Person card, External card, Container card, Component card, Database card and Queue card. In the + popover, Architecture card inserts a service card.
Open the editor
- Place the element and select it.
- Double-click it, or select the Edit pencil icon.
- Change its fields, then click outside the editor to finish.
ERD entities, endpoint cards and C4 cards size themselves from their content. They don't have the free resize handles of an ordinary rectangle.
Describe a table
In an ERD entity, change the title and select Add row for each column. Enter the column name and type, then set the flags that apply:
| Flag | Meaning |
|---|---|
| PK | Primary key |
| FK | Foreign key |
| NN | Not null |
| UQ | Unique |
Use the row icons to reorder or remove columns. Collapse the entity when you only need its title on screen.
Record an API contract
For REST endpoint, fill in HTTP method and Path, then add Path params, Query params or Headers as needed. Use Auth to describe authentication and Body schema for the body.
For gRPC method, fill in Service and Method. Streaming type has unary, server, client and bidi choices. Add Metadata, Request message and Reply message where needed.
Choose REST or gRPC when you insert the element. You can't switch its protocol in the editor.
Build a sequence
- Set Diagram title.
- Under Participants, select + participant and name each participant, such as Dispatch Service and Billing Service.
- Under Messages, select + message. Choose its sender, recipient and message type, then enter its label.
Message types are sync, async, return, self, create and destroy. Removing a participant also removes messages to or from it.
You can select an existing object for a participant to attach its object identity and icon.
Edit a C4 card
Set Name, Kind, Technology and Description in the card editor. Changing Kind lets you reuse the card as a person, service, database or another available C4 kind.
A service card is local to the diagram. Naming it Dispatch Service doesn't attach it to the Dispatch Service object. Use an object reference when you need that connection.