- 0 minutes to read

Dynamic Diagram Example

The Dynamic diagram shows how systems or containers interact at runtime for a specific business scenario. It illustrates the sequence of calls, message flows, and response paths — revealing order of operations and integration touchpoints.

See Example C4 Diagrams for an overview of all diagram types and when to use each.

When to Use

  • Documenting and reviewing a specific business workflow end-to-end
  • Troubleshooting integration failures — trace where a message flow breaks
  • Communicating runtime behaviour and message ordering to technical teams
  • Focuses on one scenario at a time — not a complete system overview

Import and round-trip support: When a C4Dynamic diagram is imported, numeric step prefixes in relationship labels (e.g., 1. Click 'Place Order') are parsed and their sequence order is preserved. The Mermaid generator re-emits the labels with the same step numbers — the full numbered sequence survives import, persist, and regenerate without manual correction.

Example: Order Placement Workflow

Preview Mermaid Code
C4Dynamic title Order Placement - Sequence of Interactions Person(customer, "Customer") Container(web_app, "Web Application") Container(order_api, "Order API") Container(payment_gateway, "Payment Gateway") Container(message_bus, "Message Bus") Container(fulfillment_svc, "Fulfillment Service") Container(order_db, "Order Database") Rel(customer, web_app, "1. Click 'Place Order'") Rel(web_app, order_api, "2. POST /orders with items and payment info") Rel(order_api, order_db, "3. INSERT Order record (status=pending)") Rel(order_api, payment_gateway, "4. Charge credit card") Rel(payment_gateway, order_api, "5. Return success/failure") Rel(order_api, order_db, "6. UPDATE Order status=paid") Rel(order_api, message_bus, "7. PUBLISH OrderPlaced event") Rel(message_bus, fulfillment_svc, "8. Deliver OrderPlaced event") Rel(fulfillment_svc, order_api, "9. GET /orders/{orderId}") Rel(fulfillment_svc, order_db, "10. Query OrderItems") Rel(order_api, web_app, "11. Return order confirmation") Rel(web_app, customer, "12. Display 'Order Confirmed'")
C4Dynamic
    title Order Placement - Sequence of Interactions

    Person(customer, "Customer")
    Container(web_app, "Web Application")
    Container(order_api, "Order API")
    Container(payment_gateway, "Payment Gateway")
    Container(message_bus, "Message Bus")
    Container(fulfillment_svc, "Fulfillment Service")
    Container(order_db, "Order Database")

    Rel(customer, web_app, "1. Click 'Place Order'")
    Rel(web_app, order_api, "2. POST /orders with items and payment info")
    Rel(order_api, order_db, "3. INSERT Order record (status=pending)")
    Rel(order_api, payment_gateway, "4. Charge credit card")
    Rel(payment_gateway, order_api, "5. Return success/failure")
    Rel(order_api, order_db, "6. UPDATE Order status=paid")
    Rel(order_api, message_bus, "7. PUBLISH OrderPlaced event")
    Rel(message_bus, fulfillment_svc, "8. Deliver OrderPlaced event")
    Rel(fulfillment_svc, order_api, "9. GET /orders/{orderId}")
    Rel(fulfillment_svc, order_db, "10. Query OrderItems")
    Rel(order_api, web_app, "11. Return order confirmation")
    Rel(web_app, customer, "12. Display 'Order Confirmed'")

Next Step

See the Deployment Diagram Example to understand where these containers are physically hosted.