The chatbot embeds as a Next.js widget into the Shopify storefront (the client didn't want a Shopify-native integration because they're more constrained). The Shopify Storefront API gives real-time product data (price, stock) to the bot, so recommendations are always current.
The pipeline: user query → embedding (OpenAI text-embedding-3-small) → pgvector top-k (k=8) retrieval → context for GPT-4o → response generation with source links. Every interaction is logged in PostHog (anonymized), and Sentry tracks backend errors.
An n8n workflow syncs the Shopify catalogue into the pgvector index daily: embedding new products, re-embedding updated descriptions, removing deleted ones. The index lags 2–3 hours behind the catalogue — acceptable trade-off between real-time queries and embedding cost.