08 — Onboarding & Activation
Ring: 1 (Launch Blocker) Dependency: R1-1 (Auth), R1-4 (Billing — needed to show plan limits) Handbook: Ch. 6 (WOW moment), Ch. 10 (activation metric), Ch. 98 (discovery in first session)
Problem
- Empty page after signup — user doesn’t know what to do.
- “WOW moment” is not guaranteed — user can get lost without knowing the product/country.
- First experience is critical: in B2B SaaS, the first 5 minutes either win or lose the user.
- Handbook: “These are the 5 companies most likely to buy your product” — this moment MUST be created.
Decisions
D1: Onboarding Flow (4 Steps)
D2: Onboarding Discovery = FREE
D3: Onboarding Completion Check
D4: Post-Onboarding Guidance
Data Model
No additional table needed. Structures used:export_ai_organizations.settings→ onboarding state (JSONB)export_ai_activity_log→onboarding.started,onboarding.completed,onboarding.discoveryexport_ai_ai_job_runs→ onboarding discovery cost tracking (endpoint: 'onboarding')export_ai_products→ User’s entered product info (optional — future product portfolio)
Architecture
Page Structure
Middleware Integration
Current Code Impact
New Files
| File | Content |
|---|---|
app/onboarding/page.tsx | 4-step wizard |
app/onboarding/components/StepOrg.tsx | Company info form |
app/onboarding/components/StepProduct.tsx | Product description |
app/onboarding/components/StepCountry.tsx | Country selection (flag icons) |
app/onboarding/components/StepDiscovery.tsx | Auto discovery + result display |
app/onboarding/hooks/useOnboarding.ts | Wizard state management |
components/OnboardingBanner.tsx | ”Next steps” banner (dismissible) |
Files to Change
| File | Change |
|---|---|
middleware.ts | Onboarding redirect check |
app/api/discover/route.ts | isOnboarding flag → skip writing to usage_monthly |
app/companies/page.tsx | OnboardingBanner display (for first time) |
Future Decisions
FD-1: Product Portfolio (Ring 2)
The product entered during onboarding can be saved to the export_ai_products table. Users can define multiple products. Each product can have its own discovery.
FD-2: Smart Country Suggestion (Ring 3)
Based on Market Context data: “Best markets for this product: Germany (0.91), Italy (0.84)…” User accepts suggestion instead of choosing a country.
FD-3: Onboarding A/B Test (Ring 3+)
Test different onboarding flows with PostHog. Does 3 steps or 4 steps work better? Do product examples improve conversion?
FD-4: Re-Onboarding (Ring 2)
“Welcome back” flow for users who haven’t used the product in a while. Resume from where they left off.
Atomic Tasks
| # | Task | Ring | Size |
|---|---|---|---|
| ONBOARD-1 | app/onboarding/page.tsx — wizard container + routing | R1 | Medium |
| ONBOARD-2 | StepOrg.tsx — company name + industry form | R1 | Small |
| ONBOARD-3 | StepProduct.tsx — product description + examples | R1 | Small |
| ONBOARD-4 | StepCountry.tsx — country selection (popular countries + search) | R1 | Small |
| ONBOARD-5 | StepDiscovery.tsx — auto discovery + Top 5 display | R1 | Medium |
| ONBOARD-6 | useOnboarding.ts — wizard state + org settings update | R1 | Medium |
| ONBOARD-7 | middleware.ts — onboarding redirect | R1 | Small |
| ONBOARD-8 | isOnboarding flag in discovery route (skip writing to usage) | R1 | Small |
| ONBOARD-9 | OnboardingBanner.tsx — next steps (dismissible) | R1 | Small |