# VibeLending · Business Funnel, Lovable Sync & Custom Domain Architecture Guide
**Author:** Dr. Paul D. Smith / Vibe Lending Systems Engineering  
**Version:** 3.0.0 · Production  
**Scope:** Cohort Member Business Funnel Generation, Lovable AI Builder Integration, and Multi-Tenant Custom Domain Routing

---

## 1. Executive Overview

Every cohort member operating on the **Vibe Lending** platform requires their own independent, branded acquisition funnel to originate private lending deals (Fix & Flip, DSCR, Bridge, Ground-Up Construction) from local borrowers and real estate investors.

To ensure deterministic quality, brand differentiation, and full commercial sovereignty, Vibe Lending provides a **Hybrid Funnel Generation & Deployment Engine**:

```
 ┌─────────────────────────────────────────────────────────────┐
 │                VIBELENDING COHORT HUB                       │
 │  • Enclave-backed Deterministic Loan Sizer                  │
 │  • Member Business Profile & Color Tokens                   │
 │  • 5 Max Bespoke Regenerations Allocated Per Member         │
 └──────────────────────────────┬──────────────────────────────┘
                                │
               ┌────────────────┴────────────────┐
               ▼                                 ▼
 ┌───────────────────────────┐     ┌───────────────────────────┐
 │   OPTION A: DIRECT HOST   │     │    OPTION B: LOVABLE AI   │
 │   VibeLending Native Host │     │  Bespoke React/Vite App   │
 │   • CNAME / A-Record DNS  │     │  • 1-Click Prompt Import  │
 │   • Host Header Router    │     │  • Visual Component Edit  │
 │   • Zero Server Admin     │     │  • Deploy to Custom Domain│
 └───────────────────────────┘     └───────────────────────────┘
```

---

## 2. Cohort Member Funnel Generation & 5-Regeneration Policy

### 2.1 Regeneration Quota
- Each enrolled member is allocated **5 high-fidelity funnel regenerations**.
- Regenerations allow members to experiment with brand color palettes, market positioning, target loan types, and style presets without technical overhead.
- Once 5 regenerations are consumed, additional variations can be coordinated directly with operations support (`support@vibe-lending.com`).

### 2.2 Style Presets Available
1. **Executive Dark (`executive_dark`)**
   - *Primary Palette:* Deep obsidian slate (`#030712`), gold amber accent (`#f59e0b`), card glassmorphism.
   - *Best For:* Institutional private credit desks, commercial bridge lenders, high-net-worth syndicated debt funds.
2. **Royal Capital (`royal_capital`)**
   - *Primary Palette:* Midnight sapphire navy (`#020617`), cobalt blue accent (`#3b82f6`), crisp steel borders.
   - *Best For:* Conservative DSCR residential portfolio lenders, conventional investor refinance.
3. **Emerald Growth (`emerald_growth`)**
   - *Primary Palette:* Forest night charcoal (`#051510`), vivid emerald mint accent (`#10b981`), high-growth energy.
   - *Best For:* Fast fix-and-flip financing, 100% rehab draw programs, urban infill developers.

---

## 3. Connecting Your Funnel to Lovable (`lovable.dev`)

Lovable is a state-of-the-art AI full-stack web application builder that takes structured prompt packets and generates production-ready React + Vite + Tailwind CSS web applications.

### Step 1: Export Your Lovable Prompt Packet
1. In your **Vibe Lending Dashboard**, click **⚡ My Business Funnel**.
2. Click **Copy Lovable Prompt** in the Funnel Studio.
3. The platform generates a tailored prompt pre-filled with:
   - Your Legal Entity Name & Brand Tagline
   - Target Lending Corridors & Primary Products
   - Exact Hex Brand Color Tokens (`primary`, `card`, `background`)
   - Dual-Cap Loan Sizer Algorithm (LTC vs. ARV)
   - Pinnacle Lending Partners Syndicate Partnership attribution
   - Lead capture and webhook integration endpoints.

### Step 2: Create a New Project in Lovable
1. Navigate to [lovable.dev](https://lovable.dev) and sign in.
2. Click **Create New Project** / **New App**.
3. Paste the copied prompt packet directly into the Lovable project prompt box.
4. Hit **Generate** (or Enter).

### Step 3: Lovable Funnel Structure Verification
Ensure your Lovable build includes these three required components:
1. **Interactive Loan Sizer:**
   - Inputs: Purchase Price ($), Rehab Budget ($), After-Repair-Value ($).
   - Logic: Max Loan = `Min(85% of Purchase + Rehab, 70% of ARV)`.
   - Holdback: 100% of Rehab Budget held in escrow.
   - Borrower Cash: `Purchase Price - (Max Loan - Rehab Budget)`.
2. **Core Product Grid:**
   - Fix & Flip Financing (Bridge & Rehab draws)
   - DSCR Rental Loans (30-yr fixed, cash-flow underwriting)
   - Ground-Up Construction (Senior debt)
3. **Syndicate & Compliance Banner:**
   - Link to `https://www.pinnacle-lending-partners.com` as your nationwide capital partner.
   - Standard commercial mortgage disclaimer.

### Step 4: Record Your Lovable Project in VibeLending
1. In Lovable, copy your project URL (e.g., `https://lovable.dev/projects/abc-123` or your published `*.lovable.app` domain).
2. Return to the VibeLending Funnel Studio, paste the URL in **Lovable Project URL**, and click **Save Sync**.

---

## 4. Connecting Custom Domains (Two Supported Methods)

You can publish your funnel on your own custom domain (e.g., `funding.yourcompany.com` or `yourlendingbrand.com`).

---

### Method A: Host Directly on VibeLending (Zero Infra / Native SSL)

VibeLending includes a multi-tenant Host-Header router that serves your exact branded funnel when visitors access your custom domain.

#### Step 1: Register Your Domain in VibeLending
1. Open **⚡ My Business Funnel** in your Vibe Lending dashboard.
2. In the **Custom Domain** input box, enter your desired domain:
   - Example subdomain: `funding.apexvantage.com` (recommended)
   - Example apex domain: `apexprivatelending.com`
3. Click **Attach Domain**.

#### Step 2: Configure Your DNS Records
Log in to your domain registrar or DNS provider (Cloudflare, GoDaddy, Namecheap, Route53, Google Domains):

| Record Type | Host / Name | Value / Target | TTL | Proxy Status |
| :--- | :--- | :--- | :--- | :--- |
| **CNAME** (Subdomain) | `funding` | `domains.vibe-lending.com` | Auto / 300 | Proxied / DNS Only |
| **A** (Apex Domain) | `@` | `147.93.85.183` | Auto / 300 | Proxied / DNS Only |

*Note for Cloudflare users:* You may enable the orange cloud (Proxy) for immediate free SSL edge termination, or set to DNS-only.

#### Step 3: Verification
Once DNS propagates (typically 2 to 15 minutes):
- VibeLending's reverse router detects incoming HTTP `Host: funding.yourcompany.com`.
- It executes `auth_db.get_funnel_by_domain(...)` and resolves your user account.
- Your customized, high-converting funnel is rendered directly with zero redirection delay.

---

### Method B: Host via Lovable / Netlify / Vercel with VibeLending API

If you customized your app extensively inside Lovable and want to host directly on Lovable's CDN or export to GitHub/Netlify:

#### Step 1: Connect Custom Domain in Lovable
1. In your Lovable project dashboard, navigate to **Project Settings** → **Domains**.
2. Click **Add Custom Domain**.
3. Enter `funding.yourcompany.com`.
4. Follow Lovable's on-screen DNS instructions (typically a CNAME to `cname.lovable.app` or an A record to Lovable's anycast IPs).

#### Step 2: Connect Lead Webhooks to VibeLending
To ensure leads submitted on your Lovable website flow into your Vibe Lending Deal Pipeline and trigger the Supervisor AI Fleet:
- In Lovable's form submission action, configure the `POST` action to point to:
  ```
  POST https://vibe-lending.com/api/v1/user/deals
  Headers:
    Content-Type: application/json
    x-cohort-member: your_email@domain.com
  Body:
    {
      "deal_name": "124 Main St Rehab",
      "borrower_name": "John Borrower",
      "loan_amount": 340000,
      "loan_type": "FIX_AND_FLIP",
      "property_address": "124 Main St, Raleigh NC"
    }
  ```
- All inbound leads will immediately populate in your VibeLending Deal Manager (`#deals-table`) and can be evaluated with Agent A1, A2, and A3.

---

## 5. Summary Checklist for Cohort Members

- [ ] Complete profile in Vibe Lending (Company Name, Tagline, Phone, Email).
- [ ] Choose your preferred **Style Preset** (`executive_dark`, `royal_capital`, or `emerald_growth`).
- [ ] Test your funnel in preview mode (`/funnel/<your-slug>`).
- [ ] Refine terms or brand color (up to 5 total regenerations).
- [ ] (Optional) Copy Lovable Prompt to build bespoke interactive apps on `lovable.dev`.
- [ ] Add your custom domain in Vibe Lending Funnel Studio.
- [ ] Add CNAME pointing to `domains.vibe-lending.com` at your DNS provider.
- [ ] Verify live site loading and test a sample loan sizing scenario.
