This guide covers how to deploy your Task Manager Pro application to various platforms.
Before deployment, ensure you have:
- ✅ Completed the database setup in Supabase
- ✅ Your Supabase project URL and anon key
- ✅ All features tested locally
- ✅ Environment variables configured
Vercel offers the best experience for React apps with automatic deployments.
-
Install Vercel CLI (optional):
npm i -g vercel
-
Deploy via GitHub (Recommended):
- Push your code to GitHub
- Go to vercel.com
- Click "New Project"
- Import your GitHub repository
- Configure environment variables:
VITE_SUPABASE_URL: Your Supabase project URLVITE_SUPABASE_ANON_KEY: Your Supabase anon key
-
Deploy via CLI:
vercel # Follow the prompts
Create vercel.json:
{
"framework": "vite",
"buildCommand": "npm run build",
"outputDirectory": "dist",
"cleanUrls": true,
"trailingSlash": false
}Netlify is another excellent option with great features.
-
Deploy via Git:
- Go to netlify.com
- Click "Add new site" → "Import from Git"
- Connect your GitHub repository
- Build settings:
- Build command:
npm run build - Publish directory:
dist
- Build command:
-
Environment Variables:
- Go to Site settings → Environment variables
- Add:
VITE_SUPABASE_URLVITE_SUPABASE_ANON_KEY
Create netlify.toml:
[build]
command = "npm run build"
publish = "dist"
[[redirects]]
from = "/*"
to = "/index.html"
status = 200GitHub Pages is free but requires some additional setup.
-
Install gh-pages:
npm install --save-dev gh-pages
-
Update package.json:
{ "homepage": "https://your-username.github.io/devtasks", "scripts": { "predeploy": "npm run build", "deploy": "gh-pages -d dist" } } -
Deploy:
npm run deploy
Firebase Hosting offers global CDN and great performance.
-
Install Firebase CLI:
npm install -g firebase-tools
-
Initialize Firebase:
firebase init hosting # Choose 'dist' as public directory # Configure as single-page app: Yes
-
Deploy:
npm run build firebase deploy
For each platform, you'll need to set these environment variables:
| Variable | Description | Example |
|---|---|---|
VITE_SUPABASE_URL |
Your Supabase project URL | https://abc123.supabase.co |
VITE_SUPABASE_ANON_KEY |
Your Supabase anon key | eyJhbGciOiJIUzI1NiIs... |
After deployment, verify:
- App loads without errors
- User registration works
- User login works
- Tasks can be created
- Tasks can be updated/deleted
- Real-time updates work
- Page load time < 3 seconds
- PWA features work
- Mobile responsiveness
- Analytics dashboard loads
- Environment variables are set
- No hardcoded credentials in code
- HTTPS is enabled
- Supabase RLS policies are active
Solution: Ensure all dependencies are in package.json
npm installSolution:
- Check variable names start with
VITE_ - Verify they're set in your hosting platform
- Restart the build process
Solution:
- Verify Supabase URL and key are correct
- Check Supabase project is active
- Ensure RLS policies allow access
Solution: Configure SPA redirects
- Vercel: Automatic
- Netlify: Add
netlify.tomlredirects - Others: Configure server to serve
index.htmlfor all routes
- Enable compression in your hosting platform
- Configure caching headers for static assets
- Use CDN for global distribution
- Enable PWA caching with service worker
- Set up CORS in Supabase for your domain only
- Configure CSP headers for additional security
- Enable HTTPS (usually automatic)
- Regular dependency updates
- Set up error tracking (Sentry, LogRocket)
- Monitor performance (Web Vitals)
- Track user analytics (Google Analytics)
- Database monitoring via Supabase dashboard
Set up automatic deployments:
- Push to main branch → Automatic deployment
- Pull request previews for testing
- Rollback capabilities if issues arise
- Environment-specific deployments (staging/production)
If you encounter issues:
- Check the deployment platform's documentation
- Verify environment variables are correct
- Test locally with production build:
npm run build && npm run preview - Check browser console for errors
- Review Supabase logs for database issues
Happy Deploying! 🎉