Vercel Deployment
Step 1: Push to GitHub
git add .
git commit -m "Ready for deployment"
git push origin main
Step 2: Import to Vercel
- Go to vercel.com/dashboard
- Click Add New → Project
- Import your GitHub repository
- Click Deploy
Step 3: Add Environment Variables
Your site won’t work without environment variables configured in Vercel!
- Go to Project Settings → Environment Variables
- Add these variables:
| Variable | Value |
|---|
VITE_APPWRITE_ENDPOINT | https://cloud.appwrite.io/v1 |
VITE_APPWRITE_PROJECT_ID | Your project ID |
VITE_APPWRITE_DATABASE_ID | portfolio_db |
VITE_APPWRITE_STORAGE_ID | reactbucket |
- Set for Production, Preview, and Development
- Click Save
This is critical! Without CORS configuration, your deployed site cannot access Appwrite.
- Go to Appwrite Console
- Select your project → Settings → Platforms
- Add a Web platform with your Vercel domain:
https://your-project.vercel.app
https://*.vercel.app (for preview deployments)
- Your custom domain if applicable
Step 5: Redeploy
After adding environment variables:
- Go to Deployments tab
- Click ⋯ on latest deployment
- Click Redeploy
Troubleshooting
Site shows “basic mode” or empty data
Cause: Environment variables not set or CORS not configured.
Solution:
- Check Vercel → Settings → Environment Variables
- Check Appwrite → Settings → Platforms
- Redeploy after making changes
CORS Error in Console
Access to XMLHttpRequest blocked by CORS policy
Solution: Add your Vercel domain to Appwrite Platforms (Step 4).
404 on Page Refresh
Solution: Vercel handles this automatically for Vite projects. If issues persist, add a vercel.json:
{
"rewrites": [{ "source": "/(.*)", "destination": "/" }]
}
Custom Domain
- In Vercel: Settings → Domains → Add your domain
- Update DNS records as instructed
- Add the custom domain to Appwrite Platforms