Audience: Backend engineers, DBAs, integration engineers, platform engineers — anyone who needs to reason about how the four onboarding flows are implemented, stored, secured, and orchestrated. Companion to business.md.

Source of truth. Every fact below was derived from reading the actual code:

Code wins over this doc. If reality differs, raise a doc fix. Items needing operational confirmation are marked ⚠️ VERIFY.


Table of Contents

  1. Architectural shape
  2. The three databases — onboarding view
  3. Identity stack overview
  4. Core ER — Organisation, Company, Subaccount, Person
  5. State machines
  6. Tenant onboarding (Flow A) algorithm
  7. AccountRegistrationRequest mechanics
  8. Account creation — what Invite actually does
  9. SetPassword + first-login token mechanics
  10. OrganisationSetup state evolution
  11. Per-tenant DB provisioning
  12. Verification (KYC) — full algorithm
  13. PayoutSubaccount — provider integration
  14. Subaccount registration (Flow D) algorithm
  15. Employee onboarding (Flow B) algorithm
  16. Bulk employee import algorithm