# Atomizer Dashboard Launcher (PowerShell) # Run with: powershell -ExecutionPolicy Bypass -File Start-Dashboard.ps1 $ErrorActionPreference = "Stop" # Configuration $BackendPort = 8000 $FrontendPort = 5173 $CondaEnv = "atomizer" $ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path Write-Host "" Write-Host " ╔═══════════════════════════════════════════════════════════╗" -ForegroundColor Cyan Write-Host " ║ ATOMIZER DASHBOARD LAUNCHER ║" -ForegroundColor Cyan Write-Host " ╚═══════════════════════════════════════════════════════════╝" -ForegroundColor Cyan Write-Host "" # Function to check if port is in use function Test-PortInUse { param($Port) $connection = Get-NetTCPConnection -LocalPort $Port -ErrorAction SilentlyContinue return $null -ne $connection } # Check if ports are already in use if (Test-PortInUse $BackendPort) { Write-Host "[WARNING] Port $BackendPort is already in use. Backend may already be running." -ForegroundColor Yellow } if (Test-PortInUse $FrontendPort) { Write-Host "[WARNING] Port $FrontendPort is already in use. Frontend may already be running." -ForegroundColor Yellow } # Find conda $condaPath = "C:\Users\antoi\anaconda3\Scripts\conda.exe" if (-not (Test-Path $condaPath)) { Write-Host "[ERROR] Conda not found at $condaPath" -ForegroundColor Red Read-Host "Press Enter to exit" exit 1 } Write-Host "[1/3] Starting Backend Server (port $BackendPort)..." -ForegroundColor Green # Start backend in new window $backendScript = @" cd /d "$ScriptDir\backend" call conda activate $CondaEnv python -m uvicorn api.main:app --reload --port $BackendPort pause "@ Start-Process cmd -ArgumentList "/k", "title Atomizer Backend && conda activate $CondaEnv && cd /d `"$ScriptDir\backend`" && python -m uvicorn api.main:app --reload --port $BackendPort" Start-Sleep -Seconds 3 Write-Host "[2/3] Starting Frontend Dev Server..." -ForegroundColor Green # Start frontend in new window Start-Process cmd -ArgumentList "/k", "title Atomizer Frontend && cd /d `"$ScriptDir\frontend`" && npm run dev" Start-Sleep -Seconds 5 Write-Host "[3/3] Opening browser..." -ForegroundColor Green Write-Host "" Write-Host " ╔═══════════════════════════════════════════════════════════╗" -ForegroundColor Cyan Write-Host " ║ Dashboard is starting up! ║" -ForegroundColor Cyan Write-Host " ║ ║" -ForegroundColor Cyan Write-Host " ║ Backend: http://localhost:$BackendPort ║" -ForegroundColor White Write-Host " ║ Frontend: http://localhost:$FrontendPort ║" -ForegroundColor White Write-Host " ║ ║" -ForegroundColor Cyan Write-Host " ║ Close the terminal windows to stop the servers. ║" -ForegroundColor Cyan Write-Host " ╚═══════════════════════════════════════════════════════════╝" -ForegroundColor Cyan Write-Host "" # Open browser Start-Process "http://localhost:$FrontendPort" Write-Host "Dashboard launched! You can close this window." -ForegroundColor Green Write-Host "" Read-Host "Press Enter to exit this launcher"