Overview
The Risk Legion frontend is deployed to Vercel for optimal performance with global CDN distribution, automatic HTTPS, and preview deployments.Vercel Setup
1. Connect Repository
- Go to vercel.com
- Click “Add New Project”
- Import your GitHub repository
- Select the
risk-legion-frontenddirectory as root
2. Configure Build Settings
| Setting | Value |
|---|---|
| Framework Preset | Vite |
| Build Command | npm run build |
| Output Directory | dist |
| Install Command | npm install |
3. Environment Variables
Add these in Vercel Dashboard → Settings → Environment Variables:| Variable | Production Value | Preview Value |
|---|---|---|
VITE_SUPABASE_URL | https://your-project.supabase.co | Same |
VITE_SUPABASE_ANON_KEY | Production anon key | Same |
VITE_API_URL | https://api.risklegion.com | https://api-test.risklegion.com |
4. Domain Configuration
- Go to Settings → Domains
- Add
app.risklegion.com - Configure DNS:
Deployment Process
Automatic Deployments
Vercel automatically deploys on:- Push to
mainbranch → Production - Push to other branches → Preview deployment
- Pull requests → Preview deployment
Manual Deployment
vercel.json Configuration
Build Optimization
Vite Configuration
Performance Optimizations
- Code Splitting: Automatic route-based splitting
- Tree Shaking: Removes unused code
- Minification: Terser for production builds
- Asset Optimization: Vite optimizes assets
Preview Deployments
Every pull request gets a unique preview URL:Preview Comments
Enable preview comments on PRs:- Go to Settings → Git
- Enable “Vercel for GitHub”
Monitoring
Vercel Analytics
Enable in Dashboard → Analytics:- Page views
- Web vitals (LCP, FID, CLS)
- Geographic distribution
Error Tracking
Integrate with Sentry:Rollback
Via Dashboard
- Go to Deployments
- Find the deployment to restore
- Click ”…” → “Promote to Production”
Via CLI
Troubleshooting
Build Fails
Build Fails
- Check build logs in Vercel Dashboard
- Verify all environment variables are set
- Ensure dependencies are in package.json
- Test build locally:
npm run build
Routing Issues
Routing Issues
- Ensure vercel.json has SPA rewrites
- Check for hardcoded paths
- Verify React Router configuration
Environment Variables Not Working
Environment Variables Not Working
- Variables must start with
VITE_ - Redeploy after adding variables
- Check for typos in variable names
Slow Performance
Slow Performance
- Enable code splitting
- Optimize images
- Use lazy loading for routes
- Check bundle size with
npm run analyze