Skip to content

Latest commit

 

History

History
77 lines (58 loc) · 2.74 KB

File metadata and controls

77 lines (58 loc) · 2.74 KB

🔄 Multi-Tenant Architecture - Vercel Constraints Solution

⚠️ Problem: Wildcard Subdomains Not Supported

Vercel doesn't support wildcard subdomains for .vercel.app domains, so we can't use:

  • https://{preview-id}.bmad-preview.vercel.app

🎯 Alternative Solutions

Option 1: Path-Based Multi-Tenant Routing (RECOMMENDED)

Instead of subdomains, use URL paths:

  • https://bmad-lead-gen-agent.vercel.app/preview/{preview-id}
  • Example: https://bmad-lead-gen-agent.vercel.app/preview/a1b2c3d4

Pros:

  • ✅ Works immediately with existing Vercel setup
  • ✅ No domain configuration needed
  • ✅ Still professional URLs for sharing
  • ✅ All existing code works with minor routing changes

Cons:

  • ❌ Less "premium" feel than custom subdomains
  • ❌ Longer URLs

Option 2: Custom Domain with Wildcard (FUTURE UPGRADE)

Purchase custom domain and configure wildcard:

  • https://{preview-id}.bmad-previews.com
  • Requires: Domain purchase + DNS configuration

Pros:

  • ✅ True multi-tenant subdomains
  • ✅ Most professional appearance
  • ✅ Shortest URLs

Cons:

  • ❌ Requires domain purchase (~$12/year)
  • ❌ Additional DNS configuration
  • ❌ More complex setup

Option 3: Hybrid Approach

Use path-based for immediate deployment, upgrade to custom domain later:

  • Phase 1: https://bmad-lead-gen-agent.vercel.app/preview/{id}
  • Phase 2: https://{id}.bmad-previews.com (when ready)

💡 RECOMMENDED: Implement Option 1 (Path-Based)

This gives us immediate multi-tenant functionality with professional URLs that are easy to share:

Example URLs:

  • https://bmad-lead-gen-agent.vercel.app/preview/rest456a (Restaurant)
  • https://bmad-lead-gen-agent.vercel.app/preview/tech789b (Technology)
  • https://bmad-lead-gen-agent.vercel.app/preview/law123c (Legal)

Benefits:

  • Immediate: Works with current Vercel setup
  • Professional: Clean, shareable URLs
  • Functional: All multi-tenant features work
  • Scalable: Can handle unlimited previews
  • Mobile-Friendly: Responsive on all devices

🔧 Implementation Changes Needed

Minimal Code Updates Required:

  1. Backend: Update preview URLs to use path format (1 line change)
  2. Frontend: Already supports path-based routing (/preview/[id])
  3. Sharing: URLs are still professional and easy to share

Current Status:

  • ✅ Backend preview service: Working
  • ✅ Frontend routing: Already supports /preview/[id]
  • ✅ Professional UI: Ready
  • 🔄 URL format: Need to update from subdomain to path-based

🚀 Quick Fix Implementation

The good news is our frontend already supports path-based routing with /preview/[id].js!

We just need to update the backend to generate path-based URLs instead of subdomain URLs.