1 Commits
Author SHA1 Message Date
Andrew Beveridge ☄️andClaude Opus 4.6 90ce8951f5 feat: separate B2B tenant portal with edge config injection (#458)
## Summary

- Separate whitelabel B2B tenant portals into their own Cloudflare Pages
project (`karaoke-gen-tenant`) with edge-injected tenant config, fixing
the magic link auth bug and eliminating flash of consumer content
- Fix magic link emails to use tenant-specific URLs and branding (emails
now link to `vocalstar.nomadkaraoke.com` instead of always
`gen.nomadkaraoke.com`)
- Add Cloudflare Pages Function that injects `window.__TENANT_CONFIG__`
and CSS variables at the edge for instant branding
- Add `NEXT_PUBLIC_TENANT_PORTAL=true` build flag for tree-shaking
consumer content from tenant builds
- Add admin tenant preview via `?preview_tenant=X` query parameter
- Add tenant-scoped access tokens (tokens with `tenant_id` override
hostname-based detection)
- Dual build+deploy in CI (consumer → `karaoke-gen`, tenant →
`karaoke-gen-tenant`)

## Test plan

- [x] 17 backend tests pass (magic link params, tenant URLs, verify
response, tenant-scoped tokens, require_auth override)
- [x] 35 frontend tests pass (tenant store, edge-injected config, admin
preview, feature flags)
- [x] 181/182 E2E tests pass (1 pre-existing screenshot failure
unrelated to changes)
- [x] Both consumer and tenant portal builds succeed (`npm run build`
with and without `NEXT_PUBLIC_TENANT_PORTAL=true`)
- [ ] Manual: verify vocalstar.nomadkaraoke.com loads with tenant
branding (already deployed)
- [ ] Manual: verify magic link from tenant portal links to correct
domain

@coderabbitai ignore

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 17:15:17 -05:00