Deploying the Frontend
The frontend application is deployed on Vercel for optimal performance and seamless continuous deployment.
Vercel Deployment
Prerequisites
- A Vercel account
- Access to the project repository
- Environment variables ready
Environment Variables
Configure this environment variable in your Vercel project settings:
VITE_API_URL=your_backend_api_url
Note: All environment variables in React must be prefixed with REACT_APP_ to be accessible in the application.
Deployment Process
- Connect your GitHub repository to Vercel
- Vercel will automatically detect the React application
- Configure your environment variable in the Vercel dashboard
- Deploy!
Automatic Deployments
- Pushes to
maintrigger production deployments - Pull requests create preview deployments
- Failed builds block merging to main
Monitoring
- View deployment logs in Vercel dashboard
- Monitor application performance with Vercel Analytics
- Track build status in GitHub Actions
Troubleshooting
Common deployment issues:
-
Environment Variables
- Missing
VITE_prefix - Incorrect API URL format
- Environment variables not set in Vercel
- Missing
-
Build Failures
- Dependency installation errors
- Linting/formatting violations
- Invalid JSX file extensions
-
Runtime Issues
- CORS configuration
- API connectivity problems
- Asset loading errors
Rolling Back
To revert to a previous version:
- Go to your project on Vercel
- Navigate to Deployments
- Locate the desired previous deployment
- Click "Promote to Production"
Production Optimization
- Build Command
npm run build
- Output
- Creates optimized production build in
build/ - Minifies all JavaScript and CSS
- Optimizes static assets
- Performance Considerations
- Enable gzip compression
- Implement code splitting
- Optimize asset loading
- Configure proper caching headers