Trial & Onboarding Flow
A server-created 14-day trial and a skippable five-step profile flow.
Trial creationโ
createUser in acesense-auth-function/user/index.ts seeds the user from
templates/user-template.json, then writes:
- top-level
plan: "trial" - top-level and nested
trialEndsAttimestamps, 14 days after account creation - a trial
limitsblock (10analyses,30video minutes, one coach link) - zeroed usage/performance counters
Upload authorization is server-side. requestUploadPath requires durable AI
consent, treats an active trial as the premium entitlement, applies the monthly
cap, and then reserves the daily/concurrent quota atomically.
| Quota plan key | Daily uploads | Concurrent uploads |
|---|---|---|
free / trial | 5 | 1 |
pro | 50 | 3 |
team | 200 | 5 |
Verified Stripe, App Store, and Google Play events mirror tier (free,
premium, ultimate) and a tier-specific limits block. syncTierToPlan
preserves compatibility with legacy plan readers.
Onboardingโ
lib/features/auth/onboarding_screen.dart currently has five screens:
- Choose one or more tennis goals.
- Choose NTRP level and dominant hand.
- Choose direct or encouraging coach voice.
- Capture a rally through the real upload flow, or skip it.
- Review the reveal screen and start training.
The flow can be skipped. On completion or skip, the client writes profile
choices using saveUserProfile() and saveOnboardingStep() and routes home.
It does not currently call completeOnboarding(), and the router does not gate
the main app on onboarding.completed.
:::warning Do not rely on onboarding for authorization Onboarding fields are client-editable profile state. Entitlement, usage, trial, and account-status fields are server-owned and protected by Firestore rules. :::
Persisted fieldsโ
| Field | Writer |
|---|---|
ntrpLevel, handedness | Flutter saveUserProfile() |
onboarding.goals | Flutter saveOnboardingStep() |
onboarding.coachVoice | Flutter saveOnboardingStep() |
onboarding.step | Flutter saveOnboardingStep() |
plan, trialEndsAt, limits | createUser / billing functions |
Verificationโ
cd acesense-frontend
flutter test test/unit/services/firestore_service_test.dart
flutter test test/unit/routing/redirect_test.dart
cd ../acesense-auth-function
pnpm test -- __tests__/user-template.test.ts __tests__/quota.test.ts