Overview
CheckThat AI consists of two deployable components:- Frontend: Static React application (deployed to GitHub Pages)
- Backend: FastAPI application (deployed to cloud hosting)
Architecture Overview
Frontend Deployment (GitHub Pages)
The frontend is automatically deployed to GitHub Pages using GitHub Actions.Prerequisites
GitHub Repository
Repository with GitHub Pages enabled
Custom Domain
Optional: Custom domain (CNAME file)
Secrets Configuration
GitHub repository secrets configured
Node.js 18+
For build process
Deployment Steps
Configure Repository Secrets
Add these secrets to your GitHub repository (Settings → Secrets → Actions):
| Secret Name | Description | Example |
|---|---|---|
VITE_BACKEND_URL | Backend API URL | https://api.checkthat-ai.com |
VITE_SUPABASE_URL | Supabase project URL | https://xxx.supabase.co |
VITE_SUPABASE_ANON_KEY | Supabase anonymous key | eyJhbGc... |
Configure GitHub Pages
In your repository settings:
- Navigate to Settings → Pages
- Under Source, select GitHub Actions
- Save the configuration
Set Up Custom Domain (Optional)
If using a custom domain:
-
Create a
CNAMEfile in the repository root: -
Configure DNS records with your domain provider:
-
Update
vite.config.tsbase URL:
Frontend Build Configuration
The production build is configured invite.config.ts:
Backend Deployment (Cloud Hosting)
The FastAPI backend can be deployed to various cloud platforms. This guide covers general deployment principles applicable to Render, Railway, Fly.io, AWS, GCP, or Azure.Prerequisites
Cloud Platform Account
Render, Railway, Fly.io, etc.
API Keys
OpenAI, Anthropic, Gemini, xAI
Supabase Project
Database and authentication
Python 3.8+
Runtime environment
Deployment Configuration
Set Environment Variables
Configure these environment variables in your cloud platform:
View All Environment Variables
View All Environment Variables
See Environment Variables for complete list.Required:
ENV_TYPE=prodCORS_ORIGINS=*(or specific frontend domain)- At least one model provider API key
- Supabase configuration (if using authentication)
LOG_LEVEL=INFO- Additional model provider keys
Set Up Application Server
The backend uses Uvicorn as the ASGI server. Configure startup command:For development mode:For production mode:
Security Best Practices
API Key Management
API Key Management
- Never commit API keys to version control
- Use environment variables for all sensitive data
- Rotate API keys regularly
- Use different keys for development and production
- Monitor API usage and set spending limits
CORS Configuration
CORS Configuration
- For public APIs: Use
CORS_ORIGINS=* - For private APIs: Specify exact frontend domains
- Never expose internal services to public CORS
- Use HTTPS for all production URLs
Authentication & Authorization
Authentication & Authorization
Logging & Monitoring
Logging & Monitoring
- Set
LOG_LEVEL=INFOfor production - Never log API keys or sensitive data
- Monitor error rates and response times
- Set up alerts for critical errors
- Use structured logging (JSON format)
Environment Configuration
Environment Configuration
- Set
ENV_TYPE=prodfor production - Use separate Supabase projects for dev/prod
- Implement graceful error handling
- Configure appropriate timeout values
- Enable HTTPS only in production
Performance Optimization
Frontend Optimization
Build Optimization
- Enable code splitting in Vite configuration
- Minify JavaScript and CSS
- Tree-shake unused dependencies
- Use production builds (never deploy dev builds)
Asset Optimization
- Compress images (use WebP format)
- Lazy load components with React.lazy()
- Use CDN for static assets
- Enable Brotli/Gzip compression
Backend Optimization
Database Optimization
- Enable connection pooling for Supabase
- Use database indexes for frequent queries
- Implement caching for repeated queries
- Use async database operations
Health Checks & Monitoring
Implement health check endpoints for monitoring:Deployment Checklist
Pre-Deployment
- ✅ All environment variables configured
- ✅ API keys valid and tested
- ✅ Database schema deployed (Supabase)
- ✅ Frontend built successfully
- ✅ Backend tested locally
- ✅ CORS configured correctly
- ✅ Security review completed
Deployment
- ✅ Frontend deployed to GitHub Pages
- ✅ Backend deployed to cloud platform
- ✅ Custom domain configured (if applicable)
- ✅ SSL/HTTPS enabled
- ✅ Health checks passing
Troubleshooting
Frontend Not Loading
Frontend Not Loading
- Check GitHub Pages deployment status
- Verify
baseURL invite.config.ts - Ensure CNAME file is correct
- Check browser console for errors
- Verify DNS configuration for custom domain
Backend Connection Errors
Backend Connection Errors
- Verify backend URL in frontend environment variables
- Check CORS configuration
- Ensure backend is running and healthy
- Verify SSL certificate is valid
- Check firewall/security group rules
API Key Errors
API Key Errors
- Verify environment variables are set
- Check API key validity with provider
- Ensure sufficient quota/credits
- Check for typos in variable names
- Verify platform-specific env var syntax
Database Connection Issues
Database Connection Issues
- Verify Supabase URL and keys
- Check database schema is deployed
- Ensure Row Level Security policies are correct
- Verify network connectivity
- Check Supabase project status
Rollback Procedure
If deployment issues occur:Frontend Rollback
Backend Rollback
Most cloud platforms provide rollback options:- Render: Click “Rollback” in dashboard
- Railway: Redeploy previous deployment
- Docker: Run previous image version
Next Steps
Environment Variables
Complete environment variable reference
Monitoring
Set up monitoring and alerts
Scaling
Scale your deployment
Security
Advanced security configuration