This guide explains how to configure your GitPilot frontend on Vercel to connect to your backend running on Render (or any other platform).
GitPilot uses a split architecture:
- Frontend: React/Vite app deployed on Vercel (this guide)
- Backend: FastAPI Python server deployed on Render (or other platform)
The frontend needs to know the backend URL through an environment variable.
Before configuring Vercel, ensure your backend is deployed and running. You should have:
- Backend URL (e.g.,
https://gitpilot-backend-latest.onrender.com) - Backend health endpoint working:
https://your-backend-url.onrender.com/api/health
- Go to your Vercel project: https://vercel.com/dashboard
- Select your GitPilot project
- Navigate to: Settings → Environment Variables
- Add new environment variable:
- Name:
VITE_BACKEND_URL - Value:
https://your-backend-url.onrender.com(without trailing slash) - Environment: Select all three: Production, Preview, Development
- Name:
- Click "Save"
# Set environment variable for all environments
vercel env add VITE_BACKEND_URL
# When prompted, enter:
# Value: https://your-backend-url.onrender.com
# Environments: Production, Preview, Development (select all)After adding the environment variable, you must redeploy for it to take effect:
- Go to Deployments tab
- Find the latest deployment
- Click the three dots (⋯) → Redeploy
- Select "Use existing Build Cache" or "Rebuild with same settings"
# Make a small change and push
git commit --allow-empty -m "Trigger Vercel redeploy with env vars"
git push origin mainvercel --prodAfter deployment completes:
- Visit your Vercel app:
https://your-project.vercel.app - Open browser console (F12 → Console tab)
- Run:
console.log(import.meta.env.VITE_BACKEND_URL)
- Should see:
https://your-backend-url.onrender.com
- Try to login to your GitPilot app
- Check browser Network tab (F12 → Network)
- Look for API calls to
/api/auth/* - Verify they're going to:
https://your-backend-url.onrender.com/api/auth/*
If you see calls going to https://your-project.vercel.app/api/auth/* instead, the environment variable is not set correctly.
Symptoms: Login shows error: "Backend not reachable. VITE_BACKEND_URL environment variable is not configured."
Solution:
- Check that
VITE_BACKEND_URLis set in Vercel dashboard - Make sure you redeployed after adding the variable
- Verify the variable value doesn't have a trailing slash
Symptoms: Error like "Unexpected token 'T', 'The page c'... is not valid JSON"
Cause: Frontend is trying to call APIs on Vercel (which has no backend) because VITE_BACKEND_URL is not set.
Solution:
- Set
VITE_BACKEND_URLin Vercel - Redeploy
- Clear browser cache and try again
Symptoms: Browser console shows: "blocked by CORS policy"
Solution: Update your backend's CORS_ORIGINS environment variable in Render:
CORS_ORIGINS=https://your-project.vercel.app,https://your-project-*.vercel.appThe * pattern allows preview deployments to work as well.
Symptoms: Environment variable is set but app still shows old behavior
Solution:
- Hard refresh in browser: Ctrl+Shift+R (Windows) or Cmd+Shift+R (Mac)
- Clear browser cache completely
- Verify deployment completed: Check Vercel Deployments tab for "Ready" status
- Check build logs for any errors during build
-
VITE_BACKEND_URL=https://your-backend-url.onrender.com
-
GITHUB_CLIENT_ID= Your GitHub OAuth App Client ID -
GITHUB_CLIENT_SECRET= Your GitHub OAuth App Client Secret -
OPENAI_API_KEY= Your OpenAI API key (orANTHROPIC_API_KEY) -
CORS_ORIGINS=https://your-project.vercel.app,https://your-project-*.vercel.app
Here's a real example configuration:
Service URL: https://gitpilot-backend-abc123.onrender.com
Environment Variables:
GITHUB_CLIENT_ID=Iv1.a1b2c3d4e5f6g7h8
GITHUB_CLIENT_SECRET=1234567890abcdef1234567890abcdef12345678
OPENAI_API_KEY=sk-proj-abc123...xyz789
CORS_ORIGINS=https://gitpilot-frontend.vercel.app,https://gitpilot-frontend-*.vercel.app
Production URL: https://gitpilot-frontend.vercel.app
Environment Variables:
VITE_BACKEND_URL=https://gitpilot-backend-abc123.onrender.com
After configuration:
- Visit:
https://your-project.vercel.app - Click: "Sign in with GitHub"
- Verify: Redirected to GitHub OAuth
- Authorize: Grant permissions
- Success: You should be logged in and see your repositories
If any step fails, check the browser console and network tab for specific errors.
Vercel creates preview deployments for every branch/PR. To make these work:
- Backend CORS must allow:
https://your-project-*.vercel.app - Preview deployments inherit: Production environment variables
- No changes needed: Preview deployments automatically use the same
VITE_BACKEND_URL
If you're still having issues:
- Check Vercel build logs: Settings → Deployments → [Your deployment] → Build Logs
- Check Render backend logs: Dashboard → [Your service] → Logs
- Verify backend health:
curl https://your-backend-url.onrender.com/api/health - Check this repo's issues: https://github.com/ruslanmv/gitpilot/issues
Quick checklist to get Vercel frontend working:
- Backend deployed and health check passing
-
VITE_BACKEND_URLset in Vercel (all environments) -
CORS_ORIGINSset in Render backend (includes Vercel URL) - Frontend redeployed after adding env var
- Browser cache cleared
- Login flow works end-to-end
That's it! Your GitPilot frontend on Vercel should now successfully connect to your backend.