How kevin-khoamai/chat-affiliate-hub works
Project Type & Purpose
• This is a full-stack affiliate-marketing Chat DApp with real-time group/1:1 messaging and an AI assistant powered by Retrieval-Augmented Generation (RAG).
• Frontend: React 18 + TypeScript, Vite, Tailwind CSS, Shadcn/ui.
• Backend: Supabase (Auth, PostgreSQL + pgvector, Edge Functions) implementing message storage, RLS, and RAG pipeline.
• External integrations: OpenAI embeddings API, n8n webhook service, and a future Ethereum integration via Wagmi/Hardhat/IPFS.
File Structure Analysis
• src/
– components/: UI building blocks (chat interfaces, AuthModal, RAG chat).
– integrations/supabase: supabase client wrapper & types.
– lib/: blockchain stubs, crypto utils, supabase utilities.
– services/: RAG services (embedding, LLM, vector store), n8n webhook.
– hooks/: mobile detection, toast notifications.
– pages/: entry points (Index, NotFound).
– main.tsx, App.tsx: application bootstrap.
• public/: static assets (robots.txt, index.html).
• supabase/:
– config.toml, migrations/: schema for users/messages/campaigns/academy.
– functions/: serverless endpoints (chat-rag, message-processor).
• Config files: tailwind.config.ts, vite.config.ts, tsconfig*.json, eslint.config.js.
README Highlights
• Real-time chat with Supabase subscriptions.
• RAG chat: mock now, production via pgvector + OpenAI embeddings.
• Auth: Email + Google OAuth.
• Database: PostgreSQL with RLS policies on messages table.
• Edge Functions placeholders for send-message, query-campaign, query-academy.
• Future blockchain module: smart contract for message hashes, Wagmi wallet, Hardhat tooling.