> For the complete documentation index, see [llms.txt](https://docs.poweredbybackstage.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.poweredbybackstage.com/fundamentals/flows.md).

# Flows

### Flow Controller™

The core of the Backstage engine is the **Flow Controller**. Every module exposes a set of Broadcasters and Listeners. These are presented as Nodes in the Flow Controller interface. These nodes can be dragged onto the canvas, and connected together to form Flows.

### Nodes

**Nodes** are the building blocks of the Flow Controller. They can be connected together to form behavior systems, called **Flows**. These can be as simple as:

`When the video ends, send the user to the end page`

or as complex as:

`When the video ends, if the user has attended our events before, but not if they're on our mailing list, send them to the newsletter signup page`.

The underlying architecture is powerful enough to build as many branches, with as many data inputs as needed.

Some nodes have an `About` field. This field can take the ID of a module on a page, and cause the Node to only interact with a specific instance of that module. If not provided, it will interact will all Modules of that type on all pages.

For example, a `Video:ended` Broadcaster Node will, by default, fire when any Video on any page ends. If provided an ID for the Video module on `/end`, it will only fire when that specific video player ends.

## Node Types

### **Broadcaster**

![](https://cdn.document360.io/51d5f5f5-89d8-4165-89b4-3d8ba1f39542/Images/Documentation/image%281%29.png)

A **Broadcaster node** is fired when the underlying module event occurs.

For example, a **Video module** has the Broadcaster node `Video:ended`. This node fires when the currently playing video ends.

A **Broadcaster node** can include data which can be used for logic or to create dynamic behavior in a Listener Node.

### **Listener**

![](https://cdn.document360.io/51d5f5f5-89d8-4165-89b4-3d8ba1f39542/Images/Documentation/image%282%29.png)

A **Listener node** fires when it is pressurized by an upstream node. It triggers an action in the associated module, such as redirecting the user to a new page, or changing the source of a video player.

### **Middleware**

![](https://cdn.document360.io/51d5f5f5-89d8-4165-89b4-3d8ba1f39542/Images/Documentation/image%283%29.png)

A **Middleware node** applies logic to, or changes the input of a node. It passes the new data to its outputs.

### **Value**

![](https://2635135911-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9NyC60xfSabdCmQW0heP%2Fuploads%2FTaREFVYPED8DDrPLL9Vy%2Fimage.png?alt=media\&token=d109eb12-8a23-48b8-bb31-a3cfff317749)

A **Value node** provides a value to a flow. This value can be used in downstream nodes for logic, or to apply dynamic behavior to a Listener node.

### **About**

![](https://2635135911-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9NyC60xfSabdCmQW0heP%2Fuploads%2F4YWgQBgNwX606kYI2LS5%2Fimage%20\(10\).png?alt=media\&token=40d883d4-ba34-42ae-ae0b-f7488d79e832)

## Flows

![](https://2635135911-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9NyC60xfSabdCmQW0heP%2Fuploads%2F2iijxMzoraxUVpjMuKoh%2Fimage%20\(9\).png?alt=media\&token=948d550c-a27e-420a-b76b-4f0362c70eb0)

A **Flow** is formed by a series of nodes connected together, starting with at least one Broadcaster, and ending with at least one Listener.

Flows are executed when one or more Broadcaster nodes is fired. Once a Broadcaster has fired, it provides pressure to the flow.

**Pressure**

In order for a Flow to execute, it needs to be provided **Pressure**. Pressure flows from left to right in a flow.

**Only Broadcaster nodes provide pressure.** Value, Middleware, and other nodes do not.

Without Pressure, a Listener node will not fire.

Pressure propagates from the fired Broadcaster node to its children nodes, then on and on until it reaches a Listener node. Pressure can be blocked or redirected by Middleware nodes.

For example, we might want to redirect the user based on the value of their `hasAttendee` variable. We can use Middleware nodes to redirect pressure based on some criteria.

**If the user variable `hasAttended` is false, Pressure flows to Not Equal:**&#x20;

![](https://2635135911-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9NyC60xfSabdCmQW0heP%2Fuploads%2F6vB9J5PSEBRlifVvF2Eg%2Fimage%20\(8\).png?alt=media\&token=7ac5bc39-aa06-4ff5-9ae4-7e0f05906b25)

**If the user variable `hasAttended` is true, Pressure flows to Equal:**&#x20;

![](https://2635135911-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9NyC60xfSabdCmQW0heP%2Fuploads%2FLNRQrbtqCRbzw18znEnk%2Fimage%20\(7\).png?alt=media\&token=705d9d2a-3248-4d38-b74d-fdc86de7e1f6)
