Skip to main content

MANTA Internal SQLite Database

For MANTA, the SQLite database serves as the backbone for user management, chat history, file storage, and various other core functionalities. Understanding this structure is essential for anyone looking to contribute to or maintain the project effectively.

Internal SQLite Location​

You can find the SQLite database at root -> data -> webui.db

πŸ“ Root (/)
β”œβ”€β”€ πŸ“ data
β”‚ β”œβ”€β”€ πŸ“ cache
β”‚ β”œβ”€β”€ πŸ“ uploads
β”‚ β”œβ”€β”€ πŸ“ vector_db
β”‚ └── πŸ“„ webui.db
β”œβ”€β”€ πŸ“„ dev.sh
β”œβ”€β”€ πŸ“ manta
β”œβ”€β”€ πŸ“„ requirements.txt
β”œβ”€β”€ πŸ“„ start.sh
└── πŸ“„ start_windows.bat

Copy Database Locally​

If you want to copy the MANTA SQLite database running in the container to your local machine, you can use:

docker cp manta:/app/backend/data/webui.db ./webui.db

Alternatively, you can access the database within the container using:

docker exec -it manta /bin/sh

Table Overview​

Here is a complete list of tables in MANTA's SQLite database. The tables are listed alphabetically and numbered for convenience.

No.Table NameDescription
01agreementStores stores metadata about legal documents
02authStores user authentication credentials and login information
03channelManages chat channels and their configurations
04chatStores chat sessions and their metadata
05configMaintains system-wide configuration settings
06feedbackCaptures user feedback and ratings
07fileManages uploaded files and their metadata
08folderOrganizes files and content into hierarchical structures
09functionStores custom functions and their configurations
10groupStores group definitions and permissions
11group_membershipStores which users belong to which groups
12invoiceStores billing records
13invoice_itemStores individual line items linked to an invoice
14knowledgeStores knowledge base entries and related information
15memoryMaintains chat history and context memory
16messageStores individual chat messages and their content
17message_reactionRecords user reactions (emojis/responses) to messages
18modelManages AI model configurations and settings
19model_catalogManages AI model metadata
20model_priceStores token pricing (input/output) and price validity period
21notification_templateStores notification templates
22promptStores templates and configurations for AI prompts
23subscriptionRepresents subscription metadata such as tier name, billing period, status
24subscription_priceDefines pricing information for subscription tiers.
25tagManages tags/labels for content categorization
26token_trackingRecords token usage metrics for monitoring and analytics.
27toolStores configurations for system tools and integrations
28userMaintains user profiles and account information
29user_agreementTracks which agreements a user has accepted
30user_payment_statusIndicates the current payment state of the user
31user_subscriptionRepresents the user’s active subscription plan

Note: there is additional table in MANTA's SQLite database that is not related to MANTA's core functionality, that have been excluded:

  • Alembic Version table

Now that we have all the tables, let's understand the structure of each table.

Agreement Table​

Column NameData TypeConstraintsDescription
idBigIntegerPRIMARY KEYUnique identifier
doc_typeTextNOT NULLSpecifies the document type
titleTextNOT NULLDocument title
descriptionText-Document description
versionTextNOT NULLDocument version
urlTextNOT NULLDocument url
created_atDateTimeNOT NULLCreation timestamp

Things to know about the auth table:

  • One-to-Many relationship with users-agreements table (shared id)
  • doc_type value must be one of ALLOWED_DOC_TYPES

Auth Table​

Column NameData TypeConstraintsDescription
idTextPRIMARY KEYUnique identifier
emailText-User's email
passwordText-Hashed password
activeBoolean-Account status

Things to know about the auth table:

  • Uses UUID for primary key
  • One-to-One relationship with users table (shared id)

Channel Table​

Column NameData TypeConstraintsDescription
idTextPRIMARY KEYUnique identifier (UUID)
user_idText-Owner/creator of channel
typeTextnullableChannel type
nameText-Channel name
descriptionTextnullableChannel description
dataJSONnullableFlexible data storage
metaJSONnullableChannel metadata
access_controlJSONnullablePermission settings
created_atBigInteger-Creation timestamp (nanoseconds)
updated_atBigInteger-Last update timestamp (nanoseconds)

Things to know about the auth table:

  • Uses UUID for primary key
  • Case-insensitive channel names (stored lowercase)

Chat Table​

Column NameData TypeConstraintsDescription
idTextPRIMARY KEYUnique identifier (UUID)
user_idText-Owner of the chat
titleText-Chat title
chatJSON-Chat content and history
created_atBigInteger-Creation timestamp
updated_atBigInteger-Last update timestamp
share_idTextUNIQUE, nullableSharing identifier
archivedBooleandefault=FalseArchive status
pinnedBooleandefault=False, nullablePin status
metaJSONserver_default=""Metadata including tags
folder_idTextnullableParent folder ID

Config​

Column NameData TypeConstraintsDefaultDescription
idINTEGERNOT NULL-Primary key identifier
dataJSONNOT NULL-Configuration data
versionINTEGERNOT NULL-Config version number
created_atDATETIMENOT NULLCURRENT_TIMESTAMPCreation timestamp
updated_atDATETIME-CURRENT_TIMESTAMPLast update timestamp

Feedback Table​

Column NameData TypeConstraintsDescription
idTextPRIMARY KEYUnique identifier (UUID)
user_idText-User who provided feedback
versionBigIntegerdefault=0Feedback version number
typeText-Type of feedback
dataJSONnullableFeedback data including ratings
metaJSONnullableMetadata (arena, chat_id, etc)
snapshotJSONnullableAssociated chat snapshot
created_atBigInteger-Creation timestamp
updated_atBigInteger-Last update timestamp

File Table​

Column NameData TypeConstraintsDescription
idTextPRIMARY KEYUnique identifier
user_idText-Owner of the file
hashTextnullableFile hash/checksum
filenameText-Name of the file
pathTextnullableFile system path
dataJSONnullableFile-related data
metaJSONnullableFile metadata
access_controlJSONnullablePermission settings
created_atBigInteger-Creation timestamp
updated_atBigInteger-Last update timestamp

The meta field's expected structure:

{
"name": text, # Optional display name
"content_type": text, # MIME type
"size": integer, # File size in bytes
# Additional metadata supported via ConfigDict(extra="allow")
}

Folder Table​

Column NameData TypeConstraintsDescription
idTextPRIMARY KEYUnique identifier (UUID)
parent_idTextnullableParent folder ID for hierarchy
user_idText-Owner of the folder
nameText-Folder name
itemsJSONnullableFolder contents
metaJSONnullableFolder metadata
is_expandedBooleandefault=FalseUI expansion state
created_atBigInteger-Creation timestamp
updated_atBigInteger-Last update timestamp

Things to know about the folder table:

  • Folders can be nested (parent_id reference)
  • Root folders have null parent_id
  • Folder names must be unique within same parent

Function Table​

Column NameData TypeConstraintsDescription
idTextPRIMARY KEYUnique identifier
user_idText-Owner of the function
nameText-Function name
typeText-Function type
contentText-Function content/code
metaJSON-Function metadata
valvesJSON-Function control settings
is_activeBoolean-Function active status
is_globalBoolean-Global availability flag
created_atBigInteger-Creation timestamp
updated_atBigInteger-Last update timestamp

Things to know about the folder table:

  • type can only be: ["filter", "action"]

Group Table​

Column NameData TypeConstraintsDescription
idTextPRIMARY KEY, UNIQUEUnique identifier (UUID)
user_idText-Group owner/creator
nameText-Group name
descriptionText-Group description
dataJSONnullableAdditional group data
metaJSONnullableGroup metadata
permissionsJSONnullablePermission configuration
created_atBigInteger-Creation timestamp
updated_atBigInteger-Last update timestamp

Group Membership​

Column NameData TypeConstraintsDescription
idTextPRIMARY KEY, UNIQUEUnique identifier (UUID)
group_idTextFOREIGN KEY - group.idGroup identifier
user_idTextFOREIGN KEY - user.idUser identifier
added_atBigInteger-User join timestamp

Invoice​

Column NameData TypeConstraintsDescription
idTextPRIMARY KEY, UNIQUEUnique identifier (UUID)
user_idText-User identifier
customer_idText-Third-party payment platform customer ID
invoice_idText-Third-party payment platform invoice ID
period_startBigInteger-Billing period start timestamp
invoice_issue_dateBigInteger-Invoice issuance timestamp
created_atBigInteger-Creation timestamp
statusTextNOT NULLInvoice status
invoice_numberText-User-friendly invoice reference number
invoice_urlText-URL to download invoice
total_amountNumeric(20,12)-Total invoice amount
typeTextNOT NULLInvoice type

Things to know about the invoice table:

  • One-to-Many relationship with invoice-items table (shared id)
  • type value must be one of INVOICE_TYPE (e.g., token or subscription billing)

Invoice Item​

Column NameData TypeConstraintsDescription
idTextPRIMARY KEY, UNIQUEUnique identifier (UUID)
invoice_idTextFOREIGN KEY - invoice.idInvoice identifier
amountNumeric(20,12)NOT NULLInvoice item amount
dataJSONNOT NULLStores billing-specific metadata

Things to know about the invoice item table:

  • The data field stores billing-specific metadata and follows structures such as SubscriptionData or PerTokenData.

Knowledge Table​

Column NameData TypeConstraintsDescription
idTextPRIMARY KEY, UNIQUEUnique identifier (UUID)
user_idText-Knowledge base owner
nameText-Knowledge base name
descriptionText-Knowledge base description
dataJSONnullableKnowledge base content
metaJSONnullableAdditional metadata
access_controlJSONnullableAccess control rules
created_atBigInteger-Creation timestamp
updated_atBigInteger-Last update timestamp

The access_control fields expected structure:

{
"read": {
"group_ids": ["group_id1", "group_id2"],
"user_ids": ["user_id1", "user_id2"]
},
"write": {
"group_ids": ["group_id1", "group_id2"],
"user_ids": ["user_id1", "user_id2"]
}
}

Memory Table​

Column NameData TypeConstraintsDescription
idTextPRIMARY KEYUnique identifier (UUID)
user_idText-Memory owner
contentText-Memory content
created_atBigInteger-Creation timestamp
updated_atBigInteger-Last update timestamp

Message Table​

Column NameData TypeConstraintsDescription
idTextPRIMARY KEYUnique identifier (UUID)
user_idText-Message author
channel_idTextnullableAssociated channel
parent_idTextnullableParent message for threads
contentText-Message content
dataJSONnullableAdditional message data
metaJSONnullableMessage metadata
created_atBigInteger-Creation timestamp (nanoseconds)
updated_atBigInteger-Last update timestamp (nanoseconds)

Message Reaction Table​

Column NameData TypeConstraintsDescription
idTextPRIMARY KEYUnique identifier (UUID)
user_idText-User who reacted
message_idText-Associated message
nameText-Reaction name/emoji
created_atBigInteger-Reaction timestamp

Model Table​

Column NameData TypeConstraintsDescription
idTextPRIMARY KEYModel identifier
user_idText-Model owner
base_model_idTextnullableParent model reference
nameText-Display name
paramsJSON-Model parameters
metaJSON-Model metadata
access_controlJSONnullableAccess permissions
is_activeBooleandefault=TrueActive status
created_atBigInteger-Creation timestamp
updated_atBigInteger-Last update timestamp

Things to know about the model table:

  • One-to-One relationship with model catalog table (shared id)

Model Catalog​

Column NameData TypeConstraintsDescription
idIntegerPRIMARY KEYModel catalog identifier
model_idTextFOREIGN KEY - model.idModel identifier
detailsText-Model details
token_limit_per_minuteInteger-Maximum allowed tokens per minute
model_urlText-URL pointing to the model resource
token_trackingJSON-Configuration for token usage tracking
is_featuredBooleanNOT NULL, default=FalseFeatured model on homepage

Model Price​

Column NameData TypeConstraintsDescription
idTextPRIMARY KEYModel price identifier
model_idTextFOREIGN KEY - model.idModel identifier
typeTextToken type (input/output)
valid_fromBigInteger-Price validity start timestamp
valid_thruBigInteger-Price validity end timestamp
created_byTextFOREIGN KEY - user.idPrice creator
created_atBigInteger-Creation timestamp
updated_atBigInteger-Last update timestamp
unit_amountNumeric(20,12)-Model price per unit

Notification Template​

Column NameData TypeConstraintsDescription
idTextPRIMARY KEYTemplate identifier
typeTextNOT NULLTemplate type
contentBigIntegerNOT NULLTemplate content
created_byTextFOREIGN KEY - user.id, NOT NULLTemplate creator
created_atBigIntegerNOT NULLCreation timestamp
updated_atBigInteger-Last update timestamp
updated_byTextFOREIGN KEY - user.idLast modifier

Subscription​

Column NameData TypeConstraintsDescription
idTextPRIMARY KEYSubscription identifier
tier_nameTextNOT NULLSubscription Tier name
descriptionText-Tier description
billing_periodTextNOT NULLBilling period (e.g., monthly or annual)
statusTextNOT NULLSubscription status
created_byTextFOREIGN KEY - user.idSubscription creator
created_atBigIntegerNOT NULLCreation timestamp
updated_atBigIntegerNOT NULLLast update timestamp
updated_byTextFOREIGN KEY - user.idLast modifier

Subscription Price​

Column NameData TypeConstraintsDescription
idTextPRIMARY KEYSubscription price identifier
subscription_idTextFOREIGN KEY - subscription.idSubscription identifier
priceNumeric(20,12)NOT NULLTier price
included_creditsNumeric(20,12)NOT NULLIncluded credits for subscription
valid_fromTextNOT NULLPrice validity start date
valid_thruText-Price validity end date
created_byTextFOREIGN KEY - user.idPrice creator
created_atBigIntegerNOT NULLCreation timestamp
updated_atBigIntegerNOT NULLLast update timestamp
updated_byTextFOREIGN KEY - user.idLast modifier

Prompt Table​

Column NameData TypeConstraintsDescription
commandTextPRIMARY KEYUnique command identifier
user_idText-Prompt owner
titleText-Prompt title
contentText-Prompt content/template
timestampBigInteger-Last update timestamp
access_controlJSONnullableAccess permissions

Tag Table​

Column NameData TypeConstraintsDescription
idTextPK (composite)Normalized tag identifier
nameText-Display name
user_idTextPK (composite)Tag owner
metaJSONnullableTag metadata

Things to know about the tag table:

  • Primary key is composite (id, user_id)

Token Tracking​

Column NameData TypeConstraintsDescription
idBigIntegerPRIMARY KEYToken tracking identifier
user_idText-User identifier
timestampBigInteger-Usage recording timestamp
prompt_tokensBigInteger-Number of prompt tokens used
completion_tokensBigInteger-Number of completion tokens used
total_tokensBigInteger-Total tokens consumed
model_catalog_idIntegerFOREIGN KEY - model_catalog.idModel catalog reference
prompt_token_priceNumeric(20,12)-Price per prompt token
completion_token_priceNumeric(20,12)-Price per completion token
billing_typeTextNOT NULLBilling mode (e.g., subscription or per-token)

Tool Table​

Column NameData TypeConstraintsDescription
idTextPRIMARY KEYUnique identifier
user_idText-Tool owner
nameText-Tool name
contentText-Tool content/code
specsJSON-Tool specifications
metaJSON-Tool metadata
valvesJSON-Tool control settings
access_controlJSONnullableAccess permissions
created_atBigInteger-Creation timestamp
updated_atBigInteger-Last update timestamp

User Table​

Column NameData TypeConstraintsDescription
idTextPRIMARY KEYUnique identifier
nameText-User's name
emailText-User's email
roleText-User's role
profile_image_urlText-Profile image path
last_active_atBigInteger-Last activity timestamp
updated_atBigInteger-Last update timestamp
created_atBigInteger-Creation timestamp
api_keyTextUNIQUE, nullableAPI authentication key
settingsJSONnullableUser preferences
infoJSONnullableAdditional user info
oauth_subTextUNIQUEOAuth subject identifier

User Agreement​

Column NameData TypeConstraintsDescription
idBigIntegerPRIMARY KEYUnique identifier
user_idTextFOREIGN KEY - user.idUser identifier
doc_typeTextNOT NULLDocument type
agreement_idBigIntegerFOREIGN KEY - agreement.idAgreement document identifier
accepted_atDateTimeNOT NULLAgreement acceptance timestamp

User Payment Status​

Column NameData TypeConstraintsDescription
idBigIntegerPRIMARY KEYUnique identifier
user_idTextFOREIGN KEY - user.idUser identifier
statusText-User payment status

User Subscription​

Column NameData TypeConstraintsDescription
idTextPRIMARY KEYUnique identifier
user_idTextFOREIGN KEY - user.idUser identifier
subscription_idTextFOREIGN KEY - subscription.idSubscription identifier
statusTextNOT NULLUser subscription status
credits_remainingNumeric(20,12)NOT NULLRemaining user credits
base_creditsNumeric(20,12)NOT NULLBase credit allocation
start_dateBigIntegerNOT NULLSubscription start timestamp
end_dateBigIntegerNOT NULLSubscription end timestamp
created_atBigIntegerNOT NULLCreation timestamp
failed_renewal_attemptsBigIntegerNOT NULLFailed renewal attempts count

Entity Relationship Diagram

To help visualize the relationship between the tables, refer to the below Entity Relationship Diagram (ERD) generated with Mermaid.