This guide explains how to deploy both the frontend and backend of ScriptSync to Vercel.
- A Vercel account (https://vercel.com)
- Git repository with your ScriptSync code
- Node.js installed locally (for testing)
The frontend is already configured for Vercel deployment with:
vercel.jsonfile for build configuration- Vite build process configured
- Go to https://vercel.com/dashboard
- Click "New Project"
- Import your Git repository or upload the
scriptsyncfolder - Configure the project:
- Framework Preset: Vite
- Root Directory:
scriptsync - Build Command:
npm run build - Output Directory:
build
- Add environment variables if needed:
VITE_API_URL- URL of your deployed backend
- Click "Deploy"
After deploying the backend, update the frontend API configuration:
- Edit
scriptsync/src/services/api.js - Update
API_BASE_URLto point to your deployed backend URL
The backend has been adapted for Vercel's serverless functions:
- Individual API endpoints in the
api/directory - Vercel-compatible routing in
vercel.json - Database connection maintained through
config/database.js
- Go to https://vercel.com/dashboard
- Click "New Project"
- Import your Git repository or upload the
backendfolder - Configure the project:
- Framework Preset: Other
- Root Directory:
backend - Build Command: (leave empty - Vercel will auto-detect)
- Output Directory: (leave empty)
- Add environment variables:
DB_HOST- Your database hostDB_PORT- Your database port (3307)DB_NAME- Your database name (scriptsync)DB_USER- Your database user (root)DB_PASSWORD- Your database passwordJWT_SECRET- Your JWT secret keyJWT_EXPIRES_IN- JWT expiration time (7d)
- Click "Deploy"
ScriptSync requires a MySQL database. You'll need to set up your database separately:
- Create a MySQL database (e.g., on PlanetScale, AWS RDS, or similar)
- Import the schema from
scriptsync_schema.sql - Update the database connection variables in Vercel
VITE_API_URL- Backend API URL
DB_HOST- Database hostDB_PORT- Database portDB_NAME- Database nameDB_USER- Database userDB_PASSWORD- Database passwordJWT_SECRET- JWT secret keyJWT_EXPIRES_IN- JWT expiration time
- Update the frontend to use the deployed backend URL
- Test all functionality:
- User registration and login
- Profile updates
- Script creation and editing
- Monitor logs in the Vercel dashboard for any issues
- CORS Issues: Ensure your backend allows requests from your frontend domain
- Database Connection: Verify all database environment variables are correctly set
- API Errors: Check Vercel logs for detailed error messages
- The backend uses serverless functions which are stateless
- Database connections are managed per request
- File uploads may require additional configuration for production use
- WebSocket functionality may need alternative implementation for serverless environments