ObjectStackObjectStack

Flow Builder

Flow Builder protocol schemas

@module studio/flow-builder

Studio Flow Builder Protocol

Defines the specification for the visual Flow Builder (automation canvas) within ObjectStack Studio. Covers:

  • Node Shape Registry: Shape and visual style per FlowNodeAction type
  • Canvas Node: Position, size, and rendering hints for each node on canvas
  • Canvas Edge: Visual properties for sequence flows (normal, default, fault, back-edge)
  • Flow Builder Config: Canvas settings, palette, minimap, and toolbar

Architecture

┌──────────────────────────────────────────────────────────────┐
│  Toolbar (run / save / undo / zoom / layout)                │
├──────────┬───────────────────────────────────┬───────────────┤
│  Node    │       Canvas                      │  Property     │
│  Palette │  ┌─────┐    ┌──────────┐          │  Panel        │
│          │  │start│───▶│ decision │──▶ ...   │  (node-aware) │
│  ─ BPMN  │  └─────┘    └──────────┘          │               │
│  ─ CRUD  │       ┌──────────┐                │  ─ config     │
│  ─ Logic │       │parallel  │                │  ─ edges      │
│  ─ HTTP  │       │ gateway  │                │  ─ validation │
├──────────┴───────────────────────────────────┴───────────────┤
│  Minimap / Zoom Controls                                     │
└──────────────────────────────────────────────────────────────┘

Source: packages/spec/src/studio/flow-builder.zod.ts

TypeScript Usage

import { FlowBuilderConfigSchema, FlowCanvasEdgeSchema, FlowCanvasEdgeStyleSchema, FlowCanvasNodeSchema, FlowLayoutAlgorithmSchema, FlowLayoutDirectionSchema, FlowNodeRenderDescriptorSchema, FlowNodeShapeSchema } from '@objectstack/spec/studio';
import type { FlowBuilderConfig, FlowCanvasEdge, FlowCanvasEdgeStyle, FlowCanvasNode, FlowLayoutAlgorithm, FlowLayoutDirection, FlowNodeRenderDescriptor, FlowNodeShape } from '@objectstack/spec/studio';

// Validate data
const result = FlowBuilderConfigSchema.parse(data);

FlowBuilderConfig

Studio Flow Builder configuration

Properties

PropertyTypeRequiredDescription
snap{ enabled: boolean; gridSize: integer; showGrid: boolean }optional (default: {"enabled":true,"gridSize":16,"showGrid":true})Canvas snap-to-grid settings
zoom{ min: number; max: number; default: number; step: number }optional (default: {"min":0.25,"max":3,"default":1,"step":0.1})Canvas zoom settings
layoutAlgorithmEnum<'dagre' | 'elk' | 'force' | 'manual'>optional (default: "dagre")Default auto-layout algorithm
layoutDirectionEnum<'TB' | 'BT' | 'LR' | 'RL'>optional (default: "TB")Default auto-layout direction
nodeDescriptors{ action: string; shape: Enum<'rounded_rect' | 'circle' | 'diamond' | 'parallelogram' | 'hexagon' | …>; icon: string; defaultLabel: string; … }[]optionalCustom node render descriptors (merged with built-in defaults)
showMinimapbooleanoptional (default: true)Show minimap panel
showPropertyPanelbooleanoptional (default: true)Show property panel
showPalettebooleanoptional (default: true)Show node palette sidebar
undoLimitintegeroptional (default: 50)Maximum undo history steps
animateExecutionbooleanoptional (default: true)Animate edges during execution preview
connectionValidationbooleanoptional (default: true)Validate connections before creating edges

Nested Shape: FlowBuilderConfig.snap

PropertyTypeRequiredDescription
enabledbooleanoptional (default: true)Enable snap-to-grid
gridSizeintegeroptional (default: 16)Snap grid size in pixels
showGridbooleanoptional (default: true)Show grid overlay

Nested Shape: FlowBuilderConfig.zoom

PropertyTypeRequiredDescription
minnumberoptional (default: 0.25)Minimum zoom level
maxnumberoptional (default: 3)Maximum zoom level
defaultnumberoptional (default: 1)Default zoom level
stepnumberoptional (default: 0.1)Zoom step

Nested Shape: FlowBuilderConfig.nodeDescriptors[number]

Visual render descriptor for a flow node type

PropertyTypeRequiredDescription
actionstringFlowNodeAction value (e.g., "parallel_gateway")
shapeEnum<'rounded_rect' | 'circle' | 'diamond' | 'parallelogram' | 'hexagon' | …>Shape to render
iconstringLucide icon name
defaultLabelstringDefault display label
defaultWidthintegeroptional (default: 120)Default width in pixels
defaultHeightintegeroptional (default: 60)Default height in pixels
fillColorstringoptional (default: "#ffffff")Node fill color (CSS value)
borderColorstringoptional (default: "#94a3b8")Node border color (CSS value)
allowBoundaryEventsbooleanoptional (default: false)Whether boundary events can be attached to this node type
paletteCategoryEnum<'event' | 'gateway' | 'activity' | 'data' | 'subflow'>Palette category for grouping

FlowCanvasEdge

Canvas layout and visual data for a flow edge

Properties

PropertyTypeRequiredDescription
edgeIdstringCorresponding FlowEdge.id
styleEnum<'solid' | 'dashed' | 'dotted' | 'bold' | 'back'>optional (default: "solid")Line style
colorstringoptional (default: "#94a3b8")Edge line color
labelPositionnumberoptional (default: 0.5)Position of the condition label along the edge
waypoints{ x: number; y: number }[]optionalManual waypoints for edge routing
animatedbooleanoptional (default: false)Show animated flow indicator

Nested Shape: FlowCanvasEdge.waypoints[number]

PropertyTypeRequiredDescription
xnumberWaypoint X
ynumberWaypoint Y

FlowCanvasEdgeStyle

Edge line style

Allowed Values

  • solid
  • dashed
  • dotted
  • bold
  • back

FlowCanvasNode

Canvas layout data for a flow node

Properties

PropertyTypeRequiredDescription
nodeIdstringCorresponding FlowNode.id
xnumberX position on canvas
ynumberY position on canvas
widthintegeroptionalWidth override in pixels
heightintegeroptionalHeight override in pixels
collapsedbooleanoptional (default: false)Whether the node is collapsed
fillColorstringoptionalFill color override
borderColorstringoptionalBorder color override
annotationstringoptionalUser annotation displayed near the node

FlowLayoutAlgorithm

Auto-layout algorithm for the flow canvas

Allowed Values

  • dagre
  • elk
  • force
  • manual

FlowLayoutDirection

Auto-layout direction

Allowed Values

  • TB
  • BT
  • LR
  • RL

FlowNodeRenderDescriptor

Visual render descriptor for a flow node type

Properties

PropertyTypeRequiredDescription
actionstringFlowNodeAction value (e.g., "parallel_gateway")
shapeEnum<'rounded_rect' | 'circle' | 'diamond' | 'parallelogram' | 'hexagon' | 'diamond_thick' | 'attached_circle' | 'screen_rect'>Shape to render
iconstringLucide icon name
defaultLabelstringDefault display label
defaultWidthintegeroptional (default: 120)Default width in pixels
defaultHeightintegeroptional (default: 60)Default height in pixels
fillColorstringoptional (default: "#ffffff")Node fill color (CSS value)
borderColorstringoptional (default: "#94a3b8")Node border color (CSS value)
allowBoundaryEventsbooleanoptional (default: false)Whether boundary events can be attached to this node type
paletteCategoryEnum<'event' | 'gateway' | 'activity' | 'data' | 'subflow'>Palette category for grouping

FlowNodeShape

Visual shape for rendering a flow node on the canvas

Allowed Values

  • rounded_rect
  • circle
  • diamond
  • parallelogram
  • hexagon
  • diamond_thick
  • attached_circle
  • screen_rect

On this page