strat-gameplay-webapp/start-services.sh
Cal Corum 6e3aad9fdf CLAUDE: Add developer utilities and access control documentation
Added helper scripts and documentation for improved developer experience:

1. ACCESS_CONTROL.md
   - Comprehensive Discord whitelist documentation
   - Configuration examples and security best practices
   - Troubleshooting guide for common access issues
   - Details both OAuth and test token protection points

2. start-services.sh
   - One-command startup for backend + frontend
   - Logs to logs/ directory with PIDs tracked
   - Displays URLs and helpful information
   - 3-second backend initialization delay

3. stop-services.sh
   - Clean shutdown with process tree killing
   - Removes orphaned processes by pattern matching
   - Graceful TERM followed by KILL if needed
   - Cleans up PID files

These utilities streamline local development by:
- Reducing manual startup steps
- Ensuring clean shutdown (no orphaned processes)
- Providing clear access control guidance

Scripts are now executable and ready to use:
  ./start-services.sh
  ./stop-services.sh

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 22:25:19 -06:00

49 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# Start both backend and frontend services for SBA gameplay testing
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
LOG_DIR="$SCRIPT_DIR/logs"
# Create logs directory if it doesn't exist
mkdir -p "$LOG_DIR"
echo "🚀 Starting SBA Gameplay Services..."
echo ""
# Start Backend
echo "📡 Starting Backend (FastAPI + Socket.io)..."
cd "$SCRIPT_DIR/backend"
uv run python -m app.main > "$LOG_DIR/backend.log" 2>&1 &
BACKEND_PID=$!
echo " Backend started with PID: $BACKEND_PID"
echo " Logs: $LOG_DIR/backend.log"
echo " API: http://localhost:8000"
echo ""
# Wait for backend to initialize
sleep 3
# Start Frontend
echo "🎨 Starting Frontend (Nuxt 3)..."
cd "$SCRIPT_DIR/frontend-sba"
npm run dev > "$LOG_DIR/frontend.log" 2>&1 &
FRONTEND_PID=$!
echo " Frontend started with PID: $FRONTEND_PID"
echo " Logs: $LOG_DIR/frontend.log"
echo " URL: http://localhost:3000"
echo ""
# Save PIDs for stop script
echo "$BACKEND_PID" > "$LOG_DIR/backend.pid"
echo "$FRONTEND_PID" > "$LOG_DIR/frontend.pid"
echo "✅ Services started successfully!"
echo ""
echo "📊 To view logs:"
echo " Backend: tail -f $LOG_DIR/backend.log"
echo " Frontend: tail -f $LOG_DIR/frontend.log"
echo ""
echo "🛑 To stop services: ./stop-services.sh"