Monetization Implementation Plan
Overview
Implement 3-phase monetization: affiliate sidebar widget, contextual trade prompts, and freemium soft gates.
Phase 1: Sidebar Affiliate Widget
New Component
File: /web/src/components/ui/affiliate-widget.tsx
┌─────────────┐
│ 🦙 Trade │
│ with Alpaca │
│ │
│ Commission- │
│ free stocks │
│ │
│ [Start →] │
│ Sponsored │
└─────────────┘
Integration Point
File: /web/src/components/layout/LeftSidebar.tsx
- Add
<AffiliateWidget />above<SidebarUpgradeBanner />(around line 443) - Only show when sidebar is expanded
- Respect user dismissal (localStorage flag)
Features
- Alpaca logo + "Trade with Alpaca" header
- "Commission-free stocks & ETFs" subtitle
- "Open Account" CTA with referral link
- "Sponsored" label for transparency
- Dismissible with X button (remembers preference)
- Collapsed state shows just icon
Phase 2: Contextual Trade Prompts
New Component
File: /web/src/components/chat/ContextualPromptCard.tsx
Styled card that appears after AI responses mentioning tradeable symbols.
┌─────────────────────────────────────────┐
│ 📈 Ready to trade NVDA? │
│ │
│ Execute your thesis with Alpaca │
│ [Paper Trade] [Open Account →] │
└─────────────────────────────────────────┘
Integration Points
Extend Message Type File:
/web/src/lib/stores/chat-store.tstype ContextualPrompt = { id: string; type: 'affiliate' | 'upgrade'; symbol?: string; title: string; description: string; }; type Message = { // existing... contextualPrompts?: ContextualPrompt[]; };Add to MessageBubble File:
/web/src/components/chat/MessageBubble.tsx- After line 224 (after toolInvocations), render contextual prompts
- Follow same pattern as ToolUseCard
Symbol Detection File:
/web/src/components/chat/ConversationView.tsx- After AI response completes, check if response mentions stock symbols
- Use regex:
/\b[A-Z]{1,5}\b/cross-referenced with known tickers - Add contextual prompt to message if trade-relevant advice detected
Trigger Conditions
- AI mentions specific stock ticker
- Message contains trade advice keywords: "buy", "sell", "position", "entry"
- User is on free tier OR hasn't linked brokerage
- Max 1 prompt per message, 3 per conversation
Phase 3: Freemium Soft Gates
Leverage Existing Components
SidebarUpgradeBanner- already existsPaywallModal- already existsUpgradeBanner- already exists with variants
New: Feature-Specific Upgrade Prompts
File: /web/src/components/ui/feature-gate.tsx
Wrapper component for gating features:
<FeatureGate feature="emotionalFirewall" tier="elite">
<EmotionalFirewallInsights />
</FeatureGate>
Shows locked state with upgrade CTA if user lacks access.
Integration Points
Emotional Firewall Weekly Insights File:
/web/src/components/emotional-firewall/(new section)- Free: Basic alerts only
- Pro: Unlock "Weekly Insights" panel with patterns, triggers, win rate by mood
Chat Usage Limit File:
/web/src/components/chat/ChatInput.tsx- Show usage counter: "12/20 messages today"
- Soft gate at limit with upgrade prompt (not hard block)
Thesis Builder Limit File:
/web/src/app/thesis/page.tsxor thesis components- Free: 5 active theses
- Show count + upgrade when at limit
Journal Export
- Free: View only
- Pro: Export button visible, clicks trigger upgrade prompt if free
UI Patterns
Soft Lock (show preview + upgrade)
┌─────────────────────────────────────┐
│ 🔒 WEEKLY INSIGHTS (Pro) │
│ │
│ Your patterns this week: │
│ • Best hours: ██████░░░░ [blur] │
│ • Triggers: ████████░░ [blur] │
│ │
│ [Unlock for $12/mo] │
└─────────────────────────────────────┘
Usage Counter
┌─────────────────────────────────────┐
│ 💬 12/20 messages today │
│ ████████████░░░░░░░░ │
│ Pro: Unlimited + faster responses │
└─────────────────────────────────────┘
Files to Create/Modify
New Files
| File | Purpose |
|---|---|
/web/src/components/ui/affiliate-widget.tsx |
Sidebar Alpaca widget |
/web/src/components/chat/ContextualPromptCard.tsx |
Post-message trade prompt |
/web/src/components/ui/feature-gate.tsx |
Wrapper for gated features |
/web/src/lib/affiliate-config.ts |
Referral URLs, tracking params |
Modified Files
| File | Change |
|---|---|
/web/src/components/layout/LeftSidebar.tsx |
Add AffiliateWidget |
/web/src/components/chat/MessageBubble.tsx |
Render contextual prompts |
/web/src/components/chat/ConversationView.tsx |
Symbol detection logic |
/web/src/lib/stores/chat-store.ts |
Extend Message type |
/web/src/components/chat/ChatInput.tsx |
Add usage counter |
Implementation Order
Phase 1 (~30 min)
- Create
affiliate-widget.tsx - Create
affiliate-config.tswith Alpaca referral URL - Integrate into LeftSidebar
- Create
Phase 2 (~45 min)
- Create
ContextualPromptCard.tsx - Extend Message type
- Add to MessageBubble
- Add symbol detection in ConversationView
- Create
Phase 3 (~45 min)
- Create
feature-gate.tsxwrapper - Add usage counter to ChatInput
- Add soft gate to Emotional Firewall insights area
- Create
Affiliate Configuration
// /web/src/lib/affiliate-config.ts
export const AFFILIATES = {
alpaca: {
name: 'Alpaca',
referralUrl: 'https://alpaca.markets/?ref=deepstack',
logo: '/logos/alpaca.svg',
tagline: 'Commission-free stocks & ETFs',
cta: 'Open Account',
},
};
Success Metrics
- Affiliate: Click-through rate on widget + contextual prompts
- Freemium: Upgrade conversion rate from soft gates
- Retention: Do gates cause churn or drive upgrades?