#!/bin/sh set -e echo "Running migrations..." node scripts/run-migrations.js echo "Starting API server on :3000..." node dist/server/index.js & echo "Waiting for API..." until node -e "require('http').get('http://localhost:3000/health', r => process.exit(r.statusCode===200?0:1)).on('error',()=>process.exit(1))" 2>/dev/null; do sleep 1 done echo "Starting Next.js on :3001..." exec node_modules/.bin/next start -p 3001