Skip to main content

Documentation Index

Fetch the complete documentation index at: https://formbricks.com/docs/llms.txt

Use this file to discover all available pages before exploring further.

Formbricks uses PostgreSQL as its primary database and Prisma as the Object-Relational Mapping (ORM) tool. The database schema is designed to support multi-tenancy, survey management, and response collection while maintaining data isolation between organizations.

Entity Relationship Diagram

The following diagram shows the core entities and their relationships in the Formbricks database:

Core Models

Organization & Workspace Management

  1. Organization
    • Top-level entity for multi-tenancy
    • Contains multiple Workspaces and team members
    • Manages billing and whitelabel settings
  2. Workspace
    • Main grouping mechanism for surveys and related configuration
    • Belongs to a single organization
    • Controls branding and display settings
  3. WorkspaceTeam
    • Maps teams to Workspaces
    • Controls Workspace-level access permissions
    • Enables scoped collaboration across teams

Survey Management

  1. Survey
    • Central model for questionnaires
    • Configurable with multiple questions and display rules
    • Supports multiple languages and targeting filters
  2. Response
    • Records user answers to surveys
    • Links to contact information when available
    • Supports tagging for analysis
  3. ActionClass
    • Defines triggering points for surveys
    • Can be code-based or no-code configurations
    • Links surveys to specific user actions

User Management

  1. User
    • Represents system users (admins/team members)
    • Manages authentication and preferences
    • Can belong to multiple organizations
  2. Contact
    • Represents survey respondents
    • Stores attributes for targeting
    • Tracks survey displays and responses
  3. Team
    • Groups users within organizations
    • Controls Workspace access permissions
    • Facilitates collaborative survey management

Data Isolation

The database schema ensures proper data isolation through:
  1. Organization-level isolation
    • Each organization has its own Workspaces
    • Users can belong to multiple organizations
    • Resources are scoped to organizations
  2. Workspace-level isolation
    • Independent surveys, contacts, action classes, and integrations
    • Isolated API key Workspace assignments
    • Workspace-specific configuration and styling defaults
  3. Team-based access isolation
    • Teams are linked to Workspaces through WorkspaceTeam
    • Permissions are scoped per Workspace
    • Access can be delegated without exposing all organization resources

Schema Management

The database schema is managed through Prisma, which provides:
  • Type-safe database client
  • Automatic migration generation
  • Schema versioning
  • Data validation
  • Query optimization
For detailed information about specific models and their properties, refer to the schema.prisma file in the repository.

PostgreSQL Database Tables

Formbricks stores all data in PostgreSQL tables. Here’s a comprehensive list of all database tables and their purposes:
Table NameDescription
AccountStores third-party authentication accounts (OAuth) and their tokens
ActionClassDefines triggerable events that can launch surveys
ApiKeyStores API authentication keys for organization-level access
ApiKeyWorkspaceMaps API keys to the Workspaces they can access
ContactRecords information about user that can receive and respond to surveys
ContactAttributeStores attribute values for contacts (e.g., role, company size)
ContactAttributeKeyDefines available attribute types for contacts
DataMigrationTracks the status of database schema migrations
DisplayRecords when and to whom surveys were shown
WorkspaceMain container for surveys, contacts, actions, integrations, and settings
IntegrationStores configuration for third-party service integrations
InviteManages pending invitations to join organizations
LanguageDefines supported languages for multi-lingual surveys
MembershipLinks users to organizations with specific roles
OrganizationTop-level container for Workspaces and team management
ResponseStores survey responses and associated metadata
SegmentDefines groups of contacts based on attributes
SurveyStores survey configurations, questions, and display rules
SurveyAttributeFilterDefines targeting rules for surveys based on contact attributes
SurveyFollowUpConfigures automated actions based on survey responses
SurveyLanguageLinks surveys to their supported languages
SurveyTriggerConnects surveys to their triggering actions
TagStores labels for categorizing responses
TagsOnResponsesJunction table linking tags to responses
TeamGroups users within organizations
TeamUserLinks users to teams with specific roles
WorkspaceTeamManages team access permissions to Workspaces
UserStores user account information and preferences
WebhookManages webhook endpoints for event notifications

Schema Reference

For detailed information about the database schema, including:
  • Complete field definitions
  • Relationships between tables
  • Enums and custom types
  • Field constraints and indices
  • JSON field structures
Please refer to the Prisma schema file in our GitHub repository. The schema.prisma file contains extensive documentation comments for each model, making it the authoritative reference for the database structure.