#!/bin/bash echo "๐Ÿš€ Starting Storyteller Development Environment for iOS" echo "================================================" # Check if running from project root if [ ! -f "package.json" ]; then echo "โŒ Please run this script from the project root directory" exit 1 fi # Kill any existing processes on ports echo "๐Ÿงน Cleaning up existing processes..." lsof -ti:3002 | xargs kill -9 2>/dev/null lsof -ti:8081 | xargs kill -9 2>/dev/null # Start backend in background echo "๐Ÿ”ง Starting backend server on port 3002..." cd apps/backend npm run dev & BACKEND_PID=$! cd ../.. # Wait for backend to start echo "โณ Waiting for backend to be ready..." sleep 5 # Check if backend is running if ! curl -s http://localhost:3002/health > /dev/null; then echo "โš ๏ธ Backend might not be ready yet, but continuing..." fi # Start mobile app for iOS echo "๐Ÿ“ฑ Starting iOS app with Expo..." cd apps/mobile # Clear Metro bundler cache echo "๐Ÿ—‘๏ธ Clearing Metro bundler cache..." npx expo start -c --ios & MOBILE_PID=$! echo "" echo "โœ… Development environment started!" echo "==================================" echo "๐Ÿ“ฑ iOS app: Expo Dev Tools will open" echo "๐Ÿ”ง Backend: http://localhost:3002" echo "๐Ÿ“š API Docs: http://localhost:3002/api-docs" echo "" echo "Press Ctrl+C to stop all services" # Wait for user interrupt trap "echo '๐Ÿ›‘ Stopping services...'; kill $BACKEND_PID $MOBILE_PID 2>/dev/null; exit" INT wait