← All Diagrams

Multi-Tenancy Domain Model

class diagram

Class diagram covering tenant, company, user, user profile, roles, permissions, department, invitations, and subscription configuration.

Source: multi-tenancy-model.mmd

classDiagram
    class Tenant {
        +string id
        +string companyName
        +string ownerUID
        +string naicsCode
        +SubscriptionConfig subscription
        +timestamp createdAt
        +timestamp updatedAt
    }
    class SubscriptionConfig {
        +string tier
        +number maxUsers
        +string[] activeFeatures
    }
    class User {
        +string uid
        +string tenantId
        +string email
        +string[] roleIds
        +string status
        +UserProfile profile
        +timestamp createdAt
        +timestamp lastLoginAt
    }
    class Company {
        +string id
        +string name
        +string ownerId
        +timestamp createdAt
        +number userCounter
    }
    class UserProfile {
        +string firstName
        +string lastName
        +string phone
        +string address
        +string jobTitle
        +string departmentId
        +boolean profileCompleted
    }
    class UserRole {
        +string id
        +string roleName
        +Permission[] permissions
    }
    class Permission {
        +string resource
        +string action
    }
    class Invitation {
        +string id
        +string email
        +string tenantId
        +string[] roleIds
        +timestamp expiresAt
        +string status
    }
    class Department {
        +string id
        +string tenantId
        +string name
    }

    Tenant "1" -- "n" Company : has
    Tenant "1" -- "1" SubscriptionConfig : uses
    Company "n" -- "n" User : has
    User "1" -- "1" UserProfile : has
    User "n" -- "n" UserRole : assigned
    User "1" -- "1" Department : memberOf
    Invitation "n" -- "n" User : sentTo
    Tenant "1" -- "n" Invitation : issues
    UserRole "1" -- "n" Permission : defines