@smta/core
v0.4.0
Published
SMTA core PostgreSQL schema — tenant isolation via RLS, tables, and functions
Downloads
541
Readme
@smta/core
The adapter-agnostic PostgreSQL schema for SMTA (SaaS Multi-Tenant Architecture) — tenant isolation, RLS policies, audit logging, billing tables, and the full public.* RPC surface.
What's in this package
56 SQL files covering the entire SMTA core schema:
| Area | What it creates |
|------|-----------------|
| Schemas | core, platform, utils, public, app |
| Tables | Organizations, units, memberships, roles, invitations, audit logs, billing customers and subscriptions |
| RLS policies | Row-level tenant isolation on all core and platform tables |
| Triggers | Auto-provisioning on new user and organization creation |
| Public functions | The full public.* RPC interface callable by application code |
| Platform functions | Service-role management functions for SaaS operators |
Usage
This package is consumed by @smta/cli — you do not install it directly. To deploy SMTA to your database, run:
npx @smta/cli --adapter supabase
# or
npx @smta/cli --adapter payloadThe CLI resolves @smta/core and your chosen adapter, combines their SQL files in execution order, and writes a single deployment script to your current directory.
See the Installation guide for full instructions.
Part of the SMTA package family
| Package | Purpose |
|---------|---------|
| @smta/core | This package — adapter-agnostic SQL schema |
| @smta/supabase | Supabase auth and Vault adapter SQL |
| @smta/payload | Payload CMS adapter SQL + middleware |
| @smta/billing | BillingProvider interface (Stripe, Lemon Squeezy) |
| @smta/schemas | Zod v4 schemas for all public.* RPC contracts |
| @smta/cli | Deployment CLI |
License
MIT
