Before deploying to Netlify, ensure you have:
- Convex Backend Deployed - Your Convex backend must be deployed to production
- Firebase Project Setup - Firebase configuration for production
- Environment Variables - All required environment variables
# Navigate to your project directory
cd "e:\Aditya flutter\Web-Dev\project-red-stream-main\raktdaan\raktdaan"
# Deploy Convex to production
npx convex deploy
# Note down the production URL that gets generatedCreate a .env.local file with your production values:
# Convex Production URL (from step 1)
VITE_CONVEX_URL=https://your-convex-deployment.convex.cloud
# Firebase Production Configuration
VITE_FIREBASE_API_KEY=your-firebase-api-key
VITE_FIREBASE_AUTH_DOMAIN=your-project.firebaseapp.com
VITE_FIREBASE_PROJECT_ID=your-project-id
VITE_FIREBASE_STORAGE_BUCKET=your-project.appspot.com
VITE_FIREBASE_MESSAGING_SENDER_ID=123456789
VITE_FIREBASE_APP_ID=1:123456789:web:abcdef123456Before deploying, test the production build locally:
# Install dependencies
npm install
# Build for production
npm run build
# Preview the production build
npm run preview# Install Netlify CLI globally
npm install -g netlify-cli
# Login to Netlify
netlify login
# Deploy to Netlify
netlify deploy
# For production deployment
netlify deploy --prod-
Connect Repository:
- Go to Netlify Dashboard
- Click "Add new site" → "Import an existing project"
- Connect your Git repository
-
Configure Build Settings:
- Build command:
npm run build - Publish directory:
dist - Base directory: (leave empty)
- Build command:
-
Set Environment Variables: Go to Site settings → Environment variables and add:
VITE_CONVEX_URL=https://your-convex-deployment.convex.cloud VITE_FIREBASE_API_KEY=your-firebase-api-key VITE_FIREBASE_AUTH_DOMAIN=your-project.firebaseapp.com VITE_FIREBASE_PROJECT_ID=your-project-id VITE_FIREBASE_STORAGE_BUCKET=your-project.appspot.com VITE_FIREBASE_MESSAGING_SENDER_ID=123456789 VITE_FIREBASE_APP_ID=1:123456789:web:abcdef123456 -
Deploy:
- Click "Deploy site"
- In Netlify dashboard, go to Site settings → Domain management
- Add your custom domain
- Configure DNS settings as instructed
Solution: This is caused by hardcoded API keys or URLs in the build. We've configured the project to handle this:
- Environment variables are properly validated in
src/main.tsxandsrc/firebase/config.ts - Secrets scanning is configured in
netlify.tomlwithSECRETS_SCAN_OMIT_KEYS - Ensure all environment variables are set in Netlify dashboard, not hardcoded
Solution: Ensure you've set the environment variable in Netlify:
- Go to Site settings → Environment variables
- Add
VITE_CONVEX_URLwith your Convex production URL
Solution: The netlify.toml and _redirects files should handle this, but if issues persist:
- Check that
public/_redirectsexists with content:/* /index.html 200
Solution: Fix TypeScript errors locally first:
# Check for TypeScript errors
npx tsc --noEmit
# Fix any errors before deployingSolution:
- Verify all environment variables are correctly set in Netlify
- Ensure Convex backend is deployed and accessible
- Check Firebase project settings match your environment variables
Solution: The Vite config includes optimization settings, but you can further optimize:
- Consider code splitting for large components
- Use dynamic imports for heavy dependencies
✅ Test Core Features:
- User registration/login works
- Admin dashboard accessible with test credentials
- Image uploads function correctly
- Real-time features (chat, notifications) work
- Mobile responsiveness
✅ Performance Check:
- Page load times are acceptable
- Images load properly
- No console errors
✅ Security Check:
- Admin access is properly restricted
- Firebase security rules are configured
- Environment variables are not exposed in client
After successful deployment, you'll have:
- Frontend:
https://your-site-name.netlify.app - Backend:
https://your-convex-deployment.convex.cloud - Admin Access:
https://your-site-name.netlify.app(login with admin credentials)
If you encounter issues:
- Check Netlify deployment logs
- Check browser console for errors
- Verify all environment variables are set
- Ensure Convex backend is deployed and accessible
netlify.toml- Netlify configurationpublic/_redirects- SPA routing redirects.env.example- Environment variables template- Updated
package.json- Build scripts - Updated
vite.config.ts- Production optimizations
Ready to deploy! 🚀