Documentation

DEMO

docs/features/DEMO.md

Petunia Demo Mode

Complete guide for demo mode configuration, data isolation, and demonstration workflows.


Demo Portal Identifier

The official Petunia ID for the demo portal is:

PID-DEMO-001

This identifier is the single source of truth for demo portal detection.

Identifiers Explained

FieldValuePurpose
petuniaIDPID-DEMO-001Canonical, human-readable identifier (PRIMARY)
idAuto-generated CUIDInternal database primary key
isDemoPortaltrueBoolean flag for quick checks

Usage in Code

import { DEMO_PETUNIA_ID, isDemoPortalByPetuniaID } from '@/lib/demo';

// Check if a portal is the demo portal (preferred)
if (portal.petuniaID === DEMO_PETUNIA_ID) {
  // Demo-specific logic
}

// Or use the helper function
if (isDemoPortalByPetuniaID(portal.petuniaID)) {
  // Demo-specific logic
}

Available Exports from @/lib/demo

ExportTypeDescription
DEMO_PETUNIA_IDstringThe canonical PID ('PID-DEMO-001')
isDemoPortalByPetuniaID()functionCheck petuniaID against demo portal
isDemoPortal()functionCheck either id or petuniaID
demoCompanyobjectDemo portal object for fallback responses

Quick Start

Copy the pre-configured .env.demo file:

cp .env.demo .env.local
npm run dev

Open http://localhost:3000 in your browser.


Environment Variables

Core Demo Flags

VariableValueDescription
NEXT_PUBLIC_MODEdemoSets application mode to demo
NEXT_PUBLIC_SKIP_ONBOARDINGtrueBypasses onboarding flow
NEXT_PUBLIC_ENABLE_DEMO_MODEtrueEnables demo-specific UI elements

Required Variables

For basic demo functionality:

# Database
DATABASE_URL=postgresql://user:password@localhost:5432/petunia

# Authentication
SESSION_SECRET=your-session-secret

# Supabase (required)
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_ANON_KEY=your-anon-key
SUPABASE_SERVICE_ROLE_KEY=your-service-role-key

Self-Contained Demo (No External APIs)

USE_DEMO_SERVICES=true

Data Isolation Guarantees

Demo vs Test Doubles

  • Demo data: Curated portal seeded by prisma/seed.ts (demo@example.com). The only non-production tenant surfaced in the UI.
  • Test doubles ("mocks"): Exist only inside tests/** and jest.setup.js. Never imported by runtime code.

Production Guarantees

  1. app/api/payments/**/* talks directly to Stripe using the live Prisma client
  2. lib/auth/server.ts reads real user rows (including billing fields)
  3. Seeds only provision the dedicated demo tenant. Normal signups start with empty billing fields.

Checklist Before Shipping

  • Production files do not import from tests/**
  • Demo seed accounts are clearly labeled as demo-only in the UI
  • Automated tests that rely on test doubles stay under tests/**

Demo Seed Workflow

Run the seed after configuring environment variables:

pnpm prisma db seed

Prerequisites

  1. Clean repo: Stash or commit pending work
  2. Supabase credentials: SUPABASE_URL, SUPABASE_SERVICE_ROLE_KEY, SUPABASE_ANON_KEY
  3. Database access: DATABASE_URL pointing at your Supabase project
  4. pnpm + Node 22: Required to execute tsx prisma/seed.ts

Offline Mode

If running without network access:

SEED_SKIP_SUPABASE=true pnpm prisma db seed

Demo-Ready Features

Fully Working (Demo with confidence)

Authentication

  • Email/password signup and signin
  • Google OAuth signin
  • Password reset flow
  • Session persistence and logout

Onboarding

  • Welcome animation
  • Business information collection
  • Portal creation and dashboard redirect

Dashboard

  • Portal dashboard loads
  • Navigation and settings accessible
  • Multi-account support

Yelp Integration

  • Connect Yelp account
  • View Yelp reviews and messages
  • Real-time sync

AI Features

  • Generate AI responses
  • Edit and send responses to Yelp
  • Context-aware replies with brand voice

Communication

  • Unified inbox with message threading
  • Multi-channel support and search

Known Issues (Don't demo these)

  • Some advanced analytics features in progress
  • Phone integration in development
  • Google Business and Facebook integrations in progress

Demo Script (10 minutes)

Step 1: Show Signup (2 min)

"Let me show you how easy it is to get started..."

  1. Go to signup page
  2. Enter email/password OR click Google OAuth
  3. Complete onboarding wizard
  4. Land on dashboard

Highlight: Clean interface, fast onboarding, professional design

Step 2: Connect Yelp (3 min)

"Now let's connect your Yelp Business account..."

  1. Go to Settings → Connections
  2. Click "Connect Yelp" and authorize
  3. View synced reviews and messages

Highlight: Simple OAuth, instant sync, secure authorization

Step 3: View Messages (2 min)

"All your Yelp reviews and messages in one place..."

  1. Go to Inbox
  2. Show message list with filters
  3. Click on a specific message
  4. Demonstrate search functionality

Highlight: Unified inbox, clean organization, fast search

Step 4: Generate AI Response (3 min)

"This is where the magic happens..."

  1. Select a review or message
  2. Click "Generate AI Response"
  3. Edit the response if needed
  4. Send to Yelp

Highlight: Context-aware AI, brand voice consistency, time savings


Security Considerations

  • Never use demo mode in production environments
  • The .env.demo file contains placeholder credentials only
  • Replace all placeholder values with real credentials before deploying
  • Never commit .env.local files to version control

Troubleshooting

Demo mode features not working

  1. Verify .env.local contains the demo flags
  2. Restart development server after changing environment variables
  3. Clear browser cache and cookies
  4. Check browser console for errors

Database connection errors

  1. Verify DATABASE_URL is correct
  2. Ensure PostgreSQL is running
  3. Check that the database exists
  4. Run migrations: npx prisma migrate dev

Last Updated: December 2025