Skip to content

Installation

  • A PostgreSQL database (version 14 or later)
  • psql or 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

Use the SMTA CLI to generate a combined SQL script for your chosen adapter:

Terminal window
# For Supabase
npx @smta/cli --adapter supabase # [--enable-graphql] Optional flag to keep GraphQL enabled
# → SMTA-supabase-<timestamp>.sql (63 SQL files combined)
# For Payload CMS
npx @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 page
npx @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 the generated script to your PostgreSQL database:

Terminal window
psql -h YOUR_HOST -U YOUR_USER -d YOUR_DATABASE -f SMTA-supabase-<timestamp>.sql

For Supabase, you can paste the contents directly into the Supabase SQL Editor.

If your application uses TypeScript, install the companion packages for type-safe access to SMTA’s RPC contracts and billing interface:

Terminal window
# Zod v4 schemas for all public.* RPC function inputs and outputs
npm install @smta/schemas
# BillingProvider interface with Stripe and Lemon Squeezy implementations
npm install @smta/billing

SMTA creates the following schemas in your database:

  • app — your application tables (placeholder for your domain tables)
  • core — identity, access, memberships, roles, audit
  • platform — SaaS-wide management, billing, overrides (service role only)
  • utils — shared utility functions
  • public — 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.

Follow the Quick Start guide for your adapter: