An AI-powered conversational commerce assistant for food, groceries & dining
Built with OpenAI GPT-4o · MCP-Compatible Tools · Real-time WebSocket Streaming
Features · Quick Start · Demo · Architecture · Tech Stack
🤖 AI Chat — Natural language ordering powered by GPT-4o with function calling
🎤 Voice Input — Speech-to-text & text-to-speech for hands-free interaction
🍔 Food Ordering — Search restaurants, browse menus, add to cart, place orders
🛒 Instamart — Search & compare grocery products, add to cart
🍽️ Dineout — Check table availability, view offers, book reservations
🔧 12 MCP Tools — Model Context Protocol-compatible tool system
⚡ Real-time Streaming — Token-by-token response streaming via WebSocket
🧠 Conversation Memory — Multi-turn context across complex ordering flows
📱 Mobile-First UI — Dark mode, Swiggy-branded, PWA-ready
🐛 Debug Panel — Live tool call inspector for developers
- Node.js v18+
- OpenAI API Key
git clone https://github.com/YOUR_USERNAME/swiggy-ai-copilot.git
cd swiggy-ai-copilotcp .env.example .envOpen .env and paste your OpenAI API key:
OPENAI_API_KEY=sk-proj-your-key-here
PORT=3001
NODE_ENV=development
# Install server dependencies
cd server
npm install
# Install web app dependencies
cd ../apps/web
npm installOpen two terminals:
Terminal 1 — Backend:
cd server
npm run devTerminal 2 — Frontend:
cd apps/web
npm run devNavigate to http://localhost:5173 and start chatting!
💡 Pro tip: On iPhone, open in Safari and tap Share → Add to Home Screen for a native app experience.
You: "Is Burger King open?"
AI: ✅ Burger King is open until 11:30 PM. Delivery in 25-30 min.
You: "Do they have chicken whopper?"
AI: Yes! Chicken Whopper is ₹249. Want to add it?
You: "Add 2 to cart"
AI: 🛒 Added 2x Chicken Whopper. Total: ₹498
You: "What's my total?"
AI: ₹552 (Subtotal ₹498 + GST ₹25 + Delivery ₹29)
You: "Place order, deliver to home, pay with UPI"
AI: ✅ Order #SWG-XXXXX confirmed! Arriving in 30 min.
You: "Find oat milk on Instamart"
AI: Found 3 options: Oatly (₹399), Raw Pressery (₹249)...
You: "Compare prices"
AI: 💰 Raw Pressery is cheapest at ₹249/L
You: "Add 2 cartons of Raw Pressery"
AI: 🛒 Added to Instamart cart!
You: "Book a table at Toscano for 4 tomorrow at 8 PM"
AI: 🍽️ Table available! Offers: 20% off with DINEOUT20
You: "Reserve it"
AI: ✅ Reservation #DIN-XXXXX confirmed!
┌─────────────────────────────────────────────────────────────┐
│ Web App (Vite + React) │
│ http://localhost:5173 │
│ │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌─────────────┐ │
│ │ Chat │ │ Voice │ │ Cart │ │ Debug │ │
│ │ Screen │ │ Screen │ │ Screen │ │ Panel │ │
│ └────┬─────┘ └────┬─────┘ └────┬─────┘ └─────────────┘ │
│ │ │ │ │
│ └──────────────┼──────────────┘ │
│ │ │
│ ┌───────┴───────┐ │
│ │ Zustand │ │
│ │ + Socket.IO │ │
│ └───────┬───────┘ │
└──────────────────────┼───────────────────────────────────────┘
│ WebSocket
┌──────────────────────┼───────────────────────────────────────┐
│ │ Backend (Node.js + Express) │
│ http://localhost:3001 │
│ │
│ ┌───────────────────┴──────────────────┐ │
│ │ AI Orchestrator (GPT-4o) │ │
│ │ Streaming + Agentic Tool Loop │ │
│ └───────────────────┬──────────────────┘ │
│ │ │
│ ┌────────────────┼────────────────┐ │
│ │ │ │ │
│ ┌──┴───┐ ┌─────┴────┐ ┌─────┴────┐ │
│ │ Food │ │ Instamart│ │ Dineout │ │
│ │6 tools│ │ 3 tools │ │ 3 tools │ │
│ └──┬───┘ └─────┬────┘ └─────┬────┘ │
│ └────────────────┼────────────────┘ │
│ │ │
│ ┌───────┴───────┐ │
│ │ Mock Data │ │
│ │ (JSON files) │ │
│ └───────────────┘ │
└──────────────────────────────────────────────────────────────┘
The backend exposes 12 tools using the Model Context Protocol pattern with Zod-validated schemas:
| # | Tool | Service | Description |
|---|---|---|---|
| 1 | check_restaurant_open |
Food | Check if a restaurant is open & get info |
| 2 | search_menu_item |
Food | Search menu by item name or category |
| 3 | add_to_cart |
Food | Add items to the food cart |
| 4 | get_cart_total |
Food | Calculate total with GST & delivery |
| 5 | confirm_address |
Food | Get/select delivery address |
| 6 | place_order |
Food | Place order with payment method |
| 7 | search_product |
Instamart | Search grocery products |
| 8 | compare_prices |
Instamart | Compare product prices |
| 9 | add_instamart_cart |
Instamart | Add items to Instamart cart |
| 10 | check_table_availability |
Dineout | Check reservation availability |
| 11 | fetch_offers |
Dineout | Get restaurant offers & deals |
| 12 | reserve_table |
Dineout | Book a table reservation |
Each tool is defined with:
- Zod schema for input validation
- Handler function with business logic
- Auto-generated OpenAI function definitions
| Layer | Technology |
|---|---|
| AI | OpenAI GPT-4o, Function Calling |
| Backend | Node.js, Express, TypeScript |
| Real-time | Socket.IO (WebSocket) |
| Frontend | React 19, Vite, TypeScript |
| State | Zustand |
| Validation | Zod |
| Voice | Web Speech API (STT + TTS) |
| Data | Mock JSON (8 restaurants, 60+ items) |
swiggy-ai-copilot/
├── .env.example # Environment template
├── .gitignore
├── package.json # Monorepo root
│
├── mock-data/ # Realistic Swiggy-style data
│ ├── restaurants.json # 8 Bangalore restaurants
│ ├── menus.json # 60+ menu items with prices
│ ├── instamart.json # 25 grocery products
│ ├── dineout.json # 5 dine-in venues with slots
│ └── users.json # Mock user profiles
│
├── server/ # Node.js backend
│ ├── package.json
│ ├── tsconfig.json
│ └── src/
│ ├── index.ts # Express + Socket.IO entry
│ ├── config.ts # Environment config
│ ├── agents/
│ │ ├── orchestrator.ts # GPT-4o agentic loop
│ │ └── memory.ts # Session state manager
│ ├── prompts/
│ │ └── system.ts # System prompt
│ ├── tools/
│ │ ├── registry.ts # MCP tool registry
│ │ ├── food/ # 6 food tools
│ │ ├── instamart/ # 3 grocery tools
│ │ └── dineout/ # 3 reservation tools
│ ├── services/
│ │ └── dataService.ts # Data access layer
│ ├── api/ # REST endpoints
│ └── websocket/
│ └── handler.ts # Socket.IO handler
│
└── apps/web/ # React frontend
├── package.json
├── index.html
└── src/
├── App.tsx # App shell + tab navigation
├── index.css # Full design system
├── lib/
│ ├── socket.ts # Socket.IO client
│ └── tts.ts # Text-to-speech engine
├── store/
│ └── chatStore.ts # Zustand state management
├── screens/
│ ├── ChatScreen.tsx # Chat with streaming
│ ├── VoiceScreen.tsx # Voice with animated orb
│ └── CartScreen.tsx # Cart with checkout
└── components/
├── RichCards.tsx # Order/reservation cards
└── DebugPanel.tsx # Developer debug panel
| Method | Endpoint | Description |
|---|---|---|
GET |
/health |
Server health + tool list |
POST |
/api/chat |
Send message, get AI response |
POST |
/api/auth/login |
Mock authentication |
POST |
/api/voice/token |
Get voice session token |
WS |
/ |
Real-time streaming via Socket.IO |
curl -X POST http://localhost:3001/api/chat \
-H "Content-Type: application/json" \
-d '{"message": "Is Burger King open?"}'- Dark Mode — Swiggy-branded dark theme (#FC8019 accent)
- Glassmorphism — Frosted glass effects on navigation
- Micro-animations — Message entrance, typing indicator, tool shimmer
- Rich Cards — Order confirmation with status tracker, reservation cards
- Voice Orb — Animated orb with 4 states (idle, listening, processing, speaking)
- Debug Panel — Click 🐛 to inspect tool calls, context, and messages
- PWA Ready — Add to home screen for native iPhone experience
MIT
Built with ❤️ as a demo of Conversational Commerce + MCP