Software architecture diagrams
Describe the people, applications, services and data stores of a system and the calls between them. skemo places every box, routes every arrow and keeps the drawing tidy when the system changes.
architecture.skemo
//- Software architecture: a web shop, its services and their data
diagram(dir="down")
card#shopper.person(icon="user") Shopper
to(web) HTTPS
zone#shop.system Web shop
card#web.app(icon="monitor") Storefront
| React, served by the CDN
to(api) JSON
card#api.app(icon="server") API
| Rust, 3 instances
to(catalog orders)
card#catalog.app Catalog service
to(search)
card#orders.app Orders service
to(db) SQL
to(queue).async order placed
to(pay) charge
card#search.store(icon="search") Search index
card#db.store(icon="database") Orders DB
| PostgreSQL
card#queue.store Event bus
card#pay.external(icon="credit-card") Payment providerarchitecture.css
.person { --c: #7048E8; --label: "Person"; }
.app { --c: #3E6FC4; --label: "Container"; }
.store { --c: #B45309; --label: "Data"; }
.external { --c: #6B7280; --label: "External system"; }
.system { --z-ink: #3E6FC4; }
.edge.async .line { stroke-dasharray: 5 4; }How it is written
- One card per building block:
card#api.app API. The#idnames it for arrows, the class gives it a type. - One zone per boundary: a system, a team, a deployment unit. What is indented under the zone is inside it.
- Arrows are written inside the card they leave:
to(db) SQLunder the Orders service draws the call and its label.to(catalog orders)draws two arrows that share a fork. - Types are CSS:
.app { --c: #3E6FC4; --label: "Container"; }colours every container and writes its category above the name. Change one line to restyle the whole diagram.
The C4 model
The example follows the container level of the C4 model: a person, the containers of one
system, an external system. Each C4 level is a separate .skemo file with the same types:
| C4 level | In skemo |
|---|---|
| System context | one card per system and per kind of user; your system as a single card |
| Container | your system as a zone holding its applications and data stores |
| Component | one container as a zone holding its components |
| Deployment | nested zones for regions, networks and machines: see cloud and network diagrams |
Keeping it readable
- Choose the direction that follows the main flow:
diagram(dir="down")for request paths,dir="right"for data pipelines (Layout). - Give asynchronous flows their own arrow class (
.async, dashed) so they read without colour. - Add a legend that lists the types for you:
card.legend(at="ne")(Rich cards). - Edit freely: adding a service re-lays out the diagram, and pinning a card with
at="x,y"keeps it where you want it.
See also
- Cards and zones and Arrows, the reference of every attribute.
- Styling with CSS: card looks, colours, dark mode.
- Diagrams as code: keep the file in the repository and render it in CI.
