- GitHub account
- Netlify account (free tier works)
- Bytez API key
- Gemini API key
git add .
git commit -m "Add Netlify serverless function for video generation"
git push origin main-
Connect Repository
- Go to Netlify
- Click "Add new site" → "Import an existing project"
- Choose GitHub and select your FusionBotX repository
-
Configure Build Settings
- Build command:
npm run build - Publish directory:
dist - Functions directory:
netlify/functions
These are already configured in
netlify.toml, so Netlify will auto-detect them. - Build command:
-
Set Environment Variables
- Go to Site settings → Environment variables
- Add the following variables:
VITE_GEMINI_API_KEY=your_gemini_api_keyVITE_BYTEZ_API_KEY=your_bytez_api_key
-
Deploy
- Click "Deploy site"
- Wait for build to complete (~2-3 minutes)
Your site will be available at: https://your-site-name.netlify.app
Test the video generation:
- Click the 🎬 Film button
- Type: "Generate a video: A cat playing"
- Video should generate and display
Development (localhost):
- Frontend:
http://localhost:5000(Vite) - Backend:
http://localhost:3001(Express server) - Uses local Express server for video generation
Production (Netlify):
- Frontend:
https://your-site.netlify.app - Backend:
https://your-site.netlify.app/.netlify/functions/generate-video - Uses Netlify serverless function for video generation
The code automatically detects the environment using import.meta.env.PROD and switches between local server and Netlify function.
Function Timeout
- Netlify free tier has 10-second function timeout
- Video generation might take longer
- Consider upgrading to Pro tier or using a different deployment platform
Build Errors
- Check build logs in Netlify dashboard
- Ensure all dependencies are in
package.json - Verify environment variables are set correctly
API Key Issues
- Make sure environment variables start with
VITE_prefix - They must be set in Netlify dashboard, not just in
.envfile
Test Netlify function locally using Netlify CLI:
npm install -g netlify-cli
netlify devThis will run both frontend and functions locally, simulating the Netlify environment.