Architecture

    Database Schema

    Overview of all Prisma models and their relationships in the ProcessFlow database.

    Database Schema

    ProcessFlow uses a self-hosted PostgreSQL 17 database managed via Prisma. The schema is defined in prisma/schema.prisma and organised into four logical groups.


    Authentication (better-auth)

    These tables are managed by better-auth and should not be modified manually.

    TableKey FieldsNotes
    userid (uuid), email, username, language, isDarkModeEnabledPrimary user profile table
    sessionid, userId, token, expiresAtOne row per active browser session
    accountid, userId, providerId, passwordCredential storage
    verificationid, identifier, value, expiresAtEmail verification / password reset

    Teams & Roles

    TableKey FieldsNotes
    teamid (bigint), name, createdBy, colorSchemeTop-level workspace
    roleid, teamId, name, color, pages (JSONB)Per-team role with page access config
    profile_teamprofileId, teamIdUser ↔ Team membership
    profile_role_teamprofileId, roleId, teamIdUser ↔ Role assignment within a team
    invitationid, email, teamIdPending team invitations

    Process Engine

    TableKey FieldsNotes
    process_modelid, name, belongsTo (teamId)The BPMN diagram definition
    flow_elementid, type (NodeType), modelId, data (JSONB), executionUrlA single node in the diagram
    activity_elementflowElementId, nextFlowElementIdActivity node successor
    start_elementflowElementId, nextFlowElementIdStart node successor
    end_elementflowElementIdTerminal node
    gateway_elementflowElementId, nextFlowElementTrueId, nextFlowElementFalseIdExclusive gateway branches
    and_split_elementflowElementId, nextFlowElementId1/2Parallel split — two outgoing paths
    and_join_elementflowElementId, previousFlowElementId1/2, nextFlowElementIdParallel join — waits for both paths
    process_instanceid, processModelId, status, completedAtA running or completed process run
    flow_element_instanceid, instanceOf, isPartOf, status, completedByRuntime state of one node in one instance
    data_object_instanceisPartOf, name, value (JSONB)Key/value output data per process instance

    NodeType enum: startNode, endNode, activityNode, gatewayNode, andSplitNode, andJoinNode, challengeNode, infoNode, gamificationEventNode

    FlowElementInstanceStatus enum: CreatedTodo / In ProgressCompleted / Error


    Gamification & Shop

    TableKey FieldsNotes
    statisticsprofileId, teamId, experience, coins, badges (JSONB)Per-user, per-team gamification state
    node_definitionid, definition (JSONB), createdBy, teamId, visibilityReusable node definition for the shop
    teams_node_definitionsteamId, nodeDefinitionIdWhich teams have imported a node definition
    configkey, valueApplication-wide key/value configuration

    Relationships at a Glance

    User ──< ProfileTeam >── Team ──< ProcessModel ──< FlowElement ──< FlowElementInstance
                              │                                              │
                             Role                                     DataObjectInstance
    
                      ProfileRoleTeam
    
                           Statistics

    All primary keys for domain tables use BigInt (auto-increment) except user, session, account, and verification which use UUID strings (managed by better-auth).

    On this page

    Database Schema