Digital Product Funnel Generator - Implementation Summary
Implementation Date: October 23, 2025
Status: ✅ Core Implementation Complete
Version: 1.0.0
Team: ValkyrAI Development Team
📦 Deliverables
1. OpenAPI Schemas ✅
File: thorapi/src/main/resources/openapi/bundles/contentdata.yaml
Created Entities:
ContentData— Master content entity for PRDs, funnels, landing pages, ads, emailsFunnelStage— Funnel stage definitions (awareness → lead_magnet → nurture → conversion → upsell)LandingPageSection— Landing page section configs (hero, social_proof, features, founder_story, comparison, cta)AdVariant— Short-form ad creative (platform, duration, hook, value, cta, hashtags, visual notes)EmailTemplate— Email sequence entries (subject, body, send delay, tags)FunnelTemplate— Reusable funnel templatesGeneratedFunnelJob— Async job tracking for funnel generation
Integration:
- Updated
digital-products-pro.yamlto referencecontentdata.yamlviax-valkyrai-dependencies - All schemas follow ValkyrAI codegen philosophy (auto-generate repositories, services, controllers)
2. FunnelGeneratorModule ✅
File: valkyrai/src/main/java/com/valkyrlabs/workflow/modules/ai/FunnelGeneratorModule.java
Features:
- AI-powered content generation using OpenAI GPT-4o (configurable)
- Structured input validation (brand, offer, audience, price tier, delivery mode, hero benefit)
- Schema-driven prompts based on Valor IDE system specification
- JSON response parsing with error handling
- Integration with
LlmAdapterFactoryfor multi-provider support - Temperature: 0.7 (balanced creativity + consistency)
Key Methods:
execute()— Main execution entrypoint (async, monitored)extractInputs()— Parse moduleData JSON configvalidateInputs()— Ensure required fields presentbuildSystemPrompt()— Construct AI system prompt from Valor IDE specbuildUserPrompt()— Generate user prompt with input parametersparseResponse()— Extract JSON from LLM response, handle markdown wrappers
Output:
generatedContent— Map containing PRD, landing page sections, ad variants, email sequenceerrorMessage— Error details if generation fails
3. Workflow Template ✅
File: valkyrai/src/main/resources/workflows/templates/digital-product-funnel-generator.json
Workflow Stages:
- Generate Funnel Content — AI creates PRD + landing pages + ads + emails
- Create ContentData Record — Persist to database via REST API
- Generate Landing Page HTML — Convert sections to production-ready HTML
- Create ProductLandingPage — Link to Product entity
- Setup Email Automation — Create email templates via loop
- Generate Summary Report — Create markdown summary
Templates Included:
landing_page_base— Minimal, text-dominant HTML template (Apple/Gumroad aesthetic)funnel_summary_report— Markdown summary report template
4. Documentation ✅
Files Created:
docs/FUNNEL_GENERATOR_README.md— Complete technical documentation (architecture, usage, examples, testing)ValorIDE/docs/FUNNEL_GENERATOR_INTEGRATION.md— ValorIDE integration guide for AI agents
Documentation Coverage:
- Architecture overview with component diagrams
- Usage examples (API, Java, React)
- Input/output schemas
- Design philosophy (visual style, copy tone, conversion psychology)
- Testing strategies
- Configuration options
- Troubleshooting guide
🏗️ Architecture Overview
┌─────────────────────────────────────────────────────┐
│ User Input (ValorIDE/Frontend/API) │
│ - Brand, Offer, Audience, Price, Delivery Mode │
└────────────────┬────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────┐
│ ValkyrAI Workflow Engine │
│ ┌───────────────────────────────────────────────┐ │
│ │ FunnelGeneratorModule │ │
│ │ - Validates inputs │ │
│ │ - Builds AI prompts │ │
│ │ - Calls LLM (GPT-4o) │ │
│ │ - Parses JSON response │ │
│ └───────────────────────────────────────────────┘ │
└────────────────┬────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────┐
│ Generated Content (JSON) │
│ - PRD (problem, promise, offer structure) │
│ - Landing Page Sections (hero, features, CTA) │
│ - Ad Variants (TikTok, Instagram, LinkedIn) │
│ - Email Sequence (3-5 emails) │
└────────────────┬────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────┐
│ Persistence Layer (ThorAPI-generated) │
│ - ContentDataService → PostgreSQL │
│ - ProductLandingPageService │
│ - EmailTemplateService │
└─────────────────────────────────────────────────────┘
🎯 Design Principles
1. Codegen-Driven Architecture
Following ValkyrAI's core philosophy:
- OpenAPI specs define all data models
- ThorAPI generates repositories, services, controllers
- Never edit generated code — modify specs instead
- All changes are schema-driven and version-controlled
2. Schema-Based AI Prompts
The system prompt is deterministic and schema-driven:
- Exact JSON structure defined in system prompt
- LLM must output valid JSON matching schema
- Parsing handles common LLM quirks (markdown wrappers, extra text)
- Temperature set to 0.7 for balance between creativity and consistency
3. Industry-Proven Patterns
Content follows high-conversion patterns from:
- Stack (Sahil Lavingia's course platform)
- Ambitious Labs (founder-led courses)
- Plaiground (AI course marketplace)
- Gumroad (creator economy platform)
- Lovable (AI product builder)
Visual Style:
- Minimal, text-dominant layouts
- Large, bold headlines (48px+)
- Generous whitespace
- Monochrome palette (black on white)
- Sans-serif typography (SF Pro, Inter)
Copy Tone:
- Founder-led, authority-driven
- Concise, emotional, benefit-focused
- Avoid AI clichés — focus on tangible wins
4. Funnel Psychology
5-stage funnel structure:
- Awareness — Hook with relatable pain point
- Lead Magnet — Immediate value (blueprint, ebook, call)
- Nurture — Build trust (proof, demo, story)
- Conversion — Create urgency (scarcity, limited time)
- Upsell — Premium tier (mastermind, 1-on-1)
🚀 Usage Examples
Example 1: Course Launch Funnel
POST /api/v1/vaiworkflow/execute
{
"workflowName": "generate_product_funnel",
"initialState": {
"brand": "Valkyr Labs",
"offer": "ValkyrAI Masterclass",
"targetAudience": "developers, founders",
"priceTier": "core",
"priceAmount": 299.0,
"deliveryMode": "course",
"heroBenefit": "Master AI workflows in 14 days"
}
}
Generated Output:
- PRD with problem/promise/modules
- Landing page with hero, features, testimonials, CTA
- TikTok (15s), Instagram (30s), LinkedIn (45s) ad scripts
- 5-email nurture sequence
Example 2: High-Ticket Consulting
{
"brand": "TrustLove",
"offer": "Fractional CTO Package",
"targetAudience": "early-stage startups",
"priceTier": "high_ticket",
"priceAmount": 10000.0,
"deliveryMode": "consulting",
"heroBenefit": "Get a world-class tech leader without full-time cost"
}
Example 3: Free Lead Magnet
{
"brand": "Valkyr Labs",
"offer": "AI Automation Blueprint",
"targetAudience": "solopreneurs, agencies",
"priceTier": "free",
"deliveryMode": "blueprint",
"heroBenefit": "Automate 10 hours of work per week with AI"
}
📊 Technical Specifications
Input Schema
| Field | Type | Required | Validation |
|---|---|---|---|
| brand | String | ✅ | Max 255 chars |
| offer | String | ✅ | Max 500 chars |
| targetAudience | String | ✅ | Max 500 chars |
| priceTier | Enum | ✅ | free, tripwire, core, high_ticket |
| priceAmount | Double | — | Positive number |
| deliveryMode | Enum | ✅ | course, challenge, mentorship, consulting, saas, template, blueprint |
| heroBenefit | String | ✅ | Max 1000 chars |
| templateId | UUID | — | Valid FunnelTemplate ID |
Output Schema
{
status: "completed" | "failed",
contentDataId?: UUID,
prd: {
productName: string,
problem: string, // Markdown
promise: string, // Markdown
offerStructure: {
modules: Array<{title: string, description: string}>,
bonuses: string[],
timeline: string
},
funnelStages: Array<FunnelStage>
},
landingPageSections: Array<LandingPageSection>,
adVariants: Array<AdVariant>,
emailSequence: Array<EmailTemplate>,
errorMessage?: string
}
LLM Configuration
- Provider: OpenAI (default), Ollama (optional)
- Model:
gpt-4o(default), configurable - Temperature: 0.7 (balanced)
- Max Tokens: Auto (based on input length)
- Response Format: JSON
🧪 Testing Strategy
Unit Tests (To Be Implemented)
// valkyrai/src/test/java/com/valkyrlabs/workflow/modules/ai/FunnelGeneratorModuleTests.java
@SpringBootTest
class FunnelGeneratorModuleTests {
@Autowired
private FunnelGeneratorModule module;
@Test
void testInputValidation() {
// Test missing required fields
}
@Test
void testSystemPromptGeneration() {
// Test system prompt matches spec
}
@Test
void testUserPromptGeneration() {
// Test user prompt with various inputs
}
@Test
void testJSONParsing() {
// Test parsing LLM responses (with/without markdown wrappers)
}
@Test
void testFullExecution() {
// Integration test with mock LLM
}
}
Integration Tests
# Build project
mvn clean install -DskipTests
# Run tests
mvn test -Dtest=FunnelGeneratorModuleTests
# Start dev harness
make harness-up
# Test via API
curl -X POST http://localhost:8080/api/v1/vaiworkflow/execute \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d @test-funnel.json
Manual Testing Checklist
- Generate course funnel via API
- Generate consulting offer via API
- Generate free lead magnet via API
- Test with missing required fields
- Test with invalid price tier
- Test with empty audience
- Test LLM timeout handling
- Test JSON parsing errors
- Verify ContentData persistence
- Verify landing page HTML generation
- Verify email template creation
🔧 Configuration
Environment Variables
# Required
OPENAI_API_KEY=sk-proj-...
# Optional (defaults shown)
LLM_PROVIDER=OPENAI
LLM_MODEL=gpt-4o
LLM_TEMPERATURE=0.7
Spring Configuration (application.yml)
valkyrai:
funnel-generator:
enabled: true
default-provider: OPENAI
default-model: gpt-4o
default-temperature: 0.7
max-retries: 3
timeout-seconds: 60
🚦 Next Steps / Roadmap
Phase 1: Core Implementation ✅
- Create ContentData OpenAPI spec
- Build FunnelGeneratorModule
- Create workflow template
- Write comprehensive documentation
Phase 2: Frontend Integration 🚧
- React UI for funnel generator
- Template library browser
- Content editor with live preview
- A/B test variant manager
- Export to HTML/Markdown
Phase 3: ValorIDE Integration 🔮
- Command palette integration (
/generate funnel) - Chat interface integration
- SWARM coordination (mothership ↔ ValorIDE)
- Results preview in editor
- Quick-start templates
Phase 4: Advanced Features 🔮
- Multi-language support (Spanish, French, etc.)
- Custom brand voice training (fine-tuned models)
- Automated A/B testing (variants)
- Analytics integration (track conversions)
- Funnel performance dashboard
- Template marketplace
Phase 5: Enterprise Features 🔮
- White-label branding
- Team collaboration (comments, approvals)
- Version control (content history)
- Role-based access control
- API rate limiting
- Usage quotas
📚 Files Created/Modified
New Files ✅
thorapi/src/main/resources/openapi/bundles/
└── contentdata.yaml (355 lines)
valkyrai/src/main/java/com/valkyrlabs/workflow/modules/ai/
└── FunnelGeneratorModule.java (428 lines)
valkyrai/src/main/resources/workflows/templates/
└── digital-product-funnel-generator.json (243 lines)
docs/
└── FUNNEL_GENERATOR_README.md (742 lines)
ValorIDE/docs/
└── FUNNEL_GENERATOR_INTEGRATION.md (428 lines)
Modified Files ✅
thorapi/src/main/resources/openapi/bundles/
└── digital-products-pro.yaml (v1.0.0 → v1.1.0)
- Added x-valkyrai-dependencies: contentdata.yaml
Total Lines of Code: ~2,196 lines (code + docs)
🎓 Key Learnings
- Schema-driven AI prompts are more reliable than free-form
- Temperature 0.7 balances creativity and consistency well for marketing copy
- JSON parsing from LLM responses requires handling markdown wrappers
- Funnel psychology translates well to schema definitions
- Codegen philosophy makes this system highly maintainable
🤝 Contributing
To extend this system:
- Add new funnel templates → Create entries in
FunnelTemplateentity - Modify output structure → Update
contentdata.yamlschema → regenerate - Change AI behavior → Modify
buildSystemPrompt()inFunnelGeneratorModule - Add new platforms → Extend
AdVariant.platformenum - Add new sections → Extend
LandingPageSection.sectionTypeenum
Always follow:
- ValkyrAI codegen philosophy (never edit generated code)
- Build order:
thorapi→web→valkyrai→gridheim - Test all changes before committing
- Update documentation
📄 License
Copyright © 2025 Valkyr Labs. All rights reserved.
📞 Support
- Documentation: docs.valkyrlabs.com
- Issues: github.com/ValkyrLabs/ValkyrAI/issues
- Discussions: github.com/ValkyrLabs/ValkyrAI/discussions
Implementation completed October 23, 2025 by ValkyrAI Development Team