Set-Location $PSScriptRoot; npm --prefix backend run db:bootstrap; if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }; $apiUp = [bool](Get-NetTCPConnection -State Listen -LocalPort 4000 -ErrorAction SilentlyContinue); $webUp = [bool](Get-NetTCPConnection -State Listen -LocalPort 5173 -ErrorAction SilentlyContinue); if ($apiUp -and $webUp) { Write-Host 'API et frontend deja lances (4000, 5173).' } elseif ($apiUp) { npm --prefix frontend run dev -- --port 5173 --strictPort } elseif ($webUp) { npm --prefix backend run dev } else { Start-Process powershell -ArgumentList '-NoExit','-Command',"Set-Location '$PSScriptRoot'; npm --prefix backend run dev"; npm --prefix frontend run dev -- --port 5173 --strictPort }