SaaS Database Schema (SQL + ERD + Prisma)

Output

SQL schema sample

CREATE TABLE organizations (id UUID PRIMARY KEY, name TEXT NOT NULL);
CREATE TABLE users (id UUID PRIMARY KEY, email TEXT UNIQUE NOT NULL);
CREATE TABLE memberships (organization_id UUID REFERENCES organizations(id), user_id UUID REFERENCES users(id), role TEXT NOT NULL, PRIMARY KEY(organization_id, user_id));
CREATE TABLE subscriptions (id UUID PRIMARY KEY, organization_id UUID REFERENCES organizations(id), plan TEXT NOT NULL, status TEXT NOT NULL);

Diagram

organizations 1---* memberships *---1 users
organizations 1---* subscriptions

This schema fits multi-tenant SaaS products. Add audit logs, feature flags, and usage metering for scale.

Generate your own schema

Generate your own schema