Flow frontmatter API
Overview​
Flows are just markdown files, with this comes the use of Content, MDX components and also front-matter.
Here is an example of of a basic flow.
---
# id of the flow
id: "CancelSubscriptionFlow"
# Display name of the flow, rendered in EventCatalog
name: "User Cancels Subscription"
# version for your flow
version: "0.0.1"
# Short summary of your event
summary: "Flow for when a user has cancelled a subscription"
# A list of steps for your flow
steps:
# id of your step, required for linking between stages in your flow
- id: "cancel_subscription_initiated"
# rendered title of your step
title: "Cancels Subscription"
# Short summary of a step
summary: "User cancels their subscription"
# Defining an actor will render an actor node in the graph.
actor:
name: "User"
# What happens next? Define the next step
next_step:
id: "cancel_subscription_request"
label: "Initiate subscription cancellation"
- id: "cancel_subscription_request"
title: "Cancel Subscription"
# This step is a message, include the message and version
message:
id: "CancelSubscription"
version: "0.0.1"
next_step:
id: "subscription_service"
label: "Proceed to subscription service"
- id: "stripe_integration"
title: "Stripe"
# This is an external system (e.g Stripe)
externalSystem:
name: "Stripe"
summary: "3rd party payment system"
url: "https://stripe.com/"
next_step:
id: "subscription_service"
label: "Return to subscription service"
- id: "subscription_service"
title: "Subscription Service"
# This node is a service, include that.
service:
id: "SubscriptionService"
version: "0.0.1"
# Define multiple steps
next_steps:
- id: "stripe_integration"
label: "Cancel subscription via Stripe"
- id: "subscription_cancelled"
label: "Successful cancellation"
- id: "subscription_rejected"
label: "Failed cancellation"
- id: "subscription_cancelled"
title: "Subscription has been Cancelled"
message:
id: "UserSubscriptionCancelled"
version: "0.0.1"
next_step:
id: "notification_service"
label: "Email customer"
- id: "subscription_rejected"
title: "Subscription cancellation has been rejected"
- id: "notification_service"
title: "Notifications Service"
service:
id: "NotificationService"
version: "0.0.2"
---
This flow documents what happens when a User Cancels Subscription in our system.
<NodeGraph />
<!-- Add any markdown you want, the workflow will also render in its own page /docs/flows/{Flow}/{version} -->
Required fields​
id
​
- Type:
CancelSubscriptionFlow
Unqiue id of the flow. EventCatalog uses this for references and slugs.
---
id: InventoryOutOfStock
---
name
​
- Type:
string
Name of the flow this is used to display the name on the UI.
---
name: User Cancels Subscription
---
version
​
- Type:
string
Version of the flow.
---
version: 0.0.1
---
steps
​
- Type:
Step[]
List of steps for your flow.
---
steps:
- id: "cancel_subscription_initiated"
title: "Cancels Subscription"
summary: "User cancels their subscription"
# Define a single step that happens next
next_step:
id: "cancel_subscription_request"
label: "Initiate subscription cancellation"
# OR define a multiple next steps
next_steps:
- id: "stripe_integration"
label: "Cancel subscription via Stripe"
- id: "subscription_cancelled"
label: "Successful cancellation"
- id: "subscription_rejected"
label: "Failed cancellation"
---
Actor Nodes​
Flows allow you to create Actor nodes. Actors represent A person who executes a command or flow.
---
steps:
- id: "cancel_subscription_initiated"
title: "Cancels Subscription"
summary: "User cancels their subscription"
# Defining an actor will render an actor node in the graph.
actor:
name: "User"
next_step:
id: "cancel_subscription_request"
label: "Initiate subscription cancellation"
---
External Services Nodes​
Flows allow you to create External Service. These services tend to be other external services you may interact with that are not part of your business domain. (e.g Stripe API)
---
steps:
- id: "stripe_integration"
title: "Stripe"
# This is an external system (e.g Stripe)
externalSystem:
name: "Stripe"
summary: "3rd party payment system"
url: "https://stripe.com/"
next_step:
id: "subscription_service"
label: "Return to subscription service"
---
See example of Actor node in a workflow.
Message Nodes​
Flows allow you to create message nodes. Messages link to your commands or events.
---
steps:
- id: "cancel_subscription_request"
title: "Cancel Subscription"
# This step is a message, include the message and version
message:
id: "CancelSubscription"
version: "0.0.1"
next_step:
id: "subscription_service"
label: "Proceed to subscription service"
---
See example of Message node in a workflow.
Service Nodes​
Flows allow you to create service nodes. Services link to your defined services in EventCatalog.
---
- id: "subscription_service"
title: "Subscription Service"
# This node is a service, include that.
service:
id: "SubscriptionService"
version: "0.0.1"
# Define multiple steps
next_steps:
- id: "stripe_integration"
label: "Cancel subscription via Stripe"
- id: "subscription_cancelled"
label: "Successful cancellation"
- id: "subscription_rejected"
label: "Failed cancellation"
---
See example of Message node in a workflow.
Optional fields​
summary
​
Short summary of your flow, shown on flow summary pages.
---
summary: |
Flow that explains how a user unsubscribes to our system
---
badges
​
An array of badges that get rendered on the page.
---
badges:
- content: My badge
backgroundColor: blue
textColor: blue
---