Schema Boundaries
SMTA uses five PostgreSQL schemas to enforce security boundaries and separate concerns. Direct table access from the public schema is removed — all activity is routed through public.* functions.
core Schema
Section titled “core Schema”The heart of SMTA. Contains:
core.organizations— top-level tenantscore.organizations_meta— extended metadata for organizationscore.units— sub-groups within organizationscore.unit_meta— extended metadata for unitscore.memberships— links users to organizations with rolescore.unit_memberships— links users to units with rolescore.roles— named roles scoped per organizationcore.invitations— pending invitations to join an organizationcore.audit_logs— immutable record of data changescore.organization_files— file metadata scoped to organizationscore.users_meta— extended profile data for authenticated users
RLS is enabled on all core tables. Policies use core.get_current_user_id() to determine the authenticated user.
platform Schema
Section titled “platform Schema”Service-role-only tables for SaaS-wide management. Application code cannot read or write platform tables — only database service roles (your backend, not your end users) can access them.
Contains:
platform.billing_customers— links organizations to payment processor customer recordsplatform.billing_subscriptions— active subscription records per organizationplatform.subscription_products— billable products synced from the payment processorplatform.platform_subscription_overrides— admin-applied subscription overridesplatform.platform_organizations— SaaS-wide organization registry for admin useplatform.platform_users— SaaS-wide user registry for admin useplatform.platform_roles— global role definitionsplatform.platform_feature_flags— org-level feature flag overridesplatform.platform_settings— global SaaS configuration settingsplatform.platform_action_logs— admin action audit trailplatform.platform_system_events— system-level event logplatform.tenant_secrets— per-tenant secret references (vault IDs)
utils Schema
Section titled “utils Schema”Shared utility functions used across all schemas. Contains helpers for soft deletion, timestamp management, and audit log insertion. Not called directly by client code.
public Schema
Section titled “public Schema”The RPC interface. Contains only functions — no tables. These are the only entry points for client code. In Supabase, PostgREST exposes them automatically as REST endpoints. In Payload, you call them via your database client.
See the Public RPC Reference for all available functions.
app Schema
Section titled “app Schema”Created by SMTA but not populated — this is your domain. You define your application tables here and write RLS policies that reference core tables and call core.get_current_user_id(). SMTA’s RLS enforcement cascades into your app schema through the session context.