Overview
After building and testing your application, you’re ready to deploy to production. This guide covers deploying the SAAC Frontend to various hosting platforms.Build Requirements
All deployment platforms need the following information:Build Command
Output Directory
tsc -b && vite build) performs TypeScript validation and creates an optimized production bundle in the dist/ directory.
Environment Variables
For production deployments, configure environment variables with theVITE_ prefix:
.env.production
Deployment Platforms
Vercel (Recommended)
Vercel provides zero-configuration deployment for Vite applications with automatic builds and global CDN.Configure Project (if needed)
Vercel auto-detects Vite projects, but you can create a
vercel.json for custom configuration:vercel.json
- Automatic deployments from Git
- Preview deployments for pull requests
- Global CDN with edge caching
- Custom domains and SSL
- Serverless functions (if needed)
For GitHub/GitLab integration, connect your repository in the Vercel dashboard for automatic deployments on every push.
Netlify
Netlify offers similar features to Vercel with excellent static site hosting capabilities.Configure Build Settings
Create a The redirect rule ensures client-side routing works correctly.
netlify.toml file:netlify.toml
- Deploy previews for branches
- Form handling
- Serverless functions
- Split testing
- Analytics
GitHub Pages
Deploy static sites directly from your GitHub repository.Traditional Web Hosting
For shared hosting, VPS, or dedicated servers:Upload dist/ Contents
Upload the contents of the
dist/ directory to your web server’s public directory (e.g., public_html, www, or htdocs).Use FTP, SFTP, or your hosting provider’s file manager.Static File Serving
Your production deployment serves static files. Key considerations:File Structure
Thedist/ directory contains:
index.html- Entry pointassets/- JS, CSS, and other assets with content hashes- Static files from
public/directory
Content Types
Ensure your server sends correct MIME types:.js→application/javascript.css→text/css.html→text/html.svg→image/svg+xml
CDN and Caching
Cache Headers
Optimal caching strategy for Vite builds:index.htmlshould not be cached (or short cache) to get latest asset references- Assets have content hashes, so they can be cached forever
- When code changes, new hashes are generated, bypassing cache
CDN Configuration
For platforms with CDN (Vercel, Netlify, Cloudflare):- Edge caching: Static assets served from nearest edge location
- Automatic compression: Gzip/Brotli compression
- HTTP/2: Multiplexed connections
- SSL/TLS: Automatic HTTPS
Vite’s content-hashed filenames enable aggressive caching. When you deploy new versions, new hash values ensure users get fresh code.
Deployment Checklist
Before deploying to production:Continuous Deployment
Automate deployments with Git integration:Vercel/Netlify GitHub Integration
- Connect your GitHub repository
- Configure production branch (usually
main) - Every push to
maintriggers automatic deployment - Pull requests get preview deployments
GitHub Actions
For custom deployment workflows:.github/workflows/deploy.yml
Troubleshooting
Blank Page After Deployment
Cause: Incorrect base path or routing configuration. Solution:- Check
baseinvite.config.ts - Verify server routing fallback to
index.html - Check browser console for errors
Assets Not Loading
Cause: Wrong base path or CORS issues. Solution:- Set correct
basein Vite config - Verify assets are in
dist/assets/ - Check network tab for 404 errors
Environment Variables Not Working
Cause: MissingVITE_ prefix or not set on platform.
Solution:
- Prefix all client-side variables with
VITE_ - Set variables in hosting platform dashboard
- Rebuild after changing environment variables
Build Fails on Platform
Cause: Node version mismatch or missing dependencies. Solution:- Specify Node version (e.g., in
.nvmrcorpackage.json) - Ensure all dependencies are in
package.json - Check build logs for specific errors
Next Steps
Monitor Performance
Use Lighthouse, Web Vitals, and analytics to monitor your production app.
Set Up CI/CD
Automate testing and deployment with GitHub Actions or similar tools.
Configure Analytics
Add analytics to track user behavior and application performance.
Error Tracking
Integrate error tracking (Sentry, LogRocket) to catch production issues.
