Skip to Content
Living documentation — last reviewed 2026-05-28
FeaturesOnboardingOnboarding — Code Map

Onboarding — Code Map

Web (the wizard lives entirely in the web app)

Routes

FileDescription
apps/web/src/app/[lang]/(protected)/onboarding/page.tsxServer component. Calls getCurrentUserServer. If memberships.length > 0 → redirect to /{lang} (member) or /{lang}/dashboard/overview (staff). Otherwise renders <OnboardingContent />.
apps/web/src/app/[lang]/(protected)/onboarding/onboarding-content.tsxClient component. Wraps OnboardingProvider (OnboardJS) with setupWizardSteps, PostHogPlugin, localStorage persistence. Holds handleFinish (the API call chain).
apps/web/src/app/[lang]/(protected)/onboarding/loading.tsxLoading state.

Step components

apps/web/src/components/onboarding/steps/

FileStep idReads/writes
org-step.tsxorgReads flowData.orgName/orgType; writes via updateContext. Uses OrgTypeSelector.
legal-step.tsxlegalEmbeds LegalAcceptanceForm (legal module). Sets legalConsentsAccepted=true on accept.
done-step.tsxdoneRead-only summary using flowData.orgName.

Shared UI under apps/web/src/components/onboarding/

FilePurpose
setup-wizard-ui.tsxRenders progress bar, step shell, navigation buttons. Uses useOnboarding().
org-type-selector.tsxThree-tile selector (physical/online/hybrid).
option-tile.tsxReusable selectable card.
address-autocomplete.tsxGoogle Places autocomplete; not currently wired into the 3-step wizard but reused in settings.
class-type-form.tsxClass type form; reused in dashboard schedule settings.
day-selector.tsx, delivery-mode-selector.tsxReused in program creation flows.
invite-members-form.tsx (+ driver + int.spec)Email-list invite UI; used post-onboarding from settings/members.

Providers

FilePurpose
apps/web/src/providers/onboarding-provider.tsxExports createPostHogPlugin<T>() — wraps @onboardjs/plugin-posthog with FitKit globals (onboarding_variant).
apps/web/src/config/onboarding-steps.tsExports SetupWizardContext type + SETUP_WIZARD_INITIAL_CONTEXT.

Guided tour (FIT-93 Phase B)

FilePurpose
apps/web/src/components/guided-tour/Tour overlay, tooltip, spotlight components (TODO: confirm full file list).
users.guided_tour_completed_atPersists tour completion across sessions. Set via PATCH /users/me.

API

The wizard hits these endpoints in order:

MethodPathModule
POST/organizationsorganizations
POST/legal/consentslegal (out of bucket)
POST/organizations/:id/onboarding-completeorganizations
GET/users/meusers-auth

Server-side guard uses getCurrentUserServer(lang) from apps/web/src/lib/api.ts.

Tests

FileWhat it covers
apps/web/src/components/onboarding/invite-members-form.int.spec.tsxInvitations form (used post-onboarding).
apps/web/e2e/specs/onboarding*.spec.ts (TODO: verify by ls)End-to-end wizard run.