Skip to main content

External PlantUML sources via src

This page demonstrates component-level src support on kroki code blocks.

Instead of putting the full PlantUML diagram inline, you can reference a local .puml file. src is resolved relative to this .md file.

```kroki imgType="plantuml" imgTitle="Order model" src="./external-plantuml-src.puml"
```

Class diagram from external .puml

Order aggregate class diagram

PlantUML source for "Order aggregate class diagram"
class Order {
-id: UUID
-createdAt: LocalDateTime
-status: OrderStatus
+markAsPaid(): void
}

class OrderLine {
-productId: UUID
-quantity: int
-unitPrice: Money
}

class Customer {
-id: UUID
-name: String
}

Order "1" *-- "*" OrderLine : contains
Order --> "1" Customer : placedBy

Class diagram with 3 class(es) and 2 relation(s).

Classes:

  • Class Order with:
    • public method 'markAsPaid', without parameters, return type void
    • private attribute 'id' of type UUID
    • private attribute 'createdAt' of type LocalDateTime
    • private attribute 'status' of type OrderStatus
  • Class OrderLine with:
    • private attribute 'productId' of type UUID
    • private attribute 'quantity' of type int
    • private attribute 'unitPrice' of type Money
    • no methods
  • Class Customer with:
    • private attribute 'id' of type UUID
    • private attribute 'name' of type String
    • no methods

Relations:

  • Order has a composition-relationship named 'contains' with OrderLine, multiplicity 1 to *
  • Order has an association-relationship named 'placedBy' with Customer, multiplicity 1

C4 Context diagram from external .puml

Online bookstore C4 context

PlantUML source for "Online bookstore C4 context"
@startuml
!include <C4/C4_Context>

title Context diagram - Online Bookstore

Person(customer, "Customer", "Places and tracks book orders")
System(bookstore, "Online Bookstore", "Web application for ordering books")
System_Ext(payment, "Payment Provider", "Processes online payments")
System_Ext(warehouse, "Warehouse System", "Handles picking and shipping")

Rel(customer, bookstore, "Browses and places orders")
Rel(bookstore, payment, "Requests payment authorization")
Rel(bookstore, warehouse, "Sends shipment requests")
Rel(warehouse, customer, "Delivers books")
@enduml

C4 System Context diagram with:

  • 1 actor: Customer
  • 3 systems:
    • 1 internal system: Online Bookstore
    • 2 external systems: Payment Provider, Warehouse System
  • 4 relationships:
    • Customer browses and places orders Online Bookstore
    • Online Bookstore requests payment authorization Payment Provider
    • Online Bookstore sends shipment requests Warehouse System
    • Warehouse System delivers books Customer