diff --git a/scripts/dev-up.ps1 b/scripts/dev-up.ps1 new file mode 100644 index 0000000..1ed96ae --- /dev/null +++ b/scripts/dev-up.ps1 @@ -0,0 +1,49 @@ +#!/usr/bin/env pwsh +<# +.SYNOPSIS + Bring up the full local dev stack: Postgres + backend API + Vite frontend. + +.DESCRIPTION + Starts the dev Postgres container (via dev-db.ps1), then spawns the API and + frontend in their own PowerShell windows so each keeps its own scrollback + and Ctrl+C only kills the intended process. The API log window is where + invite/reset email links print (LoggingEmailSender output). + + Stop everything by closing the two spawned windows. The DB stays up across + runs; use './scripts/dev-db.ps1 stop' or 'reset' to manage it explicitly. + +.EXAMPLE + ./scripts/dev-up.ps1 +#> +param() + +$ErrorActionPreference = 'Stop' + +$RepoRoot = Resolve-Path "$PSScriptRoot/.." + +# 1. Database +& "$PSScriptRoot/dev-db.ps1" start + +# 2. Backend API. Tag the window title so it's easy to find when stopping. +Write-Host "Launching backend in a new window..." -ForegroundColor Cyan +Start-Process pwsh -ArgumentList @( + '-NoExit', + '-Command', + "`$Host.UI.RawUI.WindowTitle = 'YesChef API'; dotnet run --project '$RepoRoot/src/backend/YesChef.Api'" +) + +# 3. Frontend (Vite dev server, with the existing /api + /hubs proxy). +Write-Host "Launching frontend in a new window..." -ForegroundColor Cyan +Start-Process pwsh -ArgumentList @( + '-NoExit', + '-Command', + "`$Host.UI.RawUI.WindowTitle = 'YesChef Frontend'; npm --prefix '$RepoRoot/src/frontend' run dev" +) + +Write-Host "" +Write-Host "Stack is starting. URLs:" -ForegroundColor Green +Write-Host " Frontend: http://localhost:5173" +Write-Host " API : http://localhost:5291" +Write-Host "" +Write-Host "Invite and password-reset links print to the API window (LoggingEmailSender)." +Write-Host "Close the two spawned windows to stop. DB remains up; manage with scripts/dev-db.ps1."