Note: This project now uses hybrid deployment (Backend on Render + Frontend on Vercel). For complete deployment instructions, see HYBRID_DEPLOYMENT_GUIDE.md.
This guide explains how to deploy only the frontend React application to Vercel.
- Vercel account (free tier available)
- GitHub repository with your code
- Node.js installed locally
npm install -g vercel
vercel login- Navigate to your project root directory
- Run the deployment command:
vercel --prod- Follow the prompts:
- Set up and deploy? Y
- Which scope? Select your account
- Link to existing project? N (for first deployment)
- Project name:
frontend-khaki-sigma - Directory:
.(current directory) - Override settings? N
After deployment, add these environment variables in Vercel dashboard:
OPENROUTER_API_KEY: Your OpenRouter API keyFLASK_ENV:productionSECRET_KEY: A secure random stringPYTHONPATH:.
- Navigate to the frontend directory:
cd frontend- Deploy the frontend:
vercel --prod-
When prompted for project name, use:
frontend-khaki-sigma -
Deployment will be available at:
https://frontend-khaki-sigma.vercel.app
{
"version": 2,
"builds": [
{
"src": "api/index.py",
"use": "@vercel/python",
"config": {
"maxLambdaSize": "50mb",
"runtime": "python3.11"
}
}
],
"installCommand": "pip install -r requirements-vercel.txt",
"routes": [
{
"src": "/(.*)",
"dest": "api/index.py"
}
],
"env": {
"FLASK_ENV": "production",
"PYTHONPATH": "."
}
}{
"buildCommand": "npm run build",
"outputDirectory": "build",
"rewrites": [
{
"source": "/(.*)",
"destination": "/index.html"
}
]
}- Backend API:
https://conversational-chatbot.onrender.com/api/*(Deployed on Render) - Frontend:
- Frontend:
https://frontend-khaki-sigma.vercel.app/
- Frontend:
curl https://conversational-chatbot.onrender.com/healthOpen your browser and navigate to:
https://frontend-khaki-sigma.vercel.app/
- Open the frontend URL
- Try to register/login
- Test the chatbot functionality
- Check browser console for any API connection errors
-
API Not Found (404)
- Ensure
api/index.pyexists and is properly configured - Check that
requirements-vercel.txtincludes all dependencies
- Ensure
-
CORS Errors
- Verify CORS configuration in
app.py - Ensure frontend URL is in CORS_ORIGINS
- Verify CORS configuration in
-
Environment Variables
- Add all required environment variables in Vercel dashboard
- Redeploy after adding environment variables
-
Build Failures
- Check build logs in Vercel dashboard
- Ensure all dependencies are in
requirements-vercel.txt
- View deployment logs in Vercel dashboard
- Use
vercel logscommand for real-time logs - Monitor function execution in Vercel analytics
Once connected to GitHub:
- Push changes to your repository
- Vercel automatically deploys on push to main branch
- Preview deployments for pull requests
- Set up custom domain (optional)
- Configure analytics and monitoring
- Set up staging environment
- Implement CI/CD workflows
If you encounter issues:
- Check Vercel documentation
- Review deployment logs
- Test locally first
- Check environment variables configuration