Overview
BoxApp is a static React application that can be deployed to any hosting platform that supports single-page applications (SPAs). This guide covers the most popular hosting options with step-by-step instructions.Vercel (Recommended)
Vercel is the recommended hosting platform for BoxApp due to its seamless integration with Vite and excellent performance.Prerequisites
- Vercel account (free tier available)
- GitHub, GitLab, or Bitbucket repository
- Completed Deployment Guide steps
Deploy to Vercel
Connect Your Repository
- Go to vercel.com
- Click Add New Project
- Import your repository
- Select the repository containing BoxApp
Configure Build Settings
Vercel should auto-detect Vite settings. Verify:
- Framework Preset: Vite
- Build Command:
npm run build - Output Directory:
dist - Install Command:
npm install
Vercel Configuration File
BoxApp includes avercel.json configuration for SPA routing:
Custom Domain
Configure DNS
Add the following DNS records at your domain registrar:Or use Vercel’s nameservers for easier management.
Continuous Deployment
Vercel automatically deploys when you push to your repository:- Production: Pushes to
mainbranch - Preview: Pull requests and other branches
- Rollback: One-click rollback to previous deployments
Each pull request gets a unique preview URL for testing before merging.
Netlify
Netlify is another excellent option with similar features to Vercel.Deploy to Netlify
Connect Repository
- Log in to netlify.com
- Click Add new site > Import an existing project
- Connect to your Git provider
- Select your repository
Configure Build Settings
Set the following build configuration:
- Base directory: (leave empty)
- Build command:
npm run build - Publish directory:
dist
Configure Redirects
Create a This handles SPA routing for all paths.
netlify.toml file in your project root:netlify.toml
Netlify Features
- Forms: Built-in form handling (can integrate with BoxApp lead forms)
- Functions: Serverless functions for backend logic
- Split Testing: A/B testing capabilities
- Analytics: Built-in analytics (paid feature)
Cloudflare Pages
Cloudflare Pages offers excellent performance with their global CDN.Deploy to Cloudflare Pages
Create Pages Project
- Log in to Cloudflare Dashboard
- Go to Pages
- Click Create a project
- Connect your Git repository
Configure Build
Set build configuration:
- Framework preset: None (or Vite if available)
- Build command:
npm run build - Build output directory:
dist
Cloudflare Advantages
- Unlimited bandwidth (on free tier)
- Global CDN with excellent performance
- Built-in DDoS protection
- Web Analytics (free)
AWS Amplify
Deploy to AWS Amplify for integration with other AWS services.Deploy to AWS Amplify
Create Amplify App
- Open AWS Amplify Console
- Click New app > Host web app
- Connect your repository
Self-Hosted Options
Docker Deployment
Create aDockerfile for containerized deployment:
Traditional Web Server
Deploy to Apache or Nginx:Performance Optimization
CDN Configuration
All major hosting platforms include CDN by default, but you can optimize further:- Enable HTTP/2: Improves load time for multiple assets
- Enable compression: Gzip or Brotli for text assets
- Set cache headers: Cache static assets for 1 year
- Use asset hashing: Vite does this automatically
Build Optimizations
Optimize your build for production:vite.config.ts
Monitoring
Analytics
Add analytics to track usage:- Vercel Analytics: Built-in Web Vitals tracking
- Google Analytics: Traditional analytics
- Plausible/Fathom: Privacy-friendly alternatives
Error Tracking
Integrate error tracking:- Sentry: Comprehensive error tracking
- LogRocket: Session replay and error tracking
- Rollbar: Real-time error monitoring
Uptime Monitoring
- Vercel/Netlify: Built-in uptime monitoring
- UptimeRobot: Free uptime monitoring
- Pingdom: Advanced monitoring with alerts
Security Considerations
Security Headers
Most platforms allow custom headers. Add these for enhanced security:vercel.json
Environment Security
- Never commit
.envfiles - Use platform environment variable management
- Rotate keys regularly
- Use different keys for staging and production
Troubleshooting
404 Errors on Route Refresh
If you get 404 errors when refreshing on non-root routes:- Verify your rewrite/redirect configuration
- Check that
vercel.jsonor equivalent is in your repository root - Ensure the configuration is deployed (check build logs)
Build Failures
Common build issues:Environment Variables Not Working
- Verify variables are prefixed with
VITE_ - Redeploy after adding/changing variables
- Check build logs for variable values (they’ll be visible in the build)
Slow Initial Load
- Enable code splitting
- Lazy load routes and components
- Optimize images (use WebP, proper sizing)
- Remove unused dependencies
- Analyze bundle with
vite-bundle-visualizer
Next Steps
- Deployment Guide - Complete deployment process
- Supabase Setup - Configure your backend
- Environment Variables - Configure your environment