Skip to content

Bhanudahiyaa/LuxLLMProd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

105 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ LuxLLM - AI Chatbot Embed System

A complete AI-powered chatbot embed system with React frontend and Vercel serverless functions, designed to work both locally and in production.

✨ Features

  • πŸ€– 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

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   React App     β”‚    β”‚ Vercel Serverlessβ”‚    β”‚   Supabase      β”‚
β”‚   (Frontend)    │◄──►│   Functions     │◄──►│   (Database)    β”‚
β”‚                 β”‚    β”‚                 β”‚    β”‚                 β”‚
β”‚ β€’ Export Page   β”‚    β”‚ β€’ Chat API      β”‚    β”‚ β€’ Embed Configs β”‚
β”‚ β€’ Chatbot UI    β”‚    β”‚ β€’ Embed Scripts β”‚    β”‚ β€’ Conversations β”‚
β”‚ β€’ Settings      β”‚    β”‚ β€’ Analytics     β”‚    β”‚ β€’ Messages      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸš€ Quick Start

Prerequisites

  • Node.js 18+
  • npm or yarn
  • Supabase account
  • OpenRouter API key

1. Clone & Install

git clone <your-repo>
cd t3dotgg-launchpad
npm install

2. Environment Setup

Create 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

3. Development Mode

# Start React development server
npm run dev

4. Production Build

npm run build

🌐 Development URLs

πŸš€ Production Deployment

Vercel Deployment

  1. Push to GitHub:
git add .
git commit -m "Ready for production deployment"
git push origin main
  1. Deploy to Vercel:
vercel --prod
  1. Set Environment Variables in Vercel dashboard:
    • OPENROUTER_API_KEY
    • SUPABASE_URL
    • SUPABASE_ANON_KEY
    • NODE_ENV=production

Production URLs

πŸ“ Project Structure

β”œβ”€β”€ 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

πŸ”§ Available 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

πŸ—„οΈ Database Setup

  1. Run the schema script in your Supabase SQL editor:
-- Run supabase_embeds_schema.sql
  1. Create your first embed using the Export page

  2. Test the embed by visiting /api/embed/[your-embed-code]

πŸ”Œ API Endpoints

Public Chat API

POST /api/public-chat
Content-Type: application/json

{
  "embedCode": "your-embed-code",
  "message": "Hello, how are you?",
  "sessionId": "unique-session-id"
}

Embed Scripts

GET /api/embed/[embedCode].js

Embed Preview

GET /api/embed/[embedCode]

Health Check

GET /api/health

🎨 Customization

Chatbot Themes

The embed scripts are dynamically generated with customizable:

  • Colors and styling
  • Position and size
  • Welcome messages
  • Typing indicators

AI Behavior

Update the system prompt in the Export page or modify the API functions for:

  • Different AI personalities
  • Response styles
  • Context handling

πŸ› Troubleshooting

Common Issues

  1. "Cannot GET /" Error

    • Ensure Vercel is configured to serve React app for main routes
    • Check that vercel.json has correct routing
  2. Embed Script Not Loading

    • Verify the serverless functions are deployed
    • Check CORS headers in production
    • Ensure embed code exists in database
  3. AI Responses Not Working

    • Verify OpenRouter API key is set in Vercel
    • Check API rate limits
    • Ensure network connectivity

Development Debugging

# Check React app logs
npm run dev

# Test API endpoints (after deployment)
curl https://your-domain.vercel.app/api/health

πŸš€ Serverless Functions

The 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

πŸ“š Additional Resources

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test locally and in production
  5. Submit a pull request

πŸ“„ License

This project is licensed under the ISC License.


Made with ❀️ by LuxLLM Team

About

Full stack AI chatbot embed infrastructure using React, Vercel serverless functions, OpenRouter LLM APIs, and Supabase with RLS backed PostgreSQL.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors