Creating elements
A model has four levels: System context, Containers, Components and Code. Every element you add belongs to the level you are looking at. A container lives inside a system, a component inside a container, a code element inside a component. To add containers, open a system first; to add components, open a container.
Add a block
From the menu. Press Add block (the plus) in the tools rail on the left of the canvas. The menu depends on the level:
| Row | Where | What it adds |
|---|---|---|
| Empty block | every level | A blank element of this level. |
| User | System context, Containers | A person or actor, drawn with the C4 person glyph. |
| API Endpoint | Components | An endpoint with HTTP method, path, headers, request and response. |
| Presets | every level | An element with a name, technology and short description filled in. System context: API Gateway, External System, Domain Service. Containers: Spring Boot API, NestJS API, PostgreSQL, Redis, Kafka, React SPA, API Gateway. Components: Controller, Repository, Service, GET Endpoint, POST Endpoint. Code: Java Class, TypeScript Interface. |
If the rows are greyed out, the menu says why, for example Open a system first to add containers.
With a double click. Double-click an empty spot on the canvas. An empty block appears there.
Inside a database container the Components level holds tables, so the menu offers Empty table, the Schema editor and table presets, and a double click adds nothing. Inside a message broker it offers Empty channel and channel presets. Both are covered below.
More kinds of elements
- Users: people and roles that use the system.
- API endpoints: the operations of a service with their contracts.
- Message brokers and queues: Kafka, RabbitMQ and other brokers, and their topics and queues.
- Databases and ER schemas: a database, its tables and its foreign keys.
- Clones: an element from elsewhere in the model, shown live on this diagram.
Name it and describe it
Click the block. Its panel opens on the right: name, description, technology and the rest. Element settings goes through every field.
Connect two blocks
Each block has small dots on its edges. Drag from a dot to another block and release. The connection is drawn with an arrow in the direction you dragged. Click a connection to open its own settings, such as its title and direction.
Go inside a block
The magnifier on a block opens the next level inside it: a system's containers, a container's components, a component's code. Use the back arrow in the bar at the top left to come back up.
Change or delete
Right-click a block for its menu: edit it, highlight its connections, or delete it. Before deleting, Viaduct asks for confirmation and says what goes with the element: deleting a system also deletes its containers, components and their connections.
The same help in the app
In the bottom right corner of the canvas there is a question mark, What is this level for? Hover it to play the video above; click it for tips about the current level.