Deployment Guide
Deploy ChatRAG to production on Vercel (recommended) or other Next.js-compatible platforms.
Vercel Deployment Recommended
Deploying to Vercel
Prepare Your Repository
Push your ChatRAG code to GitHub, GitLab, or Bitbucket
git add .
git commit -m "Ready for deployment"
git push origin mainCreate Vercel Project
- Visit vercel.com and sign in
- Click "New Project"
- Import your ChatRAG repository
- Select the repository and click "Import"
Configure Environment Variables
Add all environment variables from your local .env.local to Vercel:
Required Variables:
NEXT_PUBLIC_SUPABASE_URLNEXT_PUBLIC_SUPABASE_ANON_KEYSUPABASE_SERVICE_ROLE_KEYOPENAI_API_KEYOPENROUTER_API_KEYNEXT_PUBLIC_LLAMA_CLOUD_API_KEYNEXT_PUBLIC_SITE_URL(your production domain)
Pro Tip
.env.local and paste them into Vercel's Environment Variables section.Deploy
Click "Deploy" and wait for the build to complete (~2-3 minutes)
Vercel will automatically:
- Install dependencies
- Build the Next.js application
- Deploy to edge network
- Provide a production URL
Configure Custom Domain (Optional)
- In Vercel project settings, go to Domains
- Add your custom domain (e.g., chatbot.yourdomain.com)
- Follow DNS configuration instructions
- Update
NEXT_PUBLIC_SITE_URLto your custom domain
Update Supabase Settings
In Supabase Dashboard → Authentication → URL Configuration:
- Add your production URL to allowed redirect URLs
- Update site URL to production domain
Post-Deployment Configuration
Update Site URL
Set your production URL in environment variables:
NEXT_PUBLIC_SITE_URL=https://your-domain.vercel.appConfigure OAuth Providers
Update OAuth callback URLs for GitHub, Google, etc.:
Callback URL format: https://your-project.supabase.co/auth/v1/callback
Enable Production Features
- Enable authentication if using
- Configure payment webhooks (Stripe/Polar)
- Set up email provider (Resend/SMTP)
Alternative Deployment Platforms
Self-Hosting (Docker/VPS)
Deploy on your own infrastructure using Docker, PM2, or similar tools
Requirements:
- Node.js 18+
- Environment variables configured
- Reverse proxy (nginx/Apache)
- SSL certificate for HTTPS
Coolify
Open-source self-hosting platform
Supports Next.js deployment with automatic SSL and environment management
Other Next.js Platforms
ChatRAG should work on any platform that supports Next.js 15+:
- Netlify
- Railway
- Render
- AWS (Amplify, EC2)
Important Production Notes
Config UI is Development Only
config-server.js) to production. The Config UI runs locally only. Manage production environment variables via your hosting provider's dashboard or a secure secret manager.Protected Routes
vercel.json automatically returns 404 for these routes in production:/scripts/*/config/config-ui/*
Monitoring & Maintenance
Vercel Analytics
Enable Vercel Analytics to track performance, visitors, and errors
Supabase Monitoring
Monitor database performance and usage:
- Database size and growth
- API request volume
- Authentication logs
- Storage usage
API Cost Monitoring
Set up usage alerts in provider dashboards:
- OpenAI API usage
- OpenRouter credits
- LlamaCloud document processing
- FAL.ai/Replicate media generation
Regular Updates
Keep dependencies and platform up to date:
# Update dependencies
npm update
# Redeploy
git push origin mainCommon Deployment Issues
Build fails on Vercel
Solutions:
- Check build logs for missing dependencies
- Verify Node.js version (18+ required)
- Ensure all environment variables are set
- Check for TypeScript errors
Database connection errors
Solutions:
- Verify Supabase credentials are correct
- Check service role key is set
- Ensure Supabase project is active (not paused)
- Verify allowed origins in Supabase settings
Authentication not working
Solutions:
- Update NEXT_PUBLIC_SITE_URL to production URL
- Add production URL to Supabase redirect URLs
- Update OAuth provider callback URLs
- Check email provider configuration
Deployment Checklist
- ✓ All environment variables configured in Vercel
- ✓ Production domain set in NEXT_PUBLIC_SITE_URL
- ✓ Supabase redirect URLs updated
- ✓ OAuth providers configured with production callback URLs
- ✓ Database schema applied (complete_setup.sql)
- ✓ Email provider configured for production
- ✓ API usage monitoring enabled