# BabyMealBot > WhatsApp-powered baby recipe assistant for parents — extract, organize, and safety-check baby recipes from any source. ## Overview BabyMealBot is a web platform with a WhatsApp-native bot that helps parents collect, organize, and verify baby food recipes. Parents can: 1. Send recipe links/photos to the WhatsApp bot to extract and save recipes 2. Upload screenshots at /organize to get a digital cookbook ($4.99 one-time) 3. Use the free Safety Checker at /safety to verify any recipe URL for allergens, choking hazards, and age-appropriateness Production domain: https://babymealbot.com ## Key Features - **WhatsApp Integration**: Recipe extraction via WhatsApp messaging — no app to download - **Screenshot to Cookbook (/organize)**: Upload up to 15 baby food recipe screenshots, AI extracts recipes with safety checks, get a digital cookbook for $4.99 one-time payment (no subscription) - **Safety Directory (/safety)**: Free Safety Checker tool + 8 in-depth allergen/safety guides (avocado, peanut, egg, honey, strawberry, fish, dairy, wheat) - **Recipe Management**: Personal cookbook with age-appropriate recipes - **Smart Grocery Lists**: Browser-based aggregator with quantity merging and ingredient categorization - **Multi-source Input**: TikTok, Instagram Reels, YouTube Shorts, Facebook, Pinterest, websites, and photos/screenshots - **AI-Powered Extraction**: Recipe parsing using Gemini 2.5 Pro via Lovable AI Gateway - **Three-Stage Conversion**: 3 free recipes (no credit card) → 7-day trial (credit card required) → Personal ($7/mo) or Family ($9/mo) subscription via LemonSqueezy - **Family Plan**: Up to 3 WhatsApp numbers sharing one cookbook + grocery list ## Technology Stack ### Frontend - React 18 with TypeScript - Vite build tool with prerender plugin (per-route SEO HTML) - TailwindCSS + shadcn/ui components - Framer Motion animations - React Router v6 - React Query (TanStack Query) - React Helmet Async (SEO) - Hosted on Render (auto-deployed via GitHub from Lovable) ### Backend (Lovable Cloud / Supabase) - PostgreSQL database - Edge Functions (Deno) - Row Level Security (RLS) policies - Realtime subscriptions - File storage ### Integrations - Twilio (WhatsApp Business API) - LemonSqueezy (payments & subscriptions, including $4.99 cookbook one-time) - Apify (web scraping fallbacks for Instagram, Pinterest, etc.) - Tikwm / Jina (lightweight social scrapers — public data only) - Google Cloud Vision (OCR) - Lovable AI Gateway (Gemini 2.5 Pro for extraction & safety analysis) - OpenAI Whisper (WhatsApp voice transcription) - Resend (transactional email) - Google reCAPTCHA v3 (bot protection, soft-fail on edge functions) ## Database Schema (Public Tables) - `user_profiles`: User account data, WhatsApp phone, subscription status & type (regular/family), baby info, onboarding_status (allowed: 'complete' or 'batch_upload' — never 'completed') - `recipes`: Extracted recipes with ingredients, instructions, age appropriateness, safety flags - `family_groups`: Family plan groups with shared baby profile, invite tokens, member limits - `family_members`: Links users to family groups with roles (owner/member) - `conversation_state`: WhatsApp conversation flow state - `cookbook_access_tokens`: Shareable cookbook tokens (private link reconstruction) - `trial_reminders`: Trial expiration notification tracking - `trial_messages_sent`: WhatsApp trial message log - `extraction_events`: Recipe extraction analytics and tracking - `tiktok_extraction_counts`: TikTok extraction usage per billing period - `daily_extraction_counts`: Daily extraction limits for coupon users - `coupons`: Discount codes with custom trial durations - `error_logs`: System error tracking - `batch_cookbooks` / `batch_recipes` / `batch_sessions`: Organize tool screenshot upload sessions ## Edge Functions (API Endpoints) ### WhatsApp & Recipes - `whatsapp-webhook`: Handles incoming WhatsApp messages - `extract-recipe`: Extracts recipe from URL/caption using AI - `get-cookbook`: Retrieves user's cookbook via token - `delete-recipe`: Removes recipe from cookbook - `safety-check`: Free Safety Checker tool backend (returns 200 OK with `rate_limited: true` flag instead of 429) - `safety-warm-cache`: Pre-warms safety check cache for popular recipes ### Organize Tool - `create-batch-session`: Starts a screenshot upload session - `get-batch-preview`: Restores existing session by token - `process-batch-image`: Per-image AI extraction + safety check - `create-batch-checkout`: $4.99 LemonSqueezy checkout for cookbook - `convert-batch-to-user`: Converts batch user to full WhatsApp account post-payment ### Auth, Payments & Email - `upsert-profile`: Creates/updates user profile - `verify-recaptcha`: Bot protection - `create-checkout`: Initiates LemonSqueezy subscription checkout - `lemon-squeezy-webhook`: Processes subscription events - `lemonsqueezy-sync`: Manual sync helper - `send-welcome-email`: Onboarding email - `send-cookbook-email`: Sends digital cookbook link - `send-safety-report`: Emails safety check results - `send-contact-email`: Contact form submissions (Resend) - `trial-reminders`: Scheduled trial expiration notifications - `unsubscribe`: Email preference management - `family-invite`: Generates/redeems family invite tokens ### Admin & Misc - `admin-analytics`: Internal extraction analytics - `extraction-digest`: Daily summary of extraction events - `upload-logo`: Custom branding upload ## Pages & Routes ### Marketing & Conversion - `/` — Homepage (Hero with dual CTAs "Try 3 Recipes Free" + "Organize My Recipes", How It Works with embedded tool, Problem, Solution, Testimonials, Pricing Teaser, FAQ) - `/pricing` — Plan comparison: free tier banner, Personal ($7/mo) vs Family ($9/mo) side-by-side, how-it-works steps, partner nudge ("Add partner for $2 more"), testimonials, FAQ link - `/faq` — Standalone FAQ page with categorized sections (Getting Started, Platforms, Safety, Pricing, Organize tool) - `/contact` — Contact form (Resend) - `/partners` — Partner landing page ### Product Tools - `/organize` — Screenshot-to-Cookbook tool. Upload up to 15 baby food recipe screenshots, AI extracts each, $4.99 one-time payment for the digital cookbook. Includes "How It Works" visual (Upload → Safety Check → Cookbook), embedded YouTube demo, secondary CTA to share Instagram/TikTok saves to WhatsApp bot. Sessions expire after 7 days. - `/cookbook` — User's recipe collection with Recipes and Grocery List tabs (token-gated) - `/demo-cookbook` — Public demo cookbook with pre-selected recipes and grocery list preview ### Safety Directory - `/safety` — Baby food safety directory (CollectionPage) with free Safety Checker tool. 1 free check per 24 hours per IP. Social media URLs (TikTok, Instagram, YouTube) redirect to WhatsApp bot for full video analysis. - `/safety/avocado` — Avocado: BLW prep, choking risk, latex link - `/safety/peanut` — Peanut: AAP early-introduction guidelines, allergy prevention - `/safety/egg` — Egg: yolk + white from 6 months, allergy signs - `/safety/honey` — Honey: 12-month rule, infant botulism risk - `/safety/strawberry` — Strawberry: prep by age, allergy info - `/safety/fish` — Fish: mercury guidance, omega-3 benefits - `/safety/dairy` — Dairy: yogurt/cheese vs cow's milk timing - `/safety/wheat` — Wheat: gluten introduction, celiac considerations Each safety topic page includes: hero with YouTube facade video, age recommendation, preparation tips by age, choking/allergy warnings, nutrition highlights, FAQ accordion (JSON-LD FAQPage), pro tip, example recipes from trusted sources, sources block (AAP/CDC), and embedded Safety Checker tool. ### Auth & Account - `/auth` — Authentication (login/signup, Google OAuth) - `/unsubscribe` — Email unsubscribe - `/privacy` — Privacy policy - `/terms` — Terms of service (includes takedown clause) ### Internal/Admin - `/analytics` — Extraction analytics dashboard - `/grocery-mockup`, `/color-preview`, `/test-email`, `/upload-logo` — Internal tools ## Safety Checker Tool The `/safety` directory features a free recipe safety checker: - Paste any recipe URL to check for allergens, choking hazards, and age-appropriateness - 1 free check per 24 hours per IP (rate limited — returns 200 OK with `rate_limited: true` flag, never 429) - Social media URLs (TikTok, Instagram, YouTube) redirect to WhatsApp bot for full video analysis - Results include age badge, allergen flags, choking hazards, preparation tips - All results include a non-dismissible medical disclaimer - Deep link integration: clicking WhatsApp CTA sends "I want to safety check this recipe: [URL]" which triggers onboarding + auto-extraction - Data retention: safety check results stored for 7 days max ## User Flow ### WhatsApp-First Flow (Free Tier — Primary Funnel) 1. User sends recipe link/photo to WhatsApp bot directly (or clicks "Try 3 Recipes Free" CTA) 2. System creates profile automatically 3. User gets 3 free recipe extractions (no credit card) 4. After 3 recipes, prompted to start 7-day trial (credit card required) ### Organize Flow (One-Time Cookbook) 1. User visits `/organize` 2. Uploads up to 15 recipe screenshots from camera roll 3. AI extracts each recipe with allergen/safety checks 4. Sees CookbookPreview with first recipe full + others blurred behind sticky paywall 5. Pays $4.99 one-time via LemonSqueezy 6. Receives digital cookbook + WhatsApp transfer option (wa.me link to continue on WhatsApp) 7. Welcome email sent if user skips WhatsApp connection ### Subscription Flow (Trial) 1. User signs up with email + WhatsApp number, or upgrades from free tier 2. Redirected to LemonSqueezy checkout for 7-day trial (credit card required) 3. Welcome email sent 4. User sends recipe links/photos to WhatsApp bot 5. Trial reminder emails sent at 3-day and 1-day marks 6. Subscription auto-converts after trial ## Recipe Extraction Process 1. User sends message to WhatsApp bot (URL, caption, or media) 2. `whatsapp-webhook` receives message and resolves any short/redirect URLs 3. `extract-recipe` function: - Detects platform (TikTok, Instagram, YouTube, Facebook, Pinterest, website) - Scrapes content with platform-specific fallback chain (Tikwm/Jina → Apify) - Performs OCR on images/carousels (Google Vision + Gemini Flash) - For Hebrew or text-only content: skips visual processing - Extracts structured recipe via Gemini 2.5 Pro - Validates age appropriateness and safety (AAP/CDC guidelines) - Confidence scoring flags partial extractions 4. Recipe saved to database with user association 5. Confirmation sent via WhatsApp ## Subscription Model ### Free Tier - 3 free recipe extractions (no credit card required) - Personal cookbook access - Basic safety checks - No account needed — just message the bot ### Personal Plan — $7/month - 1 WhatsApp number - Unlimited recipe extractions from all platforms (Instagram Reels, YouTube Shorts, TikTok, Facebook, Pinterest, websites, screenshots) - Age & allergen AI safety filtering - Personal cookbook + grocery lists - 7-day free trial (credit card required to start) ### Family Plan — $9/month (Most Popular) - Up to 3 WhatsApp numbers (partner, nanny, grandparent) - Unlimited recipes + priority AI extraction (faster, including screenshots) - Safety checks for all family members - Synced family cookbook (everyone sees the same recipes) - Shared grocery lists for collaborative meal planning - Family invite system via WhatsApp commands - Shared monthly extraction count (60 recipes/month soft cap) - Family reminders suppressed for free members ### One-Time: Organize Cookbook — $4.99 - Available at `/organize` - Upload up to 15 recipe screenshots - AI extraction + safety/allergen checks - Digital cookbook delivered (web + WhatsApp transfer option) - No subscription required ### Payment & Status - **Payment**: LemonSqueezy (subscriptions + one-time) - **Trial**: 7-day free trial for subscriptions - **Status tracking**: `subscription_status` enum (active, past_due, cancelled, trialing, inactive, free_tier) - **Polling**: Post-checkout polling with 90-second timeout UI - **Coupons**: Custom trial durations and discount upgrades ### Family Invite System - Family plan owners use `invite` command to generate 7-day invite links - Recipients join via `join [token]` WhatsApp command - All family members share the same cookbook and baby profile ## CTAs Across the Site - **Hero (Homepage)**: "Try 3 Recipes Free" (primary, opens WhatsApp) + "Organize My Recipes" (secondary, → /organize) - **Pricing page**: "Start 7-day free trial" (Personal) + "Start Family Trial – 7 days free" (Family) + green "Try free" pill in 3-recipes banner - **Organize page**: Sticky payment bar with "Get my cookbook for $4.99" after first successful extraction - **Safety pages**: "Check this recipe" (Safety Checker) + WhatsApp deep-link CTA on social URLs - **Cookbook**: WhatsApp share link for Instagram/TikTok saves - **Footer**: WhatsApp CTA + pricing/FAQ/contact links ## SEO Implementation - Per-route prerendered HTML via custom Vite plugin (`scripts/prerender-plugin.ts`) — each route ships real ``, meta description, canonical, and Open Graph tags in the initial HTML response (faster LCP, AI-bot friendly) - Semantic HTML structure (`<main>`, `<article>`, `<header>`) - JSON-LD structured data: FAQPage, Organization, WebApplication (Organize), Product/Offer (Pricing), BreadcrumbList, VideoObject (Safety topics with YouTube) - Single H1 per page, canonical URLs, Open Graph + Twitter Card metadata - sitemap.xml + robots.txt - Internal linking strategy across safety topics (relatedSlugs) - YouTube facade pattern defers heavy iframe loads ## Design System - Color palette: Navy `#0E326A` primary, Sky Blue `#91BEF9` secondary, Blush `#E9C5C1` accent - HSL color tokens in `src/index.css` - Semantic color variables (primary, secondary, accent, muted, etc.) - Dark/light mode support - Responsive breakpoints - Custom gradients and animations - Bold lead-in phrases, no em/en dashes, mobile CTAs centered ## Security & Privacy - Row Level Security (RLS) on all tables - JWT-based authentication - WhatsApp phone verification - reCAPTCHA v3 bot protection (soft-fail on edge functions) - Secure webhook validation (Twilio signature, LemonSqueezy signature) - User roles stored in separate `user_roles` table with `has_role()` SECURITY DEFINER function (never on profiles) - Third-party scrapers (Tikwm, Jina) used only for public, non-PII content - Cookbook access via tokens (private link reconstruction) - Cookie consent integrated with GTM Consent Mode - Family data: group-wide visibility for shared cookbook/grocery list - Safety check data retained for 7 days ## Environment Variables - `VITE_SUPABASE_URL`: Supabase project URL - `VITE_SUPABASE_PUBLISHABLE_KEY`: Public Supabase key - `VITE_RECAPTCHA_SITE_KEY`: Google reCAPTCHA site key - Backend secrets (Twilio, LemonSqueezy, Resend, Apify, Google Cloud, OpenAI, Lovable AI) managed via Supabase Edge Function Secrets ## Component Architecture ### Key Components - `Hero`: Landing page hero with dual CTAs (WhatsApp + Organize) and animated chat mockup - `Problem`, `Solution`, `HowItWorks`: Marketing sections - `Testimonials`: Social proof - `FAQ`: Accordion-based Q&A with JSON-LD FAQPage - `PricingTeaser`: Compact pricing preview on homepage - `SafetyChecker`: Free recipe safety check tool (used on /safety and topic pages) - `SourcesGuidelines`: AAP/CDC sources block above FAQ on safety pages - `SampleSafetyReport`: Example safety check output - `AnimatedWhatsAppChat`: Interactive chat mockup - `Navigation`: Responsive header with auth state - `Footer` / `LazyFooter`: Links and branding (lazy-loaded) - `CookieConsent`: GTM Consent Mode banner - `YouTubeFacade`: Performance-optimized video embed ### Organize Tool Components - `UploadZone`: Drag-and-drop / file picker for screenshots - `ImageThumbnailGrid`: Per-image status (queued/compressing/uploading/success/failed) - `CookbookPreview`: First recipe full + remaining blurred (paywall) - `StickyPaymentBar`: Persistent $4.99 CTA after first extraction - `PostPaymentFlow`: Cookbook delivery + WhatsApp transfer - `SessionExpired`: Friendly expired-session screen - `HowItWorksVisual`: 3-step icon row (Upload → Safety Check → Cookbook) - `SavedRecipesCTA`: Secondary CTA pointing IG/TikTok savers to WhatsApp bot ### UI Components (shadcn/ui) - Button, Input, Card, Accordion, Dialog, Sheet, Toast, Alert, Form components, Navigation components ## WhatsApp Commands - Send recipe URL or photo to extract and save - `grocery` — Generate grocery list from recent recipes - `help` — Show available commands and instructions - `cookbook` — Get link to web cookbook - `invite` — (Family Plan only) Generate invite link to share with partner/caregiver - `join [token]` — Join a family group using invite token ## Business Model B2C SaaS targeting parents of babies (6-24 months) who want: - Convenient recipe discovery via WhatsApp (no app download) - Age-appropriate meal planning - Safe ingredient verification - Personal recipe organization - One-time digital cookbook for camera-roll screenshot organizers (Organize tool) ## Target Audience - New parents with babies starting solids - Tech-savvy millennials/Gen Z parents - Users comfortable with WhatsApp - Health-conscious families - Primarily English-speaking markets, with multilingual extraction support ## Competitive Advantages - WhatsApp-native experience (no app download) - AI-powered recipe extraction from any source (TikTok, Instagram, YouTube, Pinterest, websites, screenshots) - Automatic age-appropriateness validation against AAP/CDC guidelines - Safety warnings for common allergens and choking hazards - Smart grocery lists with ingredient aggregation - 3 free recipes to try without credit card - Standalone $4.99 Organize tool — no subscription needed for one-off cookbook creation - Free public Safety Checker + 8 in-depth allergen guides ## Grocery List Feature Browser-based feature in the Cookbook: - Select recipes from your cookbook to generate an aggregated ingredient list - Smart quantity merging (e.g., "2 eggs" + "3 eggs" = "5 eggs") - Add custom items not from recipes - Automatic ingredient categorization (produce, dairy, proteins, etc.) - Copy List button for easy sharing via messaging apps - Checked items move to a collapsible "completed" section - State persists during browser session when switching tabs - Family plans: shared grocery list across all members --- Last updated: 2026-05-04 Technology: React, TypeScript, Vite (with prerender), Lovable Cloud, Twilio WhatsApp API, LemonSqueezy Hosting: Render (auto-deployed via GitHub from Lovable)