A complete AI-powered chatbot embed system with React frontend and Vercel serverless functions, designed to work both locally and in production.
- π€ AI-Powered Chatbots: Integration with OpenRouter API for intelligent responses
- π Embeddable Widgets: Easy-to-integrate chatbot scripts for any website
- π± React Frontend: Modern, responsive UI for managing chatbots
- β‘ Serverless Backend: Vercel serverless functions for scalable API
- ποΈ Supabase Database: PostgreSQL database with Row Level Security
- π Vercel Deployment: Production-ready deployment configuration
- π¨ Customizable Themes: Beautiful, customizable chatbot designs
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β React App β β Vercel Serverlessβ β Supabase β
β (Frontend) βββββΊβ Functions βββββΊβ (Database) β
β β β β β β
β β’ Export Page β β β’ Chat API β β β’ Embed Configs β
β β’ Chatbot UI β β β’ Embed Scripts β β β’ Conversations β
β β’ Settings β β β’ Analytics β β β’ Messages β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
- Node.js 18+
- npm or yarn
- Supabase account
- OpenRouter API key
git clone <your-repo>
cd t3dotgg-launchpad
npm installCreate a .env.local file in your project root:
# AI API Configuration
VITE_OPENROUTER_API_KEY=your_openrouter_api_key
# Clerk Authentication
VITE_CLERK_PUBLISHABLE_KEY=your_clerk_key
# Supabase Configuration
VITE_SUPABASE_URL=your_supabase_url
VITE_SUPABASE_ANON_KEY=your_supabase_anon_key# Start React development server
npm run devnpm run build- React App: http://localhost:8080
- Export Page: http://localhost:8080/export
- Health Check: http://localhost:8080/health (after deployment)
- Push to GitHub:
git add .
git commit -m "Ready for production deployment"
git push origin main- Deploy to Vercel:
vercel --prod- Set Environment Variables in Vercel dashboard:
OPENROUTER_API_KEYSUPABASE_URLSUPABASE_ANON_KEYNODE_ENV=production
- Main Website: https://lux-llm-prod.vercel.app/
- Export Page: https://lux-llm-prod.vercel.app/export
- Chat API: https://lux-llm-prod.vercel.app/api/public-chat
- Health Check: https://lux-llm-prod.vercel.app/health
- Embed Scripts: https://lux-llm-prod.vercel.app/api/embed/[code].js
- Embed Preview: https://lux-llm-prod.vercel.app/api/embed/[code]
βββ src/ # React source code
β βββ pages/ # Page components
β β βββ Export.tsx # Chatbot export page
β β βββ Index.tsx # Home page
β β βββ ... # Other pages
β βββ components/ # Reusable components
β βββ lib/ # Utilities and services
βββ api/ # Vercel serverless functions
β βββ public-chat.js # Chat API endpoint
β βββ health.js # Health check endpoint
β βββ embed/ # Embed-related endpoints
β βββ [embedCode].js # Dynamic embed script
β βββ [embedCode]/ # Dynamic embed preview
β index.js
βββ public/ # Static assets
βββ vercel.json # Vercel configuration
βββ vite.config.ts # Vite configuration
βββ package.json # Dependencies and scripts
| Script | Description |
|---|---|
npm run dev |
Start React development server |
npm run build |
Build React app for production |
npm run preview |
Preview production build |
npm run start |
Start production preview server |
npm run lint |
Run ESLint |
- Run the schema script in your Supabase SQL editor:
-- Run supabase_embeds_schema.sql-
Create your first embed using the Export page
-
Test the embed by visiting
/api/embed/[your-embed-code]
POST /api/public-chat
Content-Type: application/json
{
"embedCode": "your-embed-code",
"message": "Hello, how are you?",
"sessionId": "unique-session-id"
}
GET /api/embed/[embedCode].js
GET /api/embed/[embedCode]
GET /api/health
The embed scripts are dynamically generated with customizable:
- Colors and styling
- Position and size
- Welcome messages
- Typing indicators
Update the system prompt in the Export page or modify the API functions for:
- Different AI personalities
- Response styles
- Context handling
-
"Cannot GET /" Error
- Ensure Vercel is configured to serve React app for main routes
- Check that
vercel.jsonhas correct routing
-
Embed Script Not Loading
- Verify the serverless functions are deployed
- Check CORS headers in production
- Ensure embed code exists in database
-
AI Responses Not Working
- Verify OpenRouter API key is set in Vercel
- Check API rate limits
- Ensure network connectivity
# Check React app logs
npm run dev
# Test API endpoints (after deployment)
curl https://your-domain.vercel.app/api/healthThe system now uses Vercel's serverless functions instead of a traditional Express server:
/api/public-chat.js: Handles AI chat requests/api/health.js: System health monitoring/api/embed/[code].js: Dynamic embed script generation/api/embed/[code]/index.js: Embed preview pages
This approach provides:
- β Better scalability - Automatic scaling based on demand
- β Cost efficiency - Pay only for actual usage
- β Simpler deployment - No server management needed
- β Global edge - Faster response times worldwide
- Fork the repository
- Create a feature branch
- Make your changes
- Test locally and in production
- Submit a pull request
This project is licensed under the ISC License.
Made with β€οΈ by LuxLLM Team