Cloud onboarding wizard, billing trial card, and post-checkout server setup - #5264
Conversation
…server setup - Onboarding wizard (Welcome -> Plan -> Project -> Server -> Deploy -> Complete), shown once to an org owner with zero projects and no active plan/trial; skippable per step or entirely - Billing page shows the org's current plan, and a no-card 14-day trial card when eligible - Post-checkout "Welcome to Dokploy Cloud" modal simplified to reuse the onboarding wizard's own project/server/deploy steps behind a modal instead of its previous standalone 6-step flow, using the app's regular typography instead of the wizard's display serif - Onboarding wizard validates a persisted project still exists before resuming a stale session, and the dashboard layout no longer gets stuck redirecting to /dashboard/home once the local onboarding-active flag goes stale mid-session - onboardingCompletedAt column on user, with a backfill so existing users aren't shown the wizard - pnpm reset-onboarding dev script to reset a test account's onboarding state end to end
| const subscription = await stripe.subscriptions.create({ | ||
| customer: stripeCustomerId, | ||
| items: [{ price: HOBBY_PRICE_MONTHLY_ID, quantity: 1 }], | ||
| trial_period_days: TRIAL_DURATION_DAYS, | ||
| trial_settings: { end_behavior: { missing_payment_method: "cancel" } }, | ||
| metadata: { source: "onboarding_trial", adminId: owner.id }, | ||
| }); |
There was a problem hiding this comment.
| useEffect(() => { | ||
| if (!createdServerId && existingServers && existingServers.length > 0) { | ||
| setCreatedServerId(existingServers[0]!.serverId); | ||
| } | ||
| }, [existingServers, createdServerId]); |
There was a problem hiding this comment.
Existing server setup starts automatically
When the organization already has a server, this selects the most recently created accessible server and starts setupWithLogs before validation establishes whether setup is required, causing Docker Swarm, network, Traefik, and dependency setup to run against an unrelated existing host.
Knowledge Base Used: Dashboard and client state
| for (const membership of memberships) { | ||
| const deletedProjects = await db | ||
| .delete(projects) | ||
| .where(eq(projects.organizationId, membership.organizationId)) | ||
| .returning({ id: projects.projectId, name: projects.name }); | ||
| for (const project of deletedProjects) { | ||
| console.log(` - deleted project "${project.name}" (${project.id})`); | ||
| } | ||
|
|
||
| const deletedServers = await db | ||
| .delete(server) | ||
| .where(eq(server.organizationId, membership.organizationId)) | ||
| .returning({ id: server.serverId, name: server.name }); | ||
| for (const deletedServer of deletedServers) { | ||
| console.log( | ||
| ` - deleted server "${deletedServer.name}" (${deletedServer.id})`, | ||
| ); | ||
| } | ||
| } | ||
|
|
||
| await updateUser(foundUser.id, { | ||
| onboardingCompletedAt: null, | ||
| stripeCustomerId: null, | ||
| // startFreeTrial sets these directly on the user row (not via webhook), |
There was a problem hiding this comment.
Reset deletes shared organization resources
When the target account belongs to an organization shared with other users, the script deletes every project and server by membership organization ID, causing resources unrelated to that test account to be permanently removed.
Knowledge Base Used: Identity, permissions, and audit
What
onboardingCompletedAtcolumn onuser, with a backfill so existing users aren't shown the wizard on upgrade.pnpm reset-onboarding <email>dev script to reset a test account's onboarding state (Stripe subscriptions, projects, servers, flags) end to end.apps/api: local Inngest dev server script + README section.Fixes along the way
/dashboard/homeonce the local onboarding-active flag goes stale mid-session (it was only ever read once, on first mount, since the layout persists across navigations).Greptile Summary
The PR adds a cloud onboarding wizard, no-card trials, billing status UI, post-checkout project/server/deployment setup, onboarding persistence, and local development utilities.
Confidence Score: 2/5
The PR should not merge until duplicate trial creation, automatic setup of existing servers, and organization-wide reset deletions are addressed.
Concurrent trial requests can create untracked Stripe subscriptions, the onboarding server step can reconfigure an unrelated existing host automatically, and the reset script can delete shared resources across every organization joined by the target user.
Files Needing Attention: apps/dokploy/server/api/routers/stripe.ts, apps/dokploy/components/dashboard/onboarding/steps/server-step.tsx, apps/dokploy/scripts/reset-onboarding.ts
Reviews (1): Last reviewed commit: "feat: cloud onboarding wizard, billing t..." | Re-trigger Greptile