Skip to main content

Using plantuml

EventCatalog supports plantuml in all your markdown files.

This let's you create Class Diagrams, Sequence Diagrams, Class Diagrams, State Diagrams and much more.

Using plantuml in EventCatalog

To use plantuml you need to use the plantuml code block in any markdown file.

Example

```plantuml
@startuml
!define Table(name,desc) class name as "desc" << (T,#E5E7EB) >>
!define PK(x) <u>x</u>
!define FK(x) <i>x</i>

' ===== Core Tables =====

Table(Customers, "Customers") {
PK(customerId): UUID
firstName: VARCHAR
lastName: VARCHAR
email: VARCHAR
phone: VARCHAR
dateRegistered: TIMESTAMP
}

Table(Orders, "Orders") {
PK(orderId): UUID
FK(customerId): UUID
orderDate: TIMESTAMP
status: VARCHAR
totalAmount: DECIMAL
}

Table(Products, "Products") {
PK(productId): UUID
name: VARCHAR
description: TEXT
price: DECIMAL
stockQuantity: INT
}

Table(OrderItems, "Order Items") {
PK(id): UUID
FK(orderId): UUID
FK(productId): UUID
quantity: INT
unitPrice: DECIMAL
}

Table(Payments, "Payments") {
PK(paymentId): UUID
FK(orderId): UUID
amount: DECIMAL
method: VARCHAR
status: VARCHAR
paidAt: TIMESTAMP
}

Table(InventoryEvents, "Inventory Events") {
PK(eventId): UUID
FK(productId): UUID
eventType: VARCHAR
quantityChange: INT
eventTime: TIMESTAMP
}

Table(Subscription, "Subscriptions") {
PK(subscriptionId): UUID
FK(customerId): UUID
plan: VARCHAR
status: VARCHAR
startDate: TIMESTAMP
endDate: TIMESTAMP
}

' ===== Relationships =====

Customers ||--o{ Orders : places
Orders ||--o{ OrderItems : contains
Products ||--o{ OrderItems : includes
Orders ||--o{ Payments : paid_by
Products ||--o{ InventoryEvents : logs
Customers ||--o{ Subscription : subscribes

@enduml
```_

This example will output the following in the markdown file.

Example output of plantuml

How it works?

The PlantUML implementation takes your content and converts it to a PNG image using https://www.plantuml.com/plantuml/svg.

More resources