Skip to content

Automate onboarding for new tenant#974

Merged
rchlfryn merged 42 commits intomainfrom
endpoint-new-tenant
Mar 24, 2026
Merged

Automate onboarding for new tenant#974
rchlfryn merged 42 commits intomainfrom
endpoint-new-tenant

Conversation

@rchlfryn
Copy link
Copy Markdown
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

@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
Copy Markdown
Contributor

github-actions bot commented Mar 6, 2026

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

@rchlfryn
Copy link
Copy Markdown
Collaborator Author

When I created a new avalanche center in preview with a valid slug in the AFP, I got an a 404 when visiting their subdomain site: https://btac.endpoint-new-tenant.preview.avy-fx.org/

I believe this was fixed by #947. But I did find another 404 issue with the AFP returning incomplete schemas. This is fixed in #996

@rchlfryn rchlfryn requested a review from busbyk March 20, 2026 17:22
const options = await getTenantOptions(page)
expect(options).toContain(UPDATED_TENANT_NAME)
expect(options).not.toContain(TEMP_TENANT_NAME)
// FIXME
Copy link
Copy Markdown
Collaborator Author

@rchlfryn rchlfryn Mar 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We currently can't delete any tenant so this test is flaky until #976 is fixed

Copy link
Copy Markdown
Collaborator

@busbyk busbyk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@rchlfryn rchlfryn added this pull request to the merge queue Mar 24, 2026
Merged via the queue into main with commit e70b450 Mar 24, 2026
9 checks passed
@rchlfryn rchlfryn deleted the endpoint-new-tenant branch March 24, 2026 12:51
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 3, 2026

🚀 This is included in version v1.12.0

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

2 participants