@company-manager/docs

UML Documentation

Comprehensive UML diagrams for all Company Manager business processes

UML Documentation Hub

This section provides extensive UML documentation covering all business processes, entity relationships, and system flows in the Company Manager platform.

Quick Navigation

Business Domains

DomainDescriptionKey Diagrams
E-CommerceOrders, payments, shipping, inventoryOrder lifecycle, payment flows, shipping states
SubscriptionsRecurring billing, subscription managementSubscription lifecycle, billing cycles
CRMLeads, opportunities, clientsSales pipeline, lead qualification
CMSContent management, publishingContent workflow, magazine production
CommunicationsEmail infrastructure, automationEmail delivery, automation flows
WorkflowsAutomation engine, job processingWorkflow execution, node types
Field ServiceInterventions, equipmentService dispatch, equipment lifecycle
EventsBookings, availabilityBooking flow, calendar management
POSPoint of sale, kitchen displayTransaction flow, kitchen orders
PlatformMulti-tenant, permissionsTenant isolation, RBAC

Diagram Types

Entity Relationship Diagrams (ERD)

Show the data model and relationships between entities in each domain.

State Machine Diagrams

Illustrate the lifecycle states and transitions for key entities like orders, subscriptions, and workflows.

Sequence Diagrams

Detail the step-by-step interactions between system components for business processes.

Activity Diagrams

Show the flow of activities and decision points in business processes.

Component Diagrams

Display the architectural components and their interactions.

Platform Overview

graph TB
    subgraph "Business Domains"
        EC[E-Commerce]
        SUB[Subscriptions]
        CRM[CRM & Sales]
        CMS[CMS & Publishing]
        COM[Communications]
        WF[Workflows]
        FS[Field Service]
        EV[Events & Bookings]
        POS[Point of Sale]
    end

    subgraph "Core Platform"
        MT[Multi-Tenant Engine]
        PERM[Permission System]
        SR[Service Registry]
        QM[Queue Manager]
    end

    subgraph "Data Layer"
        DB[(PostgreSQL)]
        CACHE[(Redis)]
        PRISMA[Prisma ORM]
    end

    subgraph "External Integrations"
        STRIPE[Stripe]
        WP[WordPress]
        PS[PrestaShop]
        EMAIL[Email Providers]
    end

    EC --> MT
    SUB --> MT
    CRM --> MT
    CMS --> MT
    COM --> MT
    WF --> MT
    FS --> MT
    EV --> MT
    POS --> MT

    MT --> PERM
    MT --> SR
    SR --> QM

    SR --> PRISMA
    QM --> CACHE
    PRISMA --> DB

    EC --> STRIPE
    CMS --> WP
    EC --> PS
    COM --> EMAIL

    style MT fill:#e1f5fe
    style SR fill:#f3e5f5
    style DB fill:#e8f5e9

Multi-Tenant Data Flow

All business domains operate within the multi-tenant architecture:

flowchart LR
    subgraph "Request Flow"
        REQ[API Request] --> AUTH[Authentication]
        AUTH --> TENANT[Tenant Context]
        TENANT --> SITE[Site Context]
    end

    subgraph "Data Access"
        SITE --> ROUTER[TRPC Router]
        ROUTER --> SERVICE[Service Registry]
        SERVICE --> QUERY[Database Query]
        QUERY --> FILTER[Tenant Filter]
    end

    subgraph "Response"
        FILTER --> DATA[Tenant Data]
        DATA --> RESP[API Response]
    end

    style TENANT fill:#fff3e0
    style FILTER fill:#e8f5e9

Key Patterns

Service Registry Pattern

All business logic flows through the service registry to ensure proper caching and tenant isolation:

sequenceDiagram
    participant Router as TRPC Router
    participant Registry as Service Registry
    participant Cache as Service Cache
    participant Factory as Service Factory
    participant Service as Business Service

    Router->>Registry: getService("order", ctx)
    Registry->>Cache: Check cache (tenantId key)

    alt Cache Hit
        Cache-->>Registry: Return cached instance
    else Cache Miss
        Registry->>Factory: Create service
        Factory->>Service: new OrderService(ctx)
        Service-->>Factory: Instance
        Factory-->>Registry: Instance
        Registry->>Cache: Store with TTL
    end

    Registry-->>Router: Service instance
    Router->>Service: Execute business logic

State Machine Pattern

Core entities follow state machine patterns for lifecycle management:

stateDiagram-v2
    [*] --> Draft: Create
    Draft --> Sent: Submit
    Draft --> Cancelled: Cancel
    Sent --> Confirmed: Accept
    Sent --> Draft: Revise
    Sent --> Cancelled: Reject
    Confirmed --> Fulfilled: Process
    Confirmed --> Cancelled: Cancel
    Fulfilled --> Completed: Deliver
    Fulfilled --> Cancelled: Cancel
    Completed --> [*]
    Cancelled --> [*]

    note right of Draft: Initial state
    note right of Confirmed: Payment received
    note right of Completed: Final state

Getting Started

  1. Understand the platform: Start with Platform Architecture to understand multi-tenancy and permissions
  2. Explore your domain: Navigate to your area of interest using the table above
  3. Follow the flows: Use sequence diagrams to understand process interactions
  4. Check state machines: Review lifecycle states for key entities