All manuals

Data model

The main tables and how they relate.

The database is Postgres (Supabase). Every operational table carries a tenant_id and is protected by row-level security.

TablePurpose
tenantsA workspace: company name, custom_email_sender, inbound_routing_id / routing_slug, ai_enabled, feature flags, billing formula.
profilesA user: role (agent, manager, admin, super_admin), full_name, job_title, phone, signature, personal inbound_email.
clientsCustomers: company name, contact person, email_id, phone, billing address, source_ref.
quotationsA quote: qn_number, status, client_id, created_by_email, dates, follow_up_due_date, last_contact_date, custom_metadata (form values, agent conversation, source email).
quotation_itemsLine items: code, name, quantity, unit, rate, display order.
status_logsAudit trail of status changes and system events per quote.
inbound_emailsEvery received message: sender, subject, text/html body, read/starred/deleted flags, thread id.
email_threadsThe triage state of a quote's conversation: triage_status (incoming / outgoing), ai_draft_text, assigned agent.
thread_statesPer-thread flags such as auto-pilot.
sent_emailsLog of outbound email, used for usage metering.
master_data_entriesCatalogue keys (columns), their parent key, and an AI description.
master_data_valuesCatalogue values; parent_value_id links a child value to its parent value.
tenant_schemasPer-workspace configuration JSON: the quote form blueprint, AI settings, follow-up agents.
tenant_token_usageAI token usage per tenant, user and feature.
usage_metricsMonthly quotes, emails and tokens, for billing.

Quote numbers

QN-YYYY-NNN, where NNN is one more than the highest existing number in the workspace. Revisions use a -Rev-N suffix.

Email routing columns

profiles.inbound_email (personal address) takes priority over tenants.inbound_routing_id and tenants.routing_slug (workspace addresses) when a message arrives.

Esc

Type to search page titles, headings and text.