revenue-optimizer
Revenue Optimizer
Build revenue features and monetization systems. Analyze existing codebases to understand features, calculate costs, and create data-driven pricing strategies.
Workflow
- Discover - Scan codebase for features, services, and integrations
- Cost Analysis - Calculate per-user and per-feature costs from services
- Design - Create pricing tiers based on value + cost data
- Implement - Build payment integration, pricing logic, and checkout flows
- Optimize - Add conversion optimization and revenue tracking
Feature Discovery
Scan codebase to build feature inventory:
Feature Discovery Process:
1. Scan routes/endpoints → identify user-facing features
2. Scan components/pages → map UI features
3. Scan service integrations → identify cost-generating features
4. Scan database models → understand data entities
5. Cross-reference → map features to their cost drivers
Look for these patterns:
- Routes/Controllers: Each endpoint = potential feature
- React/Vue components: Feature-specific UI modules
- Service clients: AWS SDK, OpenAI, Stripe, Twilio, etc.
- Background jobs: Compute-intensive operations
- Storage operations: S3, database writes, file uploads
Example feature inventory output:
Features Discovered:
├── Core (low cost): Auth, dashboard, CRUD
├── Premium (medium cost): PDF export, email, file storage
└── High-Value (high cost): AI analysis, video processing, real-time sync
Cost Analysis
Analyze services to calculate true costs per user/feature. See references/cost-analysis.md for detailed patterns.
Service Detection
Scan for these cost sources:
- Config files:
.env,config/, secrets - Package.json/requirements.txt: SDK dependencies
- Infrastructure:
terraform/,cloudformation/,docker-compose - Code imports:
aws-sdk,openai,stripe,twilio, etc.
Cost Mapping
Map fixed costs, variable costs (per user), and feature costs (per use). See references/cost-analysis.md for detailed cost mapping patterns and output format.
Pricing Strategy Design
Combine feature value + cost data:
- Calculate cost floor (break-even per user)
- Assess feature value (what users pay for alternatives)
- Set price = max(cost + margin, perceived value)
- Group features into tiers by cost similarity:
- Free: Low-cost features only, cap variable costs, goal < $0.50/user/month
- Pro: Medium-cost features, price at 3-5x cost, primary revenue driver
- Enterprise: High-cost features (AI, video), value-based pricing (10x+ cost OK)
Optimal Price = (Cost Floor x 0.3) + (Value Ceiling x 0.7) where Cost Floor = Cost to Serve / (1 - Target Margin).
See references/pricing-patterns.md for implementation examples.
Complete Analysis Example
When asked to create a pricing strategy, produce a full analysis:
PRICING STRATEGY REPORT
=======================================
CODEBASE ANALYSIS
---------------------------------------
Services: AWS S3, OpenAI GPT-4, SendGrid, Auth0, Vercel, PlanetScale
Features:
Core (6): Dashboard, project mgmt, collaboration, reporting
Premium (3): PDF export (Lambda), analytics (Postgres), API access
AI-Powered (2): AI writing + smart suggestions (GPT-4)
COST BREAKDOWN
---------------------------------------
Fixed (Monthly):
Vercel $20 + PlanetScale $29 + Auth0 $0 = $49/month
Variable (Per User/Month):
Auth0 $0.02 + Storage $0.01 + Email $0.01 = $0.04/user
Feature (Per Use):
AI Writing $0.03 | PDF Export $0.01 | API $0.001
USAGE PATTERNS
---------------------------------------
API Calls/month: Casual 50% ~50 | Regular 40% ~500 | Power 10% ~5K
AI Generations: Casual ~5 | Regular ~50 | Power ~300
Tier Limits: Free 100 API/10 AI | Pro 5K API/100 AI | Business unlimited
REVENUE MODEL
---------------------------------------
Distribution: Free 80% | Pro 15% | Business 5%
ARPU: (80% x $0) + (15% x $19) + (5% x $49) = $5.30/user
LTV: ($5.30 x 0.87) / 0.04 = $115
Cost to Serve: Free $0.10 | Pro $2.50 | Business $12
Break-Even: 62 users
12-Month Projection (15% growth):
M1: 100 users, $530 MRR
M6: 266 users, $1,410 MRR
M12: 814 users, $4,314 MRR -- $51,768 ARR
RECOMMENDED TIERS
---------------------------------------
FREE ($0) 3 projects | 100 API | 10 AI | 500MB
PRO ($19/mo) Unlimited | 5K API | 100 AI | 10GB | Margin 87%
BUSINESS ($49) All Pro + 50K API | 500 AI | 50GB | 5 seats | Margin 76%
ENTERPRISE Custom $200+ | Unlimited | SSO | SLA
Overage: AI $0.10/use | API $0.005/call
=======================================
Payment Provider Selection
| Provider | Best For | Integration Complexity |
|---|---|---|
| Stripe | SaaS, subscriptions, global | Low |
| Paddle | SaaS with tax compliance | Low |
| LemonSqueezy | Digital products, simple | Very Low |
| PayPal | Marketplaces, existing users | Medium |
For detailed integration patterns, see:
- Stripe: references/stripe.md
Pricing Tier Design
Common patterns:
- Good-Better-Best: 3 tiers with clear value escalation
- Freemium: Free tier with premium upsell
- Usage-Based: Pay per API call, storage, or compute
- Per-Seat: Charge per team member
For tier structure examples and implementation, see references/pricing-patterns.md.
Subscription Implementation
Key components:
- Subscription state management - Track active, canceled, past_due
- Webhook handling - Process payment events reliably
- Entitlement system - Gate features based on plan
- Billing portal - Self-service plan management
For subscription system patterns, see references/subscription-patterns.md.
Checkout Optimization
Conversion-focused checkout implementation:
- Minimize form fields (email → payment in 2 steps max)
- Show trust signals (security badges, money-back guarantee)
- Display social proof near purchase button
- Offer annual discount prominently (20-40% standard)
- Pre-select recommended plan
For checkout implementation details, see references/checkout-optimization.md.
Feature Gating Pattern
// Entitlement check pattern
async function checkFeatureAccess(userId: string, feature: string): Promise<boolean> {
const subscription = await getSubscription(userId);
const plan = PLANS[subscription.planId];
return plan.features.includes(feature);
}
// Usage in route/component
if (!await checkFeatureAccess(user.id, 'advanced_export')) {
return showUpgradePrompt('advanced_export');
}
Revenue Tracking
Essential metrics to implement:
- MRR (Monthly Recurring Revenue)
- Churn Rate (cancellations / total subscribers)
- LTV (Lifetime Value = ARPU / churn rate)
- Conversion Rate (paid / total signups)
Implementation: Send events to analytics (Mixpanel, Amplitude, or custom) on:
subscription.createdsubscription.upgradedsubscription.canceledpayment.succeededpayment.failed
Quick Implementation Checklist
- Payment provider account and API keys configured
- Webhook endpoint receiving and verifying events
- Subscription state synced to database
- Feature entitlement checks on protected routes
- Billing portal or plan management UI
- Upgrade prompts at key user moments
- Revenue events tracked in analytics
- Failed payment retry and dunning emails