Control plane

Storefront tenant dashboard

This is the app-side dashboard shell for the future org storefront migration. It mirrors the Vercel Platforms pattern: one deployment, tenant-aware middleware, wildcard subdomains, and optional custom domains per customer.

Routing model
Resolution order

1. Exact custom domain match, such as shop.customer.com.

2. Wildcard subdomain match, such as tenant.store.karybase.com.

3. Local preview via tenant.localhost:4301 or Vercel preview prefixes like tenant---branch.vercel.app.

4. Rewrites into /preview/[tenantSlug] while preserving tenant headers for the page tree.

Domain operations
API routes included

POST /api/domains adds a customer domain to the Vercel project.

GET /api/domains?domain=... fetches verification and SSL status.

POST /api/domains/verify triggers verification after the tenant adds TXT records.

DELETE /api/domains?domain=... removes the domain when a storefront is disconnected.

Current rollout
Persisted hostname resolution is active
live config

Fallback subdomains: {slug}.store.karybase.com

Optional custom domains: customer.com and shop.customer.com

Canonical redirect: verified custom domains take over from the fallback subdomain.