Skip to content

Organizations

Create and configure organizations — first-class User records (type=2) in the unified user model.

Provision the backend

Status: Preview — some backend operations for this flow are not yet available end-to-end. The blocks install and render, but parts of the flow cannot complete yet. Provision the b2b preset onto your database — it installs the database modules this flow needs (listed under Backend below).

bash
# Orgs require the full B2B stack (org-scoped memberships/permissions/invites/hierarchy).
# There is no preset smaller than b2b for org flows — see Backend below.
pgpm install

Install the blocks

Requires the one-time host setup — the @constructive registry namespace mapped in your components.json.

bash
npx shadcn@latest add @constructive/org-create-card @constructive/org-settings-form

Wire them up

Mount the runtime once at the app root so every block resolves its hook.

tsx
import { StepUpProvider } from '@/blocks/auth/use-step-up/step-up-provider';

// org-settings-form gates danger-zone deletion behind a step-up.
<StepUpProvider>{children}</StepUpProvider>

Usage

A representative usage of this flow.

tsx
import { OrgCreateCard } from '@/blocks/org/create-card/create-card';

// Creates a users row with type=2 (an organization).
<OrgCreateCard onSuccess={(org) => router.push(`/orgs/${org.id}`)} />

Built with org-create-card, org-settings-form.

Backend

Provision the b2b preset — it installs these database modules (scoped modules shown as name:scope):

  • users_module
  • membership_types_module
  • memberships_module:app
  • memberships_module:org
  • sessions_module
  • user_state_module
  • user_credentials_module
  • config_secrets_module
  • emails_module
  • rls_module
  • user_auth_module
  • session_secrets_module
  • rate_limits_module
  • connected_accounts_module
  • identity_providers_module
  • webauthn_credentials_module
  • webauthn_auth_module
  • phone_numbers_module
  • permissions_module:app
  • permissions_module:org
  • limits_module:app
  • limits_module:org
  • levels_module:app
  • levels_module:org
  • profiles_module:app
  • profiles_module:org
  • hierarchy_module:org
  • invites_module:app
  • invites_module:org
  • devices_module

GraphQL operations this flow makes live: createUser, updateUser, currentUser

Related flows