SaaS App Database Schema

DiagramEngineering · SaaS Database DesignMade from one prompt
Read-only preview

The prompt

Map out the database schema for a SaaS app

Make your own version

About the framework

Model organization membership separately from user identity

USER, ORGANIZATION, MEMBERSHIP, PROJECT, and SUBSCRIPTION are the five entities. Membership holds user_id, org_id, and role, allowing the diagram to represent a user’s role within an organization. Projects and subscriptions also carry org_id. Each entity has a UUID primary key.

The relationships show users and organizations with zero or more memberships, organizations with zero or more projects, and exactly one subscription per organization. The subscription includes stripe_id, status, and expires_at; the organization also has a plan field. The Stripe field is a model entry, not a working billing connection.

Before implementation, decide how invitations, duplicate memberships, free organizations, and subscription history should work. Define how organization plan and subscription status remain consistent, and specify authorization separately from the diagram.

What's included

What you get

  • Five entities with UUID primary keys and selected attributes
  • A Membership entity with user, organization, and role fields
  • Organization ownership of projects through org_id
  • A subscription entity with a billing reference, status, and expiry
Diagram

SaaS App Database Schema

engineeringdatabasesaasschema

✦ Free preview · Sign in to use

Frequently asked questions

Common questions

Can one user belong to multiple organizations?

The drawn User-to-Membership relationship allows multiple membership records. Each membership links that user to an organization and carries a role.

Does the schema permit an organization with no subscription?

The sample draws exactly one subscription per organization. Change the relationship if your model allows an organization before billing is set up.

Does org_id enforce tenant isolation?

The diagram records ownership relationships. It does not implement authorization or access policies; those rules must be designed and enforced in the application and database as appropriate.

SaaS App Database Schema

Free to start. No credit card required.

Free preview · Sign in to use