Menu

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.

{"skemo":1,"name":"architecture.skemo","source":"//- Software architecture: a web shop, its services and their data\ndiagram(dir=\"down\")\n\n card#shopper.person(icon=\"user\") Shopper\n to(web) HTTPS\n\n zone#shop.system Web shop\n card#web.app(icon=\"monitor\") Storefront\n | React, served by the CDN\n to(api) JSON\n card#api.app(icon=\"server\") API\n | Rust, 3 instances\n to(catalog orders)\n card#catalog.app Catalog service\n to(search)\n card#orders.app Orders service\n to(db) SQL\n to(queue).async order placed\n to(pay) charge\n card#search.store(icon=\"search\") Search index\n card#db.store(icon=\"database\") Orders DB\n | PostgreSQL\n card#queue.store Event bus\n\n card#pay.external(icon=\"credit-card\") Payment provider\n","css":[{"name":"architecture.css","content":".person { --c: #7048E8; --label: \"Person\"; }\n.app { --c: #3E6FC4; --label: \"Container\"; }\n.store { --c: #B45309; --label: \"Data\"; }\n.external { --c: #6B7280; --label: \"External system\"; }\n.system { --z-ink: #3E6FC4; }\n.edge.async .line { stroke-dasharray: 5 4; }\n"}],"theme":"light"}PERSONShopperWEB SHOPCONTAINERStorefrontReact, served by the CDNCONTAINERAPIRust, 3 instancesCONTAINERCatalog serviceCONTAINEROrders serviceDATASearch indexDATAOrders DBPostgreSQLDATAEvent busEXTERNAL SYSTEMPayment providerHTTPSJSONSQLorder placedcharge
{"skemo":1,"name":"architecture.skemo","source":"//- Software architecture: a web shop, its services and their data\ndiagram(dir=\"down\")\n\n card#shopper.person(icon=\"user\") Shopper\n to(web) HTTPS\n\n zone#shop.system Web shop\n card#web.app(icon=\"monitor\") Storefront\n | React, served by the CDN\n to(api) JSON\n card#api.app(icon=\"server\") API\n | Rust, 3 instances\n to(catalog orders)\n card#catalog.app Catalog service\n to(search)\n card#orders.app Orders service\n to(db) SQL\n to(queue).async order placed\n to(pay) charge\n card#search.store(icon=\"search\") Search index\n card#db.store(icon=\"database\") Orders DB\n | PostgreSQL\n card#queue.store Event bus\n\n card#pay.external(icon=\"credit-card\") Payment provider\n","css":[{"name":"architecture.css","content":".person { --c: #7048E8; --label: \"Person\"; }\n.app { --c: #3E6FC4; --label: \"Container\"; }\n.store { --c: #B45309; --label: \"Data\"; }\n.external { --c: #6B7280; --label: \"External system\"; }\n.system { --z-ink: #3E6FC4; }\n.edge.async .line { stroke-dasharray: 5 4; }\n"}],"theme":"dark"}PERSONShopperWEB SHOPCONTAINERStorefrontReact, served by the CDNCONTAINERAPIRust, 3 instancesCONTAINERCatalog serviceCONTAINEROrders serviceDATASearch indexDATAOrders DBPostgreSQLDATAEvent busEXTERNAL SYSTEMPayment providerHTTPSJSONSQLorder placedcharge
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 provider
architecture.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 #id names 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) SQL under 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 levelIn skemo
System contextone card per system and per kind of user; your system as a single card
Containeryour system as a zone holding its applications and data stores
Componentone container as a zone holding its components
Deploymentnested 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