A low-latency AI pharmacist assistant that converts chat queries into high-value iHerb commissions.
- Frontend: Next.js 15 (App Router), Tailwind CSS
- Backend Infrastructure: Cloudflare Workers (Edge Computing)
- Data Persistence: Cloudflare Workers KV (Key-Value Store)
- AI Model: DeepSeek-V3 (via OpenRouter)
- Affiliate Integration: Impact.com (iHerb program; direct iHerb links until tracking is live)
- Install dependencies:
pnpm install- Copy the environment variables:
cp .env.example .env-
Fill in your environment variables in
.env:DEEPSEEK_API_KEY: Your DeepSeek API keyIMPACT_ACCOUNT_SIDandIMPACT_AUTH_TOKEN: Impact.com API (server-side / scripts only)NEXT_PUBLIC_SITE_URL: Your site URL (for development:http://localhost:3000)
-
Run the development server:
pnpm dev- Open http://localhost:3000 in your browser.
swiftherb/
├── app/ # Next.js App Router
│ ├── api/ # API routes
│ ├── layout.tsx # Root layout
│ ├── page.tsx # Home page
│ └── globals.css # Global styles
├── components/ # React components
│ ├── Header.tsx # Sticky header with logo
│ ├── ChatInterface.tsx # Main chat UI
│ ├── MessageBubble.tsx # Message display component
│ ├── ChatInput.tsx # Chat input component
│ ├── ProductCard.tsx # Product display card
│ └── DisclaimerBar.tsx # Fixed disclaimer bar
├── lib/ # Utility functions
│ ├── ai.ts # AI integration (OpenRouter)
│ ├── kv.ts # Cloudflare KV operations
│ ├── admitad.ts # Admitad link generation
│ └── affiliate.ts # Unified affiliate link generator
└── SWIFTHERB_MASTER_PLAN.md # Project master plan
- AI-Powered Chat: Conversational interface powered by DeepSeek-V3
- Product Recommendations: AI suggests products wrapped in
[[Double Brackets]] - Affiliate Links: Automatic Admitad deep linking for all product recommendations
- Safety Features: Emergency keyword detection for medical emergencies
- Wellness Stacks: AI suggests multiple products for higher cart values
- Set up Cloudflare Workers and KV namespace
- Populate KV store with product data
- Implement product metadata fetching from KV
- Add error handling and loading states
- Deploy to Cloudflare Pages
Private project - All rights reserved