Skip to content

Data Model Reference

Data Model Reference

All models live in pkg/model/. The MongoDB database is set by MONGODB_DB (default: ud).

Flow Execution Domain

flows β€” DBFlow

The template/definition of a workflow.

FieldTypeDescription
_idObjectIDPrimary key
companyIdObjectIDTenant isolation key (on every entity)
namestringDisplay name
enabledboolWhether the flow can be triggered
categorystringUser-defined grouping label
permanentIdstringStable ID across versions
versionintIncremented on each update
deletedboolSoft-delete flag
kvInheritstringKV inheritance strategy from parent scope
kvConflictstringKV conflict resolution strategy
executionobjectExecution configuration (timeout, queue settings)
groupIdObjectIDReference to DBFlowGroup

layers β€” DBFlowlet (referred to as Layer in code)

One step (module invocation) within a flow.

FieldTypeDescription
_idObjectIDPrimary key
flowIdObjectIDParent flow reference
namestringDisplay name
refstringUnique reference name within the flow (used in expressions)
appIdstringModule type identifier (e.g., curl, chat, pdf-extract)
argsmapModule arguments (can contain expressions)
indexintExecution order position
timeoutintPer-step timeout in seconds
retryobjectRetry configuration (count, delay, backoff, jitter)
componentConfigIdsmapOverride default component per kind (e.g., use specific AI provider)
linkIdsByTypemapOAuth/credential link assignments per service type
filtersarrayPre-execution conditions (AND/OR filter expressions)
needsApprovalboolPauses execution and waits for human approval
moduleVersionintTracks which module version was used

plays β€” DBPlay

A single execution instance of a flow.

FieldTypeDescription
_idObjectIDPrimary key
flowIdObjectIDReference to the executed flow
statestringOne of: NEW, RUN, DONE, FAIL, SKIP, FILTERED, DEFERRED, WAIT, ON_HOLD
createdAtdatetimeWhen the play was created
startedAtdatetimeWhen execution began
completedAtdatetimeWhen execution finished (success)
failedAtdatetimeWhen execution failed
durationintTotal execution time in milliseconds
argsmapInput arguments passed when triggering
globalsmapGlobal variables available throughout the play
isTestboolWhether this is a test execution
testSuiteIdObjectIDReference to test suite (if test)
testCaseIdObjectIDReference to test case (if test)
baselinePlayIdObjectIDReference to the baseline play for comparison
testFixtureIdObjectIDReference to recorded fixture for replay
idempotencyRootstringKey for deduplicating repeated triggers
kvSnapshotmapSnapshot of KV store at start of play
channelIdObjectIDChannel that triggered this play (if via channel)

Play Layers (embedded in DBPlay)

Module execution records stored within each play document.

FieldTypeDescription
_idObjectIDPrimary key
playIdObjectIDParent play reference
layerIdObjectIDReference to the flowlet definition
indexintExecution order
statestringDONE, FAIL, SKIP, FILTERED, etc.
argsmapResolved arguments (after expression evaluation)
outmapModule output data
startedAtdatetimeStep start time
completedAtdatetimeStep completion time
failedAtdatetimeStep failure time
moduleVersionintModule version at time of execution

User & Access Domain

companies β€” DBCompany

Tenant/organization record. Fields: _id, name, createdAt.

company_users β€” DBCompanyUser

Many-to-many user-company association. Fields: userId, companyId, default (bool β€” which company is the user’s default).

user_groups β€” DBUserGroup

Named group of users within a company. Fields: _id, companyId, name, userIds (array of user ObjectIDs).

access β€” DBAccess

Fine-grained permission assignment.

FieldTypeDescription
entityIdObjectIDThe flow/group/channel being protected
companyIdObjectIDTenant context
assignedToUserIdObjectIDUser receiving the permission (or null)
assignedToGroupIdObjectIDGroup receiving the permission (or null)
typestringEntity type (flow, group, channel)
permissionsarrayList of permission names granted

Operations Domain

schedules β€” Schedule

FieldDescription
flowIdFlow to trigger
enabledWhether schedule is active
cronExprStandard cron expression (5 or 6 fields)
lastRunTimestamp of last successful trigger

retention_policies β€” DBRetentionPolicy

FieldDescription
typegeneral, flow, or group
targetflows.all, flows.filtered, or audit
flowId / groupIdScoped to specific flow/group (if type is not general)
retentionMinutesHow long to keep data (in minutes)
keepEntriesMax records to retain
enabledWhether policy is active

queue_jobs β€” QueueJob

Background job queue. Fields: type, relatedId, status, createdAt, updatedAt, extra.

Channel Domain

channels β€” DBChannel

FieldDescription
kindhttp, ws, or mcp
portAllocated port (from CHANNEL_PORT_RANGE)
authModepublic or header_token
authTokenToken for header_token auth mode
routesArray of DBChannelRoute
runtimeCurrent runtime state snapshot
enabledWhether channel is active

channel_routes β€” DBChannelRoute

FieldDescription
channelIdParent channel
httpMethodGET, POST, PUT, DELETE
pathURL path (e.g., /webhook/intake)
targetFlowIdsFlows triggered by this route
responderFlowIdFlow that produces the sync response
responseModesync or async
timeoutSecondsMax wait time for sync responses

Storage & Configuration Domain

kvs β€” DBKV

FieldDescription
companyIdTenant key
scopeTypeglobal, flow, or flow_group
scopeKeyID of the scoped entity
keyKV key name
valueEncrypted stored value
isMultilineDisplay hint for UI
updatedAtLast modification time

OAuth and API credentials. dataOAuth, dataBasic, dataBearer, dataServiceAccount fields are all encrypted.

component_configs β€” DBComponentConfig

FieldDescription
kindComponent type: storage, ai, db, request, console
implImplementation name (e.g., s3, openai, postgresql)
nameHuman-readable name
isDefaultWhether this is the default for its kind
settingsImplementation-specific config (JSON map)

system_config β€” DBSystemConfig

Single document per installation. Contains nested objects for: AI defaults, notification settings, retention overrides, execution configuration.

AI Domain

ai_chat β€” AiChat

AI conversation session wrapper. Fields: entityType, permanentEntityId, userId, status.

ai_chat_messages β€” AiChatMessage

Individual messages within an AI chat. Fields: chatId, userId, userFriendlyText, senderType.

ai_generation β€” AiGeneration

Records of AI-generated content (e.g., flow generation from a prompt). Fields: userId, userPrompt, type, aiResponse, error, status.

Testing Domain

flow_test_suites β€” DBFlowTestSuite

Groups test cases for a specific flow version. Fields: flowId, flowPermanentId, flowVersion, name.

flow_test_cases β€” DBFlowTestCase

Individual test case definition. Fields: suiteId, flowId, name, baselinePlayId, fixtureId, flowletInputsByRef, expectedOutByRef.

test_fixtures β€” DBTestFixture

Recorded component I/O for deterministic replay. Fields: flowId, baselinePlayId, events (array of call snapshots).

play_component_events β€” DBPlayComponentEvent

Individual component call log entry. Fields: playId, playLayerId, componentKind, operation, input, output, error, seq.