How codewithmuh/shopagent works
ShopAgent is a multi-tenant shopping assistant: shoppers converse with Leo to find products and place or track orders; merchants connect Shopify to populate the catalog; companies embed the agent and authorize payments through webhooks. The graph preserves these workflows plus voice, merchant operations, and company access. Edges rely on README statements, shown excerpts, or SOURCE INDEX references; unsampled implementations and uncertain links are omitted.
Main entry points: tools.py Shopping tools · shopify.py Shopify sync · ChatWidget.tsx Shopper chat · webhooks.py Payment webhooks
Components 23
Shopper experience
- Shopper chat
frontend/src/components/chat/ChatWidget.tsx - Voice mode
frontend/src/components/chat/VoiceMode.tsx - WebSocket client
frontend/src/lib/websocket.ts
Agent and commerce
- Agent consumer
backend/agent/consumers.py - Claude tool loop
backend/agent/agent.py - Conversation memory
backend/agent/memory.py - Shopping tools
backend/agent/tools.py - Product catalog
backend/products/models.py - Users and addresses
backend/users/models.py - Orders
backend/orders/models.py
Merchant catalog
- Merchant
backend/merchants/models.py - Merchant portal
frontend/src/app/merchant/connections/page.tsx - Merchant API
backend/merchants/views.py - Shopify sync
backend/integrations/shopify.py
Company integration
- Company portal
frontend/src/app/portal/dashboard/page.tsx - API key authentication
backend/companies/authentication.py - Company and usage
backend/companies/models.py - Payment webhooks
backend/integrations/webhooks.py
Other components
- Shopper
- Shopify
- Image storage
- Company operator
- Host application
Connections 24
- Shopper → Shopper chat: chats with
README.md - Shopper chat → WebSocket client: sends messages
- WebSocket client → Agent consumer: opens WebSocket
README.md - Agent consumer → Claude tool loop: dispatches to
backend/agent/consumers.py - Claude tool loop → Shopping tools: uses tools
README.md - Agent consumer → Conversation memory: references
backend/agent/consumers.py - Shopping tools → Product catalog: accesses catalog
backend/agent/tools.py - Shopping tools → Users and addresses: manages users
backend/agent/tools.py - Shopping tools → Orders: handles orders
backend/agent/tools.py - Voice mode → Shopper chat: adds voice
README.md - Shopper chat → Voice mode: offers voice mode
README.md - Merchant → Merchant portal: manages store
README.md - Merchant portal → Merchant API: connects Shopify
README.md - Merchant API → Shopify sync: starts sync
backend/merchants/views.py - Shopify sync → Shopify: fetches products
backend/integrations/shopify.py - Shopify sync → Product catalog: updates products
backend/integrations/shopify.py - Shopify sync → Image storage: stores images
backend/integrations/shopify.py - Company operator → Company portal: manages integration
README.md - Company portal → API key authentication: uses credentials
README.md - API key authentication → Company and usage: validates company
backend/companies/authentication.py - Company and usage → Payment webhooks: configures payments
README.md - Shopping tools → Payment webhooks: requests payment checks
backend/agent/tools.py - Payment webhooks → Host application: sends signed events
backend/integrations/webhooks.py - Payment webhooks → Company and usage: logs webhook
backend/integrations/webhooks.py