Skip to content

Provisioning flow

Provisioning stands up a new business across five systems — scheduler, WorkOS, Stripe, Directus, Vendure — as a durable Temporal workflow. It is the specialization of convergence for a brand-new business.

sequenceDiagram
    actor Admin
    participant Portal as portal (admin)
    participant API as scheduler-api (tRPC)
    participant T as Temporal (provisionBusiness)
    participant WO as WorkOS
    participant ST as Stripe
    participant DI as Directus
    participant VE as Vendure

    Admin->>Portal: create business
    Portal->>API: businesses.create
    API->>T: start workflow (business.id)
    T->>WO: create organization (keyed on business.id)
    T->>ST: create connected account
    T->>DI: create tenant content scaffold
    T->>VE: create channel + seller
    T-->>API: converged
    API-->>Portal: status (SSE)

Provisioning mints a new WorkOS org keyed on business.id — it does not reuse a same-named org. If the human owner already has their own org, they hit an “Unknown tenant org” 403 because their identity lives in a different org than the one provisioning created. There is no detach mutation; the fix is to add the user to the row’s org. See the Glossary and docs/business-onboarding-overview.md.