Skip to content

Automate onboarding for new tenant#974

Open
rchlfryn wants to merge 26 commits intomainfrom
endpoint-new-tenant
Open

Automate onboarding for new tenant#974
rchlfryn wants to merge 26 commits intomainfrom
endpoint-new-tenant

Conversation

@rchlfryn
Copy link
Collaborator

@rchlfryn rchlfryn commented Mar 5, 2026

Description

Automates the entire tenant onboarding workflow. Creating a new tenant in the admin panel now automatically provisions all default data (settings, pages, navigation, etc.) and displays an interactive onboarding checklist on the tenant edit page to track progress.

Related Issues

Fixes #533

Key Changes

  • Provision endpoint (POST /api/tenants/provision) — creates a tenant and provisions all default data in one call. Can also be triggered via the provisionAfterChange hook on tenant creation.
  • Provisioning logic — creates website settings with placeholder brand assets, 4 built-in pages, copies template pages from DVAC (filtering tenant-scoped blocks, converting static lists to dynamic), creates a home page with welcome content, and builds navigation linking everything together.
  • Onboarding Checklist UI — a ChecklistItem-based component on the tenant edit page showing status of all automated and manual steps, with a "Rerun Provisioning" button if anything is incomplete.
  • Server actions (onboardingActions.ts) — checks provisioning status by querying all relevant collections and inspecting colors.css and centerColorMap for theme setup.
  • Placeholder brand assets — three PNG images (logo, icon, banner) used as required upload placeholders for website settings during provisioning.
  • removeIdKey utility — strips id keys from deeply nested objects when copying template pages to avoid ID collisions.
  • Seed fix — added skipProvision: true context to upsertGlobals to prevent auto-provisioning during seeding.
  • Updated docs/onboarding.md — rewrote to reflect automated workflow, added CSS variable reference table for theme setup.

How to test

  1. Run pnpm seed to get a fresh database with the template tenant (DVAC)
  2. Go to admin panel → Avalanche Centers → Create
  3. Enter a name and slug, save
  4. Verify the onboarding checklist appears showing all automated steps as complete
  5. Click "Update Brand Assets" to confirm the settings link works
  6. Verify "Add brand colors" and "Add OG image colors" show as incomplete (since no theme exists for the new tenant)

Screenshots / Demo video

if nothing runs correctly
Screenshot 2026-03-05 at 17 50 40

Need to do manual actions
Screenshot 2026-03-05 at 16 38 17

Full set up
Screenshot 2026-03-05 at 16 38 54

https://www.loom.com/share/7ba0486274454cff97b273f3880c358d

Migration Explanation

No schema changes — no migration needed.

Future enhancements / Questions

  • Support deleting an avalanche center #976 — Tenant deletion currently leaves orphaned data. Need a beforeDelete cleanup hook and confirmation prompt.
  • Theme creation could potentially be partially automated (generate a colors.css entry from brand asset colors).
  • Custom domain setup remains manual (Vercel, DNS, PostHog configuration).

@rchlfryn rchlfryn changed the title WIP - Endpoint new tenant Automate tenant creation Mar 6, 2026
@rchlfryn rchlfryn changed the title Automate tenant creation Automate onboarding for new tenant Mar 6, 2026
@github-actions
Copy link

github-actions bot commented Mar 6, 2026

Preview deployment: https://endpoint-new-tenant.preview.avy-fx.org

@rchlfryn rchlfryn self-assigned this Mar 6, 2026
@rchlfryn rchlfryn marked this pull request as ready for review March 7, 2026 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Automate onboarding new avy centers

1 participant