Skip to content

Latest commit

 

History

History
450 lines (332 loc) · 9.06 KB

File metadata and controls

450 lines (332 loc) · 9.06 KB

🛠️ Complete Setup Guide for VideoGen Messenger

This guide will walk you through setting up VideoGen Messenger on your Windows machine.


🎯 What You'll Need

Software (Install First)

  • Node.js 18+ - Download (LTS version recommended)
  • Docker Desktop - Download (includes Docker Compose)
  • Git - Download
  • 📝 Code Editor - VS Code (recommended)

API Keys (See API_KEYS_GUIDE.md)

  • At least ONE AI provider key (Google Veo, Runway, or Minimax)
  • AWS Account with S3 access
  • (Optional) Azure Content Safety key
  • (Optional) OAuth keys for social login

🚀 Quick Setup (Automated)

Windows Users

Option 1: Double-click the setup script

setup.bat

Option 2: Run from Command Prompt

cd C:\Users\Tanner\VideoGenMessenger
setup.bat

This will:

  1. ✅ Check prerequisites
  2. ✅ Install dependencies
  3. ✅ Create .env file
  4. ✅ Start Docker services
  5. ✅ Run database migrations

Mac/Linux Users

cd backend
node scripts/setup.js

This interactive script will guide you through the entire setup.


📋 Manual Setup (Step by Step)

If you prefer to set things up manually:

Step 1: Install Dependencies

cd backend
npm install

Step 2: Create Environment File

cd backend
copy .env.example .env

Then edit .env and add your API keys (see API_KEYS_GUIDE.md)

Step 3: Start Infrastructure

# From root directory
docker-compose up -d

This starts:

  • PostgreSQL (port 5432)
  • Redis (port 6379)
  • Elasticsearch (port 9200)

Verify services are running:

docker-compose ps

All services should show "Up" status.

Step 4: Run Database Migrations

cd backend
npm run migrate

Optional - Seed with sample data:

npm run db:seed

Step 5: Start the Server

npm run dev

You should see:

🚀 VideoGen Messenger API server running on port 3000
📝 Environment: development
🔗 Health check: http://localhost:3000/health

Step 6: Start Workers (New Terminal)

cd backend
node workers/startWorkers.js

✅ Verify Everything Works

1. Check Health Endpoint

Windows (PowerShell):

Invoke-WebRequest http://localhost:3000/health

Windows (curl if installed):

curl http://localhost:3000/health

Expected Response:

{
  "status": "healthy",
  "timestamp": "2025-01-15T10:00:00.000Z",
  "uptime": 15.234,
  "environment": "development"
}

2. Check Docker Services

docker-compose ps

All should be "Up" and healthy.

3. Test Database Connection

docker exec -it videogen-postgres psql -U postgres -d videogen_messenger

In psql:

\dt  -- List tables
SELECT COUNT(*) FROM users;
\q   -- Quit

4. Test Redis

docker exec -it videogen-redis redis-cli

In Redis CLI:

PING  # Should return PONG
KEYS *
EXIT

5. Test Elasticsearch

PowerShell:

Invoke-WebRequest http://localhost:9200/_cluster/health

Browser: Open http://localhost:9200


🔧 Configuration Checklist

Required Environment Variables

Edit backend\.env and configure:

# ✅ Database (pre-configured if using Docker)
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/videogen_messenger

# ✅ Redis (pre-configured if using Docker)
REDIS_URL=redis://localhost:6379

# ✅ Elasticsearch (pre-configured if using Docker)
ELASTICSEARCH_NODE=http://localhost:9200

# ⚠️ ADD YOUR API KEYS HERE

# At least ONE AI provider (required)
GOOGLE_VEO_API_KEY=your_key_here
GOOGLE_VEO_PROJECT_ID=your_project_id
# OR
RUNWAY_API_KEY=your_key_here
# OR
MINIMAX_API_KEY=your_key_here
MINIMAX_GROUP_ID=your_group_id

# AWS S3 Storage (required)
AWS_REGION=us-east-1
AWS_ACCESS_KEY_ID=your_access_key
AWS_SECRET_ACCESS_KEY=your_secret_key
AWS_S3_BUCKET=your-bucket-name

# JWT Secrets (auto-generated by setup script)
JWT_SECRET=<generated>
JWT_REFRESH_SECRET=<generated>
API_KEY_SALT=<generated>

# Optional but recommended
AZURE_CONTENT_SAFETY_KEY=your_azure_key
AZURE_CONTENT_SAFETY_ENDPOINT=https://your-resource.cognitiveservices.azure.com/

🧪 Test Video Generation

1. Generate a Test API Key

curl -X POST http://localhost:3000/api/v1/auth/register \
  -H "Content-Type: application/json" \
  -d "{\"email\":\"test@example.com\",\"password\":\"Test123!@#\",\"name\":\"Test User\"}"

Save the API key from the response.

2. Generate a Video

curl -X POST http://localhost:3000/api/v1/generate \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d "{\"prompt\":\"A beautiful sunset over mountains\",\"quality\":\"hd\",\"duration\":5}"

3. Check Status

curl http://localhost:3000/api/v1/generate/status/JOB_ID

📊 Optional: Admin UIs

To start with admin UIs:

docker-compose --profile optional up -d

This adds:


🐛 Common Issues & Solutions

Issue: Docker services won't start

Solution:

  1. Make sure Docker Desktop is running
  2. Check if ports are already in use:
    netstat -an | findstr "5432 6379 9200"
  3. Stop conflicting services or change ports in docker-compose.yml

Issue: npm install fails

Solution:

  1. Delete node_modules and package-lock.json
  2. Run npm cache clean --force
  3. Run npm install again

Issue: Migrations fail

Solution:

  1. Check PostgreSQL is running: docker ps | findstr postgres
  2. Verify DATABASE_URL in .env is correct
  3. Check PostgreSQL logs: docker logs videogen-postgres

Issue: "Module not found" errors

Solution:

  1. Make sure you ran npm install in the backend directory
  2. Check Node.js version: node --version (should be 18+)
  3. Try: npm install --legacy-peer-deps

Issue: Port 3000 already in use

Solution:

# Find process using port 3000
netstat -ano | findstr :3000

# Kill the process (replace PID)
taskkill /PID <PID> /F

# Or change PORT in .env
PORT=3001

Issue: Elasticsearch won't start (Windows)

Solution:

  1. Increase Docker memory to at least 4GB (Docker Desktop settings)
  2. Add to docker-compose.yml under elasticsearch:
    environment:
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"

📁 Project Structure

VideoGenMessenger/
├── backend/                 # Backend API
│   ├── api/                # Routes & controllers
│   ├── services/           # Business logic
│   ├── models/             # Database models
│   ├── workers/            # Background workers
│   ├── scripts/            # Setup & utility scripts
│   ├── .env               # YOUR CONFIG (create this)
│   └── package.json
├── ios/                    # iOS iMessage extension
├── docs/                   # Documentation
├── docker-compose.yml      # Infrastructure config
├── setup.bat              # Windows setup script
├── QUICK_START.md         # Quick start guide
├── API_KEYS_GUIDE.md      # How to get API keys
└── AGENT_SWARM_SUMMARY.md # Complete implementation summary

🎯 Next Steps After Setup

  1. Read the documentation:

    • QUICK_START.md - Quick reference
    • docs/API.md - API documentation
    • docs/ARCHITECTURE.md - System design
  2. Test the API:

    • Generate a video
    • Search for videos
    • Test authentication
  3. Set up iOS app (requires Mac):

    • See ios/README.md
    • Transfer files to Mac
    • Build in Xcode
  4. Deploy to production:

    • See docs/DEPLOYMENT.md
    • Set up AWS infrastructure
    • Configure monitoring

🆘 Getting Help

Documentation

  • QUICK_START.md - Quick reference
  • API_KEYS_GUIDE.md - API key acquisition
  • docs/TROUBLESHOOTING.md - Common problems
  • AGENT_SWARM_SUMMARY.md - Implementation details

Check Logs

# Server logs
cd backend
type logs\combined.log

# Error logs
type logs\error.log

# Docker logs
docker logs videogen-postgres
docker logs videogen-redis
docker logs videogen-elasticsearch

Community

  • GitHub Issues
  • Stack Overflow (tag: videogen-messenger)

✅ Setup Complete Checklist

  • Node.js 18+ installed
  • Docker Desktop installed and running
  • Dependencies installed (npm install)
  • .env file created and configured
  • At least one AI provider API key added
  • AWS credentials configured
  • Docker services running (docker-compose ps)
  • Database migrations completed
  • Server starts without errors
  • Health endpoint returns 200 OK
  • Workers start successfully
  • Test video generation works

🎉 Ready to build! Start coding with:

cd backend
npm run dev

Check out the API docs: docs/API.md