Skip to main content

Overview

Tesslate Studio uses PostgreSQL with SQLAlchemy 2.x (async) as the ORM. The schema consists of 39+ models organized into functional domains. All models use UUID primary keys, timezone-aware timestamps, and cascade deletes for clean data removal. This reference covers every model, its key fields, and its relationships. If you are adding a new model or modifying the schema, read the Contributing Guide section on database migrations.

Common Patterns

Before diving into individual models, here are the patterns shared across the codebase.
from sqlalchemy.dialects.postgresql import UUID
import uuid

id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4, index=True)

Model Hierarchy

User (owner)
  +-> Projects (multiple)
  |   +-> Containers (frontend, backend, db)
  |   |   +-> ContainerConnections (networking)
  |   +-> BrowserPreviews (live preview windows)
  |   +-> ProjectFiles (code files)
  |   +-> ProjectAssets (images, fonts)
  |   +-> Chats (AI conversations)
  |   |   +-> Messages (user/assistant)
  |   |   +-> AgentCommandLog (audit trail)
  |   +-> ShellSessions (persistent terminals)
  |   +-> KanbanBoard (task management)
  |   +-> Deployments (external hosting)
  |   +-> ProjectNotes (rich text notes)
  +-> UserPurchasedAgents -> MarketplaceAgents
  +-> DeploymentCredentials
  +-> GitProviderCredentials
  +-> UserAPIKeys / UserCustomModels

Auth Models

Defined in orchestrator/app/models_auth.py.

User

The central identity model. Extends FastAPI-Users’ SQLAlchemyBaseUserTable with Tesslate-specific features.
FieldTypeDescription
idUUIDPrimary key
emailStringUnique, indexed
hashed_passwordStringbcrypt hashed
nameStringDisplay name
usernameStringUnique login identifier
slugStringURL-safe identifier
subscription_tierStringfree, basic, pro, ultra
stripe_customer_idStringStripe customer reference
bundled_creditsIntegerMonthly allowance (resets on billing date)
purchased_creditsIntegerNever expire
signup_bonus_creditsIntegerExpires after N days
daily_creditsIntegerFree tier daily allowance
theme_presetStringCurrent theme ID (default: “default-dark”)
chat_positionStringChat panel: “left”, “center”, “right”
disabled_modelsJSONModel IDs hidden from chat selector
two_fa_enabledBooleanWhether 2FA is active
avatar_urlStringProfile picture URL
referral_codeStringUnique referral code
Key relationships: projects, chats, purchased_agents, purchased_bases, api_keys, custom_models, deployment_credentials, oauth_accounts, access_tokens

OAuthAccount

Stores OAuth provider tokens (GitHub, Google). Managed by FastAPI-Users.

AccessToken

JWT access tokens for session management. Managed by FastAPI-Users.

EmailVerificationCode

Stores hashed 2FA codes and password reset tokens.
FieldTypeDescription
user_idUUIDFK to users (CASCADE)
code_hashStringargon2 hashed code (never plaintext)
purposeString”2fa_login” or “password_reset”
attemptsIntegerFailed verification attempts
max_attemptsIntegerDefault: 5
expires_atDateTimeCode expiration time
usedBooleanWhether code has been consumed

Core Models

Defined in orchestrator/app/models.py.

Project

Top-level organizational unit. Each project can contain multiple containers forming a monorepo architecture.
FieldTypeDescription
idUUIDPrimary key
nameStringDisplay name
slugStringURL-safe identifier (auto-generated with random suffix)
owner_idUUIDFK to users
descriptionStringProject description
has_git_repoBooleanWhether Git is initialized
git_remote_urlStringRemote repository URL
architecture_diagramStringMermaid diagram source
settingsJSONProject settings (preview_mode, etc.)
network_nameStringDocker network: tesslate-{slug}
environment_statusStringactive, hibernated, starting, stopping
last_activityDateTimeLast user interaction
hibernated_atDateTimeWhen project was hibernated
s3_archive_size_bytesIntegerSize of S3 archive
Key relationships: owner, containers, files, assets, browser_previews, chats, project_agents, kanban_board, notes, deployments, shell_sessions Environment status lifecycle:
active -> stopping -> hibernated
hibernated -> starting -> active

Container

Individual services within a project (frontend, backend, database).
FieldTypeDescription
idUUIDPrimary key
project_idUUIDFK to projects
base_idUUIDFK to marketplace_bases (NULL for custom)
nameStringDisplay name: “frontend”, “api”, “database”
directoryStringDirectory in monorepo: “packages/frontend”
container_nameStringDocker/K8s container name
portIntegerExposed port (host side)
internal_portIntegerPort the dev server listens on inside container
environment_varsJSONEnvironment variables
container_typeString”base” (user app) or “service” (infra)
service_slugStringFor services: “postgres”, “redis”, etc.
deployment_modeString”container” or “external”
external_endpointStringFor external: “https://xxx.supabase.co
statusStringstopped, starting, running, failed, connected
position_x / position_yFloatReact Flow canvas position
Key relationships: project, base, connections_from, connections_to
The effective_port property returns internal_port or port or 3000. Always use this instead of writing ad-hoc fallback chains.

ContainerConnection

Edges in the React Flow graph defining how containers communicate.
FieldTypeDescription
idUUIDPrimary key
project_idUUIDFK to projects
source_container_idUUIDSource container (arrow tail)
target_container_idUUIDTarget container (arrow head)
connector_typeStringenv_injection, http_api, database, cache, websocket, etc.
configJSONConnector-specific settings
labelStringOptional edge label

BrowserPreview

Live preview windows displayed on the React Flow canvas.
FieldTypeDescription
idUUIDPrimary key
project_idUUIDFK to projects
connected_container_idUUIDContainer being previewed (nullable)
position_x / position_yFloatCanvas position
current_pathStringCurrent URL path (default: ”/“)

ProjectFile

Database-backed file content storage for the Monaco editor.
FieldTypeDescription
idUUIDPrimary key
project_idUUIDFK to projects
file_pathStringRelative path: “src/App.tsx”
contentTextFile content

ProjectAsset

Tracks uploaded binary assets (images, fonts, videos).
FieldTypeDescription
idUUIDPrimary key
project_idUUIDFK to projects
filenameStringOriginal filename
directoryStringTarget directory: “/public/images”
file_typeStringimage, video, font, document, other
file_sizeIntegerSize in bytes
mime_typeStringMIME type: “image/png”
width / heightIntegerImage dimensions (images only)

ProjectSnapshot

EBS VolumeSnapshot records for project versioning and timeline.
FieldTypeDescription
idUUIDPrimary key
project_idUUIDFK to projects
snapshot_typeString”hibernation” or “manual”
statusStringpending, ready, restoring, deleted
labelStringUser-provided label

Chat Models

Chat

Conversation threads with AI agents.
FieldTypeDescription
idUUIDPrimary key
user_idUUIDFK to users
project_idUUIDFK to projects
created_atDateTimeWhen the chat started
Key relationships: messages (one-to-many)

Message

Individual messages in a chat (user or assistant).
FieldTypeDescription
idUUIDPrimary key
chat_idUUIDFK to chats
roleString”user” or “assistant”
contentTextMessage content
message_metadataJSONAgent execution steps, tool calls

AgentCommandLog

Audit log for shell commands executed by AI agents.
FieldTypeDescription
idUUIDPrimary key
user_idUUIDFK to users
project_idUUIDFK to projects
commandStringThe shell command
working_dirStringWorking directory
successBooleanWhether execution succeeded
exit_codeIntegerProcess exit code
stdout / stderrTextCommand output
risk_levelStringRisk assessment (“safe”, “moderate”, “high”)
duration_msIntegerExecution duration

ShellSession

Persistent terminal sessions for WebSocket connections.
FieldTypeDescription
idUUIDPrimary key
session_idStringUnique session identifier
project_idUUIDFK to projects
container_nameStringTarget container
statusStringactive, closed
bytes_read / bytes_writtenIntegerResource tracking

Marketplace Models

MarketplaceAgent

AI agents available for purchase or free use.
FieldTypeDescription
idUUIDPrimary key
nameStringAgent display name
slugStringURL-safe identifier
descriptionTextAgent description
system_promptTextLLM system prompt
toolsJSONList of enabled tool names
tool_configsJSONPer-tool configuration overrides
modelStringLLM model to use
pricing_typeStringfree, monthly, api, one_time
priceIntegerPrice in cents
is_forkableBooleanCan users fork this agent
parent_agent_idUUIDFK to self (for forks)
downloadsIntegerTotal download count
ratingFloatAverage rating (1-5)

MarketplaceBase

Project templates (React, FastAPI, Next.js, etc.).
FieldTypeDescription
idUUIDPrimary key
nameStringTemplate name
slugStringURL-safe identifier
git_repo_urlStringSource Git repository
categoryStringTemplate category
tech_stackJSONTechnologies used
pricing_typeStringfree or paid
created_by_user_idUUIDNULL for seeded, user UUID for user-submitted
visibilityString”private” or “public”

WorkflowTemplate

Pre-configured multi-container workflows.
FieldTypeDescription
idUUIDPrimary key
nameStringWorkflow name
template_definitionJSONContainer and connection definitions
required_credentialsJSONRequired deployment credentials

UserPurchasedAgent

Tracks agents in a user’s library.
FieldTypeDescription
user_idUUIDFK to users
agent_idUUIDFK to marketplace_agents
purchase_typeStringfree, purchased, subscription
is_activeBooleanWhether the license is active

ProjectAgent

Assigns agents to specific projects.
FieldTypeDescription
project_idUUIDFK to projects
agent_idUUIDFK to marketplace_agents
enabledBooleanWhether agent is active on this project

AgentReview / BaseReview

User reviews and ratings for agents and bases.
FieldTypeDescription
idUUIDPrimary key
user_idUUIDFK to users
agent_id or base_idUUIDFK to the reviewed item
ratingInteger1 to 5
commentTextReview text

AgentCoInstall

Recommendation system data (“People also installed”).
FieldTypeDescription
agent_idUUIDFK to marketplace_agents
related_agent_idUUIDFK to marketplace_agents
co_install_countIntegerNumber of co-installations

Deployment Models

Deployment

External deployment history and status.
FieldTypeDescription
idUUIDPrimary key
project_idUUIDFK to projects
providerStringvercel, netlify, cloudflare
deployment_urlStringLive deployment URL
statusStringdeploying, deployed, failed
errorTextError message if failed
deployment_metadataJSONProvider-specific metadata

DeploymentCredential

Encrypted OAuth tokens for deployment providers.
FieldTypeDescription
idUUIDPrimary key
user_idUUIDFK to users
project_idUUIDFK to projects (optional)
providerStringvercel, netlify, cloudflare, supabase
access_token_encryptedStringFernet-encrypted token
provider_metadataJSONProvider-specific metadata

GitProviderCredential

Unified Git provider OAuth credentials.
FieldTypeDescription
idUUIDPrimary key
user_idUUIDFK to users
providerStringgithub, gitlab, bitbucket
access_tokenStringEncrypted access token
provider_usernameStringUsername on the provider

Billing Models

MarketplaceTransaction

Revenue from agent purchases and usage.
FieldTypeDescription
idUUIDPrimary key
amount_totalIntegerTotal amount in cents
amount_creatorIntegerCreator’s share (90%)
amount_platformIntegerPlatform’s share (10%)
payout_statusStringpending, paid, failed

CreditPurchase

Credit package purchases.
FieldTypeDescription
idUUIDPrimary key
user_idUUIDFK to users
amount_centsIntegerPurchase amount
credits_amountIntegerCredits received
stripe_payment_intentStringStripe reference
statusStringpending, completed, failed

UsageLog

Token usage tracking for billing.
FieldTypeDescription
idUUIDPrimary key
user_idUUIDFK to users
modelStringLLM model used
tokens_inputIntegerInput tokens consumed
tokens_outputIntegerOutput tokens consumed
cost_totalIntegerTotal cost in cents

UserAPIKey

User API keys for BYOK (Bring Your Own Key) providers.
FieldTypeDescription
idUUIDPrimary key
user_idUUIDFK to users
providerStringopenrouter, openai, groq, z-ai, etc.
encrypted_valueStringEncrypted API key

UserCustomModel

User-added models under BYOK providers.
FieldTypeDescription
idUUIDPrimary key
user_idUUIDFK to users
model_idStringModel identifier
model_nameStringDisplay name
providerStringParent BYOK provider
pricing_input / pricing_outputFloatPer-token pricing

Kanban Models

Defined in orchestrator/app/models_kanban.py.

KanbanBoard

One board per project.
FieldTypeDescription
idUUIDPrimary key
project_idUUIDFK to projects
nameStringBoard name
settingsJSONBoard settings

KanbanColumn

Customizable columns (Backlog, To Do, In Progress, Done).
FieldTypeDescription
idUUIDPrimary key
board_idUUIDFK to kanban_boards
nameStringColumn name
positionIntegerSort order
is_backlogBooleanWhether this is the backlog column
is_completedBooleanWhether this is the done column
task_limitIntegerWIP limit (optional)

KanbanTask

Individual tasks with rich metadata.
FieldTypeDescription
idUUIDPrimary key
column_idUUIDFK to kanban_columns
titleStringTask title
descriptionTextTask description
priorityStringPriority level
task_typeStringTask category
assignee_idUUIDFK to users (optional)
due_dateDateTimeDue date (optional)
tagsJSONTag list

KanbanTaskComment

Collaboration comments on tasks.
FieldTypeDescription
idUUIDPrimary key
task_idUUIDFK to kanban_tasks
user_idUUIDFK to users
contentTextComment content

ProjectNote

Rich text notes using TipTap editor.
FieldTypeDescription
idUUIDPrimary key
project_idUUIDFK to projects
contentTextNote content
content_formatStringContent format identifier

Feedback Models

FeedbackPost

User bug reports and feature suggestions.
FieldTypeDescription
idUUIDPrimary key
user_idUUIDFK to users
typeStringbug or suggestion
titleStringPost title
statusStringCurrent status
upvote_countIntegerTotal upvotes

FeedbackUpvote / FeedbackComment

Upvotes (one per user per post) and comments on feedback posts.

Source Files

FileContents
orchestrator/app/models.pyMain models (39 classes)
orchestrator/app/models_auth.pyUser, OAuthAccount, AccessToken
orchestrator/app/models_kanban.pyKanbanBoard, KanbanColumn, KanbanTask, KanbanTaskComment, ProjectNote
orchestrator/app/schemas.pyPydantic request/response schemas
orchestrator/app/database.pyAsync SQLAlchemy engine and session setup
orchestrator/alembic/versions/Migration files