Developer Guide

Demo Mode

Building without API keys

Demo Mode

Demo mode lets you experience the full functionality of Prompt Stack without any external dependencies. Perfect for development, testing, and showcasing your application.

✨ Zero Configuration Required! Demo mode works immediately after installation. No API keys, no external services, just pure functionality.

What is Demo Mode?

Demo mode provides fully functional mock implementations of all external services:

🔐 Authentication

  • ✅ Any email/password combination works
  • ✅ Instant "email verification"
  • ✅ Password reset flow (fake emails)
  • ✅ User profile management
  • ✅ JWT tokens (demo signed)

🤖 AI Features

  • ✅ Pre-programmed AI responses
  • ✅ Streaming support
  • ✅ Multiple "models" to choose from
  • ✅ Token counting simulation
  • ✅ Error handling examples

💳 Payments

  • ✅ Fake checkout process
  • ✅ Subscription management UI
  • ✅ Invoice generation
  • ✅ Webhook simulation
  • ✅ Customer portal

🔍 Vector Search

  • ✅ In-memory vector storage
  • ✅ Similarity search
  • ✅ Embedding generation (fake)
  • ✅ Search results UI
  • ✅ Performance metrics

Enabling Demo Mode

Automatic (Default)

Demo mode is automatically enabled when no external services are configured:

# backend/.env
DEMO_MODE=auto  # Default value

# If no API keys are found, demo mode activates

Force Demo Mode

Always use demo implementations regardless of configuration:

# backend/.env
DEMO_MODE=true  # Force demo mode

# Even if API keys exist, demo mode is used

Disable Demo Mode

Require real services (app won't work without them):

# backend/.env
DEMO_MODE=false  # Disable demo mode

# Real API keys must be configured

Demo Authentication

Sign In

Any credentials work:

Email: test@example.com (or any email)
Password: password123 (or any password)

# First user automatically becomes admin
# Subsequent users are regular users

Demo Endpoints

# Sign up
POST /api/auth/demo/signup
{
  "email": "any@email.com",
  "password": "anypassword"
}

# Sign in
POST /api/auth/demo/signin
{
  "email": "any@email.com",
  "password": "anypassword"
}

# Returns demo JWT token
{
  "success": true,
  "data": {
    "user": { "id": "demo_123", "email": "any@email.com" },
    "session": { "access_token": "demo_jwt_token" }
  }
}

Demo AI Responses

Pre-programmed Responses

Demo mode includes intelligent responses for common prompts:

Greeting Prompts

Prompt: "Hello" or "Hi"
Response: "Hello! I'm the Prompt Stack demo AI assistant. 
How can I help you explore the features today?"

Code Generation

Prompt: "Write a function" or "code"
Response: "Here's a simple function example:

```python
def greet(name):
    return f'Hello, {name}! Welcome to Prompt Stack!'
```"

General Questions

Prompt: Any other text
Response: "This is a demo response. In production, 
this would be processed by your chosen AI provider 
(OpenAI, Anthropic, etc.)"

Demo AI Endpoint

# Generate demo response
POST /api/llm/generate-demo
{
  "prompt": "Hello AI",
  "model": "demo",
  "stream": false
}

# Streaming demo
POST /api/llm/generate-demo
{
  "prompt": "Tell me a story",
  "stream": true
}
# Returns SSE stream with typed characters

Demo Payments

Test Checkout Flow

  1. Click any "Subscribe" or "Buy" button
  2. Demo checkout page appears
  3. Use any test card number (e.g., 4242 4242 4242 4242)
  4. Payment "succeeds" instantly
  5. Subscription appears in user profile

Demo Payment Endpoints

# Create checkout session
POST /api/payments-demo/create-checkout
{
  "price_id": "demo_price_123",
  "success_url": "/success",
  "cancel_url": "/pricing"
}

# Returns demo checkout URL
{
  "success": true,
  "data": {
    "url": "/demo/checkout?session_id=demo_cs_123"
  }
}

Demo Vector Search

How It Works

Demo mode includes pre-indexed content for testing vector search:

Pre-indexed Documents:

  • 📄 "Introduction to Prompt Stack"
  • 📄 "Building AI Applications"
  • 📄 "Vector Search Explained"
  • 📄 "Authentication Best Practices"
  • 📄 "Payment Integration Guide"

Search Examples

# Search for similar content
POST /api/vectors/search-demo
{
  "query": "How do I add authentication?",
  "limit": 5
}

# Returns relevant documents
{
  "success": true,
  "data": {
    "results": [
      {
        "content": "Authentication Best Practices...",
        "similarity": 0.92
      }
    ]
  }
}

Demo Mode vs Production

FeatureDemo ModeProduction
Setup Time0 minutes15-30 minutes
External DependenciesNoneSupabase, AI providers, etc.
CostFreeAPI usage costs
Data PersistenceIn-memory (resets)Database (permanent)
AI ResponsesPre-programmedReal AI models
Payment ProcessingSimulatedReal transactions

Demo Mode Indicators

The UI clearly shows when demo mode is active:

🚧 Demo Mode Active - Using mock data and services

Demo mode indicators appear in:

  • ✓ Navigation bar (banner)
  • ✓ API response headers
  • ✓ Development console logs
  • ✓ Test pages (/test-api)

Testing in Demo Mode

Recommended Test Flow

  1. Sign Up: Create account with any email
  2. Explore Auth: Try login, logout, profile update
  3. Test AI: Go to /test-ai and try prompts
  4. Try Payments: Subscribe to a plan
  5. Search: Test vector search functionality
  6. Check API: Visit /api/docs for documentation

Demo Mode Limitations

  • ❌ Data resets when containers restart
  • ❌ Limited AI response variety
  • ❌ No real payment processing
  • ❌ No email sending
  • ❌ Fixed vector search results

Transitioning from Demo to Production

🎯 Progressive Enhancement

You can gradually move from demo to production by adding one service at a time. The app continues to work with a mix of demo and real services.

Migration Steps

  1. Add Supabase first
    ./setup.sh supabase

    Real auth and database, demo everything else

  2. Add AI providers
    ./setup.sh ai

    Real AI responses, demo payments

  3. Add payment processing
    ./setup.sh payments

    Full production mode

  4. Disable demo mode
    DEMO_MODE=false

    Require all real services

🎉 Demo Mode Benefits

  • Start building immediately - no setup friction
  • Test all features without costs
  • Perfect for demos and presentations
  • Develop offline without internet
  • Share with others easily
  • Learn the system before adding complexity