Skip to main content

Database Architecture

The platform uses PostgreSQL as the primary database. Four separate databases serve different service groups. Redis is used for caching and sessions.

Document Database

Shared by: document-service, parser-service, embedding-service, rag-service

Default name: document_service (configurable via PG_NAME env var per service). This database stores all document-related data including parsed content, vector embeddings, and processing job state.

documents

ColumnTypeDescription
idUUID (PK)Document identifier
userIdUUIDUploader
statusENUMPENDING_UPLOAD, UPLOADED, PROCESSING, PROCESSED, FAILED
fileNameVARCHAROriginal file name
fileSizeBIGINTSize in bytes
storagePathVARCHARPath in blob storage
storageTypeVARCHARazure_blob or s3
contentTypeVARCHARMIME type
metadataJSONBCustom metadata
folderIdUUID (FK)Parent folder
parsingTechniqueIdUUIDSelected parsing method
createdAtTIMESTAMPTZ--
updatedAtTIMESTAMPTZ--
deletedAtTIMESTAMPTZSoft delete

chunks

ColumnTypeDescription
idUUID (PK)Chunk identifier
documentIdUUID (FK)Parent document
chunkIndexINTPosition in document
contentTEXTRaw chunk text
translatedContentTEXTEnglish translation (if applicable)
contentHashVARCHARDeduplication hash
contentTypeENUMtext, heading, table, code, list
pageNumberINTSource page
charCountINTCharacter count
wordCountINTWord count
metadataJSONBExtra data
createdAtTIMESTAMPTZ--

embeddings

ColumnTypeDescription
idUUID (PK)Embedding identifier
chunkIdUUID (FK)Parent chunk
documentIdUUID (FK)Parent document
embeddingVECTOR(1024)pgvector embedding
modelNameVARCHARModel used for generation
createdAtTIMESTAMPTZ--

HNSW index on the embedding column for fast cosine similarity search.

folders

ColumnTypeDescription
idUUID (PK)Folder identifier
folderNameVARCHARDisplay name
parentIdUUID (FK)Parent folder (self-referencing)
folderTypeENUMdocument, agent, default
userIdUUIDOwner

parsing_techniques

ColumnTypeDescription
idUUID (PK)Technique identifier
nameVARCHARDisplay name
descriptionTEXTDescription
iconVARCHARIcon reference
categoryVARCHARGrouping
isEnabledBOOLEANActive flag

parsing_jobs (parser-service)

ColumnTypeDescription
idUUID (PK)Job identifier
statusENUMqueued, processing, completed, failed
fileNameVARCHARFile being parsed
documentIdUUIDLinked document
userIdUUIDRequesting user
parserMethodVARCHARParser backend used
resultDataJSONBParsed output
errorMessageTEXTFailure details
idempotencyKeyVARCHARPrevents duplicate jobs

llm-core DB

Owned by: llm-core only

conversations

ColumnTypeDescription
idUUID (PK)Conversation identifier
userIdUUIDOwner
titleVARCHARConversation title
metadataJSONBCustom data
createdAtTIMESTAMPTZ--
updatedAtTIMESTAMPTZ--
deletedAtTIMESTAMPTZSoft delete

messages

ColumnTypeDescription
idUUID (PK)Message identifier
conversationIdUUID (FK)Parent conversation
roleENUMuser, assistant, system, tool
createdAtTIMESTAMPTZ--

message_contents

Stores the actual content blocks of a message (text, tool calls, tool results).

agents

ColumnTypeDescription
idUUID (PK)Agent identifier
userIdUUIDCreator
nameVARCHARAgent name
typeENUMsimple, cortex, workflow, system, organization
instructionsTEXTSystem prompt
modelVARCHARDefault model
settingsJSONBAgent-specific config
folderIdUUID (FK)Parent folder

models

Core model definitions (GPT-4, Claude, Gemini, etc.) with capabilities and configuration.

providers

LLM provider configurations (OpenAI, Azure, Anthropic, Google, Mistral, Jamba, Ollama, vLLM, Remote).

models_providers (junction)

Maps which models are available from which providers, with provider-specific configuration.

canvases / canvas_versions

Interactive editable content areas within conversations, with version history.

templates

Predefined prompt templates with categories and configuration.

model_transactions

ColumnTypeDescription
idUUID (PK)Transaction identifier
modelVARCHARModel used
providerVARCHARProvider used
inputTokensINTTokens in prompt
outputTokensINTTokens in response
userIdUUIDRequesting user
createdAtTIMESTAMPTZ--

conversions

Text transformation records (grammar correction, translation, summarization).


admin-base DB

Owned by: admin-base-ms only

organizations

ColumnTypeDescription
idUUID (PK)Organization identifier
nameVARCHAROrganization name
externalIdVARCHARExternal system ID
isActiveBOOLEANActive flag

roles

ColumnTypeDescription
idUUID (PK)Role identifier
nameVARCHARRole name
organizationIdUUID (FK)Parent organization
parentIdUUID (FK)Parent role (hierarchy)
levelINTRole hierarchy level
isSuperAdminBOOLEANSuper admin flag
isSystemRoleBOOLEANSystem-defined role
applicationTypeVARCHARApplication scope

permissions

Links actions to modules and features. Supports conditions and inverted permissions.

role_permissions (junction)

Maps roles to permissions (many-to-many).

Organization configuration tables

Each table stores per-organization settings for a specific resource type:

TableWhat it configures
organization_settingsGeneral settings (name, help center, default role)
organization_languagesAvailable languages per org
organization_modelsAvailable AI models per org
organization_agentsAvailable agents per org
organization_connectorsAvailable connectors per org
organization_templatesAvailable templates per org
organization_workflowsAvailable workflows per org
organization_parsingAvailable parsing techniques per org

user-base DB

Owned by: user-base-ms only

users

ColumnTypeDescription
idUUID (PK)User identifier
emailVARCHAR(255)Unique email
usernameVARCHAR(50)Unique username
firstNameVARCHAR(100)First name
lastNameVARCHAR(100)Last name
avatarUrlVARCHAR(500)Profile image URL
metadataJSONBCustom data
zitadelUserIdVARCHAR(255)External IdP user ID
organizationIdUUIDLinked organization
isOwnerBOOLEANOrganization owner flag
preferredLanguageVARCHAR(10)FK to languages.code
createdAtTIMESTAMPTZ--
updatedAtTIMESTAMPTZ--
deletedAtTIMESTAMPTZSoft delete

Check constraint: owners have no organizationId, non-owners must have one.

Preference tables

TablePurpose
tagsUser-defined tags with color and target type
tag_entitiesLinks tags to target entities (conversations, documents, agents)
favoritesUser favorites by target type/ID
pinsPinned items by target type/ID
searchesSearch history with deduplication
activity_logsUser activity tracking with hide support

Sharing tables

TablePurpose
featuresShareable resources (conversation, source/folder/document, agent)
feature_sharesGrants access to a feature for a subject (user/group) with a role
feature_link_settingsLink sharing configuration (access level, role, expiry, allowed users)
feature_locksEditing locks with TTL (default 5 min)

Reference tables

TablePurpose
user_rolesMaps users to roles from admin-base-ms
integration_toolsExternal tool configurations (key, name, base URL, enabled)
langflow_usersLangflow account credentials per user
connectorsAvailable connectors (provider, type, config schema)
languagesLanguage catalog (code + display name)

Redis

ServiceKey PatternPurposeTTL
auth-servicezitadel/{provider}/{orgId}/{userId}ZITADEL sessionsConfigurable
llm-coreVariousConversation search cache, Langflow flow cacheConfigurable