> ## Documentation Index
> Fetch the complete documentation index at: https://docs.devset.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Build Event-Driven Workflows with the Flow Builder

> Learn how to create, configure, and manage visual event-driven workflows using Devset's drag-and-drop Flow Builder visual canvas editor.

The Flow Builder is the centerpiece of Devset. It gives you a visual, drag-and-drop canvas for assembling event-driven workflows — sequences of pipeline stages that emit messages to Kafka or RabbitMQ according to the logic you define. Every stage, field value, and expression lives in a portable DSL that you can import, export, and version however you like. Open the Flow Builder at [http://localhost:8082/flow-builder](http://localhost:8082/flow-builder).

## The Manage View

Before you open the canvas, the **Manage** view at `/flow-builder/manage` gives you a table of every workflow you have saved. From here you can open a workflow in the editor, clone it to use as a starting point, or delete it entirely.

You can also bring in a workflow from outside Devset using the **Import** button. Paste any valid DSL JSON and Devset will load it as a new workflow ready for editing.

## Creating a New Workflow

<Steps>
  <Step title="Open the Manage view">
    Navigate to [http://localhost:8082/flow-builder/manage](http://localhost:8082/flow-builder/manage) and click **New Workflow**. The canvas editor opens with a blank workflow.
  </Step>

  <Step title="Configure the Workflow Panel">
    In the right-hand sidebar, the **Workflow Panel** shows the current workflow's ID field. Enter a unique **Workflow ID** to identify this workflow. To configure the other top-level properties — message type, content type, producer name, topic or exchange, routing key, schema ID, and execution count — open the **Payload Editor** from the Workflow Panel and edit those fields directly in the DSL JSON.
  </Step>

  <Step title="Add pipeline stages">
    Click the **Add Step** button on the canvas toolbar. If your workflow has a schema attached, you can pick fields from it when configuring the new stage. A colored stage node appears on the canvas connected to the previous node by an arrow.

    Repeat this step until you have all the stages your workflow requires.
  </Step>

  <Step title="Configure each stage">
    Click a stage node to select it. The **Stage Inspector** panel opens in the right sidebar. Use it to configure:

    * **Set fields** — static or computed values written into the message payload.
    * **State fields** — values read from or written to the shared workflow state.

    For more complex logic on any individual field, use **Function Studio** (see below).
  </Step>

  <Step title="Save your workflow">
    When you are happy with the canvas, save the workflow. If you try to navigate away with unsaved changes, Devset will prompt you to confirm before discarding them.
  </Step>
</Steps>

<Tip>
  Setting a `schemaId` in the workflow DSL (via the **Payload Editor**) unlocks field autocomplete throughout the editor, including in the Stage Inspector and Function Studio. Add your schemas to the Schema Repo first to get the most out of this feature.
</Tip>

## Using Function Studio for Per-Field Expressions

Function Studio is a per-field expression editor that opens as a full-screen drawer from the sidebar. It lets you go beyond static values and write dynamic expressions for any field in a stage.

<Steps>
  <Step title="Open Function Studio">
    With a stage node selected on the canvas, click the **Open Function Studio** button in the sidebar. The Function Studio drawer slides open with a **field tree picker** on the left and an **expression editor** on the right.
  </Step>

  <Step title="Pick the field">
    Use the field tree on the left to navigate to the field you want to set. If a schema is attached to the workflow, the tree reflects its structure.
  </Step>

  <Step title="Choose a field mode">
    Select the mode that matches your intent:

    | Mode      | Description                                                               |
    | --------- | ------------------------------------------------------------------------- |
    | `LITERAL` | A static, hard-coded value.                                               |
    | `FN`      | A function call such as `uuid()` or `int(1, 100)`.                        |
    | `REF`     | A relative reference to another field in the same message.                |
    | `PATH`    | An absolute path into the shared workflow state.                          |
    | `WHEN`    | A conditional expression — returns different values based on a condition. |
  </Step>

  <Step title="Write and confirm the expression">
    Type your expression in the editor on the right, then confirm to save it back to the stage.
  </Step>
</Steps>

## Importing and Exporting Workflows

Devset workflows are stored as a JSON DSL, which makes them easy to share, version-control, or migrate between environments.

**To export a workflow**, open the canvas editor and click **Payload Editor** in the Workflow Panel sidebar. This modal displays the raw DSL JSON for the current workflow. Copy the contents to share or commit the workflow to source control.

**To import a workflow**, go to the Manage view and click **Import**. Paste the DSL JSON into the dialog and confirm. The workflow is loaded into Devset as a new entry in your workflow list.

<Note>
  The Payload Editor also lets you edit the DSL directly. This is useful for bulk edits that would be tedious to make field by field in the canvas UI.
</Note>

## Managing Workflows from the Manage View

The Manage view table shows every saved workflow alongside three actions:

<CardGroup cols={3}>
  <Card title="Open" icon="arrow-up-right-from-square">
    Load the workflow in the canvas editor to view or modify it.
  </Card>

  <Card title="Clone" icon="copy">
    Create a duplicate of the workflow with a new ID. Useful for creating variations without modifying the original.
  </Card>

  <Card title="Delete" icon="trash">
    Permanently remove the workflow from Devset. This action cannot be undone.
  </Card>
</CardGroup>

## Defining Initial Workflow State

Open the **Workflow State Editor** modal from the Workflow Panel in the sidebar to define the initial state shape for the workflow. State values are accessible in Function Studio using the `PATH` mode and can be read or updated by any stage during execution.
