betfun-arena/scripts/start-dev.sh

56 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
# BetFun Arena - Development Startup Script
echo "๐Ÿš€ Starting BetFun Arena Development Environment..."
echo ""
# Check if .env files exist
if [ ! -f "apps/web/.env.local" ]; then
echo "โš ๏ธ Frontend .env.local not found!"
echo "Run 'npm run setup:env' first."
exit 1
fi
if [ ! -f "packages/api/.env" ]; then
echo "โš ๏ธ API .env not found!"
echo "Run 'npm run setup:env' first."
exit 1
fi
# Check if node_modules exist
if [ ! -d "node_modules" ]; then
echo "๐Ÿ“ฆ Installing dependencies..."
npm install
fi
# Check if Redis is running
if ! redis-cli ping > /dev/null 2>&1; then
echo "โš ๏ธ Redis is not running!"
echo "Starting Redis..."
if command -v redis-server &> /dev/null; then
redis-server --daemonize yes
echo "โœ… Redis started"
else
echo "โŒ Redis not installed. Install with: brew install redis"
echo "Or use Redis Cloud: https://redis.com/try-free/"
exit 1
fi
fi
# Start all services
echo ""
echo "๐ŸŽฏ Starting all services..."
echo ""
echo "๐Ÿ“ฑ Frontend: http://localhost:3000"
echo "๐Ÿ”ง API: http://localhost:3001"
echo "๐Ÿ”Œ WebSocket: http://localhost:3002"
echo "๐Ÿ“ก Indexer: Running in background"
echo ""
echo "Press Ctrl+C to stop all services"
echo ""
# Use concurrently to run all services
npm run dev