Installation
Prerequisites
Section titled “Prerequisites”- A PostgreSQL database (version 14 or later)
psqlor another SQL client to apply the script- Node.js 18+ (to run the deployment CLI)
- One of: a Supabase project, a Payload CMS project, or a better-auth project with a PostgreSQL connection
Generate the Deployment Script
Section titled “Generate the Deployment Script”Use the SMTA CLI to generate a combined SQL script for your chosen adapter:
# For Supabasenpx @smta/cli --adapter supabase # [--enable-graphql] Optional flag to keep GraphQL enabled# → SMTA-supabase-<timestamp>.sql (63 SQL files combined)
# For Payload CMSnpx @smta/cli --adapter payload# → SMTA-payload-<timestamp>.sql (60 SQL files combined)
# For better-auth — --better-auth-ids is REQUIRED (uuid | mapped); see the better-auth adapter pagenpx @smta/cli --adapter better-auth --better-auth-ids uuid# → SMTA-better-auth-<timestamp>.sql (61 SQL files combined)The script is written to your current directory. All scripts deploy the full SMTA feature set — the only difference is the auth implementation. @smta/core is adapter-agnostic and loads on stock PostgreSQL 18; the Supabase adapter additionally maps its GoTrue roles onto SMTA’s neutral app_user/app_admin roles and restores its auth.users foreign keys.
Apply to Your Database
Section titled “Apply to Your Database”Apply the generated script to your PostgreSQL database:
psql -h YOUR_HOST -U YOUR_USER -d YOUR_DATABASE -f SMTA-supabase-<timestamp>.sqlFor Supabase, you can paste the contents directly into the Supabase SQL Editor.
TypeScript Packages
Section titled “TypeScript Packages”If your application uses TypeScript, install the companion packages for type-safe access to SMTA’s RPC contracts and billing interface:
# Zod v4 schemas for all public.* RPC function inputs and outputsnpm install @smta/schemas
# BillingProvider interface with Stripe and Lemon Squeezy implementationsnpm install @smta/billingAfter Deployment
Section titled “After Deployment”SMTA creates the following schemas in your database:
app— your application tables (placeholder for your domain tables)core— identity, access, memberships, roles, auditplatform— SaaS-wide management, billing, overrides (service role only)utils— shared utility functionspublic— callable SQL functions (RPC interface)
Your application tables go in the app schema. SMTA creates this schema but does not define any tables in it — you define those to match your domain.
Next Steps
Section titled “Next Steps”Follow the Quick Start guide for your adapter: