Last updated: Aug 4, 2025, 11:26 AM UTC

Autonomous MVP Build Prompt v4: Complete Business Feature Implementation Framework

Status: Complete - Enhanced with Explicit Business Logic & Integration Requirements
Purpose: Autonomous development framework that GUARANTEES full feature implementation, not just infrastructure
Version: 4.0 - Business Value Delivery Framework
Target: WORKING SaaS with REAL email sending, automation, and business features


Mission Statement

Build COMPLETE, WORKING SaaS applications where every advertised feature ACTUALLY WORKS - not just UI shells. Every campaign created MUST send real emails. Every automation MUST trigger real workflows. Every analytics dashboard MUST show real data.

This v4 framework ensures:

  • Every Feature Works End-to-End - No mock data, no "coming soon", no empty integrations
  • Real Emails Get Sent - Actual Postmark integration with delivery tracking
  • Real Automation Runs - n8n workflows execute and process data
  • Real Analytics Display - Actual metrics from real user actions
  • Success = Customer Can Use It - Not just "looks good" but WORKS

πŸ”΄ CRITICAL v4 MANDATORY REQUIREMENTS

THE BUSINESS VALUE TEST BLOCKING

Before marking ANY feature complete, answer:

  1. Can a real customer use this feature TODAY?
  2. Does it solve their actual problem?
  3. Would they pay for this?

If ANY answer is NO β†’ Feature is NOT complete


v3 Failure Analysis & v4 Solutions

Why v3 Failed to Deliver Business Value:

v3 Problem v4 Solution
"Implement CRUD operations" Explicit: "User creates campaign β†’ n8n triggers β†’ Postmark sends β†’ Analytics updates"
"Professional UI components" "Send button MUST call Postmark API and return messageId"
"AI chat interface" "AI response MUST create database record AND trigger automation"
"Database schema created" "Campaign table MUST have postmark_batch_id, n8n_workflow_id, sent_count"
Focus on deployment Focus on WORKING FEATURES first, deploy working code

Enhanced v4 Framework Structure

Phase 0: Prerequisites UNCHANGED FROM v3

  • All API keys collected and validated
  • External services configured (OpenRouter, Postmark, Stripe)
  • Database ready (Supabase or PostgreSQL)

Phase 0.1: Design System UNCHANGED FROM v3

  • shadcn/ui components configured
  • Professional UI/UX implemented
  • AI chat interface built

Phase 1: CORE BUSINESS FEATURES πŸ†• EXPLICIT IMPLEMENTATION

1.1 Campaign Creation Flow MANDATORY WORKING FEATURE

// THIS CODE MUST EXIST AND WORK
POST /api/campaigns/create
- Receives: { title, subject, content, listId, scheduling }
- Actions:
  1. Validates campaign data
  2. Creates database record with status='draft'
  3. If AI-generated: links to conversation_id
  4. Returns: { campaignId, editUrl, previewUrl }
  
// TEST: Create campaign via API, verify database record exists

1.2 Email Sending Integration REAL EMAILS MUST BE SENT

POST /api/campaigns/{id}/send
- Actions:
  1. Fetch campaign from database
  2. Get contact list (with unsubscribe filtering)
  3. Call Postmark batch API:
     - postmark.sendBatchEmails(messages)
     - Store messageIds for tracking
  4. Update campaign status='sending'
  5. Trigger n8n webhook for processing
  
// TEST: Send to 5 test emails, verify ALL receive message

1.3 n8n Workflow Automation REAL AUTOMATION REQUIRED

// n8n Workflow: campaign-processor.json
1. Webhook trigger: /webhooks/n8n/campaign-created
2. Fetch campaign details from Supabase
3. Process contact list in batches
4. For each batch:
   - Send via Postmark
   - Wait for rate limits
   - Update send progress
5. On completion: Update campaign status='sent'
6. Trigger analytics calculation

// TEST: Create campaign β†’ Verify n8n execution β†’ Check completion

1.4 Contact Management FULL CRUD WITH IMPORT

POST /api/contacts/import
- Accepts: CSV, JSON, or manual entry
- Actions:
  1. Parse and validate emails
  2. Check for duplicates
  3. Insert with subscribe status
  4. Add to specified lists
  5. Return: { imported: 50, skipped: 5, errors: [] }

// TEST: Import 100 contacts CSV, verify in database

1.5 Delivery Tracking REAL METRICS

POST /api/webhooks/postmark
- Receives: Postmark webhook events
- Actions:
  1. Match messageId to email_delivery record
  2. Update status (delivered, opened, clicked, bounced)
  3. Update campaign aggregate metrics
  4. Trigger n8n for bounce handling

// TEST: Send email, trigger open, verify analytics updated

Phase 2: AI-to-Action Integration πŸ†• AI MUST DO REAL WORK

2.1 AI Campaign Creation CHAT CREATES REAL CAMPAIGNS

// In chat response handler:
const campaign = extractCampaignFromResponse(aiResponse);
if (campaign) {
  const result = await fetch('/api/campaigns/create', {
    method: 'POST',
    body: JSON.stringify(campaign)
  });
  
  // AI responds with REAL campaign link
  return `Campaign created! Edit it here: ${result.editUrl}`;
}

// TEST: Say "Create welcome email" β†’ Verify campaign in database

2.2 AI Automation Setup CHAT CONFIGURES REAL WORKFLOWS

// When user says "Set up abandoned cart automation"
const workflow = await createN8nWorkflow({
  template: 'abandoned-cart',
  trigger: 'cart_abandoned',
  delays: [1, 24, 72], // hours
  campaigns: generatedCampaigns
});

return `Automation active! View in n8n: ${workflow.editUrl}`;

// TEST: Request automation β†’ Verify n8n workflow exists

Phase 3: Mandatory Success Metrics πŸ†• PROVE IT WORKS

3.1 Feature Completion Checklist

Every feature MUST have:

  • Database Records: Real data saved
  • API Endpoint: Callable and returns data
  • UI Integration: Button/form triggers API
  • Error Handling: User sees helpful messages
  • Success Feedback: User knows it worked
  • Audit Trail: Can see what happened

3.2 Integration Verification

  • Email Flow: Create β†’ Send β†’ Deliver β†’ Track β†’ Report
  • Automation Flow: Trigger β†’ Process β†’ Execute β†’ Complete
  • AI Flow: Chat β†’ Understand β†’ Create β†’ Confirm
  • Payment Flow: Subscribe β†’ Charge β†’ Provision β†’ Access

3.3 End-to-End User Journeys

Test these COMPLETE flows:

  1. New User Success:

    • Sign up β†’ Verify email β†’ Import contacts β†’ Create campaign via AI β†’ Send β†’ See delivery stats
  2. Automation Success:

    • Create automation β†’ Set triggers β†’ Test trigger β†’ Verify execution β†’ Check results
  3. Campaign Success:

    • AI suggests campaign β†’ Approve β†’ Schedule β†’ Sends on time β†’ Track opens

Phase 4: Required API Endpoints

MANDATORY - These MUST exist and work:

// Campaign Management
POST   /api/campaigns/create         // Create new campaign
GET    /api/campaigns                // List all campaigns  
GET    /api/campaigns/{id}          // Get campaign details
PUT    /api/campaigns/{id}          // Update campaign
POST   /api/campaigns/{id}/send     // Send campaign NOW
POST   /api/campaigns/{id}/schedule // Schedule for later
POST   /api/campaigns/{id}/test     // Send test email
DELETE /api/campaigns/{id}          // Delete campaign

// Contact Management  
POST   /api/contacts/import         // Bulk import
GET    /api/contacts                // List with pagination
GET    /api/contacts/{id}          // Get contact details
PUT    /api/contacts/{id}          // Update contact
DELETE /api/contacts/{id}          // Delete contact
POST   /api/contacts/{id}/unsubscribe // Handle unsubscribe

// List Management
POST   /api/lists/create           // Create list
GET    /api/lists                  // Get all lists
POST   /api/lists/{id}/add-contacts // Add contacts to list
POST   /api/lists/{id}/remove-contacts // Remove from list

// Automation (n8n)
POST   /api/automation/create      // Create workflow
GET    /api/automation/templates   // Get templates
POST   /api/automation/{id}/activate // Turn on
POST   /api/automation/{id}/test   // Test run

// Analytics
GET    /api/analytics/campaigns    // Campaign metrics
GET    /api/analytics/contacts     // Contact metrics
GET    /api/analytics/revenue      // Revenue metrics

// Webhooks (incoming)
POST   /api/webhooks/postmark      // Email events
POST   /api/webhooks/stripe        // Payment events
POST   /api/webhooks/n8n          // Workflow events

// AI Integration
POST   /api/ai/analyze-campaign    // Get AI suggestions
POST   /api/ai/generate-content    // Create content
POST   /api/ai/extract-campaign    // Parse from chat

Phase 5: n8n Workflow Templates

MANDATORY - These workflows MUST be created:

5.1 Welcome Series Workflow

{
  "name": "welcome-series",
  "nodes": [
    {
      "webhook": "/n8n/contact-created",
      "wait": "immediate",
      "email": "Welcome Email",
      "wait": "1 day",
      "email": "Getting Started Guide",
      "wait": "3 days", 
      "email": "Special Offer"
    }
  ]
}

5.2 Campaign Processor Workflow

{
  "name": "campaign-processor",
  "nodes": [
    {
      "webhook": "/n8n/campaign-send",
      "fetch": "campaign details from Supabase",
      "loop": "through contact batches",
      "send": "via Postmark API",
      "update": "campaign status"
    }
  ]
}

5.3 Bounce Handler Workflow

{
  "name": "bounce-handler",
  "nodes": [
    {
      "webhook": "/n8n/email-bounced",
      "update": "contact as bounced",
      "check": "bounce type",
      "if_hard": "mark undeliverable",
      "notify": "admin if high bounce rate"
    }
  ]
}

Phase 6: Definition of DONE

A Feature is ONLY Complete When:

  1. It Works End-to-End

    • User action β†’ API call β†’ Database update β†’ External service β†’ Response β†’ UI update
  2. It Has Tests

    # These commands MUST pass:
    npm test -- --grep "creates campaign"
    npm test -- --grep "sends email"
    npm test -- --grep "triggers automation"
    
  3. It Has Monitoring

    • Errors are logged
    • Success metrics tracked
    • User actions recorded
  4. Customer Can Use It

    • Not "it compiles"
    • Not "UI looks good"
    • But "I sent a real campaign to real people"

Success Metrics for v4

Build is ONLY successful if:

  • 10 Real Emails Sent: Via Postmark to actual addresses
  • 5 Campaigns Created: Through AI chat that exist in database
  • 3 Automations Running: In n8n that process real triggers
  • 100 Contacts Imported: From CSV that can receive campaigns
  • Open Tracking Works: Click link in email, see analytics update
  • AI Creates Real Campaign: Say "create welcome email" β†’ it exists
  • Unsubscribe Works: Click link β†’ marked in database
  • Analytics Show Real Data: Not hardcoded, from actual events

πŸ”΄ Common v3 Mistakes to AVOID in v4

Don't Do This Do This Instead
"Chat interface complete" "Chat creates campaign ID #425 in database"
"Email template rendered" "Email delivered to inbox, MessageID: pm-123"
"Automation UI built" "n8n workflow executing, run ID: 78234"
"Analytics dashboard pretty" "Showing 47% open rate from 200 real sends"
"Payment form exists" "Stripe subscription created, customer charged $29"
"Import looks good" "527 contacts imported, 12 duplicates skipped"

Implementation Order for Maximum Value

Week 1: Core Value Loop

  1. Create campaign (basic)
  2. Send email (real Postmark)
  3. Track delivery
  4. Show in dashboard

Week 2: AI Integration

  1. AI extracts campaign from chat
  2. Creates in database
  3. Sends test email
  4. User approves and sends

Week 3: Automation

  1. n8n webhook receiver
  2. Welcome series template
  3. Trigger on signup
  4. Execute workflow

Week 4: Polish

  1. Analytics aggregation
  2. Bounce handling
  3. Unsubscribe management
  4. Performance optimization

FINAL VALIDATION CHECKLIST

Before considering v4 complete, validate:

The CEO Test

Can you demo this to a CEO and have them:

  1. Create a campaign with AI
  2. Send it to their team
  3. See who opened it
  4. Without any "imagine this works" or "this will..."

The Customer Test

Would a paying customer be satisfied that:

  1. The feature they paid for works
  2. Their emails actually get delivered
  3. Their automations actually run
  4. Their analytics are actually accurate

The Integration Test

# Run this actual test:
curl -X POST http://localhost:3002/api/campaigns/create \
  -H "Content-Type: application/json" \
  -d '{"title":"Test","content":"Hello","listId":1}'

# Returns: {"campaignId": 123, "status": "created"}

curl -X POST http://localhost:3002/api/campaigns/123/send

# Check Postmark dashboard: Email delivered
# Check database: status = 'sent'
# Check n8n: Workflow executed

Key Difference: v3 vs v4

v3 Mindset: "Build a professional-looking email platform"

v4 Mindset: "Build a platform that SENDS EMAILS"

v3 Success: "The UI is beautiful and the code deploys"

v4 Success: "Customer sent 10,000 emails and tracked delivery"

v3 Demo: "Here's our beautiful interface..."

v4 Demo: "Watch me send an email right now... refresh ...there it is in my inbox!"


Summary: The v4 Guarantee

Following this framework GUARANTEES:

  1. Every feature ACTUALLY WORKS
  2. Real emails get SENT and DELIVERED
  3. Real automations EXECUTE
  4. Real analytics from REAL EVENTS
  5. Customers can USE IT TODAY

No more beautiful shells. Only WORKING SOFTWARE.


Framework v4: Where "It's implemented" means "It's working in production with real users"