How shopify/shop-chat-agent works
Project type and purpose
• This is a full-stack Shopify template application that embeds an AI-powered chat widget on a storefront.
• The backend is a Remix server that acts as an MCP (Model Context Protocol) client and processes chat messages.
• The frontend is a Shopify theme extension (“chat-bubble”) that delivers the chat UI to end customers.
File structure
Top-level directories and files:
• app/
• auth.server.js, db.server.js, entry.server.jsx – core server setup
• mcp-client.js – initializes Shopify MCP tools (product search, cart actions, order lookup)
• routes/ – Remix route handlers for auth, webhooks, chat endpoints
• services/ – encapsulated logic for Claude integration, streaming responses, Shopify tool calls
• prompts/ – base prompts for LLM calls
• extensions/chat-bubble/
• assets/ (chat.js, chat.css) – static front-end code for the widget
• blocks/ – Liquid template to mount the widget in Shopify theme
• shopify.extension.toml – theme extension config
• prisma/ – SQLite schema and migrations for session storage
• shopify.app.toml, shopify.web.toml – Shopify app configs
• remix.config.js, vite.config.js – build and dev server configurations
README for additional insights
• Architecture summary confirms two main components: “Backend” (Remix app) and “Chat UI” (theme extension).
• Tech stack: Remix, Claude by Anthropic, @shopify/shopify-app-remix, SQLite via Prisma.
• Describes MCP tools integration, tunnels/local dev, and endpoints (/chat).