Repository Public
1#!/bin/zsh2# Local development stack: API (with the job worker inline) on 127.0.0.1:8661 and the Vite dev server on3# http://localhost:5183 (which proxies /api). Real PostgreSQL database sp_drive_dev, data under .dev/.4# Usage: scripts/dev-stack.sh [--reset] — then: scripts/dev-invite.sh you@example.com5set -euo pipefail6cd "$(dirname "$0")/.."7PG=/opt/homebrew/opt/postgresql@17/bin8[[ "${1:-}" == "--reset" ]] && { $PG/dropdb -h 127.0.0.1 --if-exists sp_drive_dev; rm -rf .dev; }9$PG/createdb -h 127.0.0.1 sp_drive_dev 2>/dev/null || true10mkdir -p .dev11source scripts/dev-env.sh12[[ -f .dev/master.key ]] || pnpm -s exec tsx services/api/src/cli.ts init-key13pkill -f "sp-drive-dev-api" 2>/dev/null || true; pkill -f "vite.*5183" 2>/dev/null || true14(exec -a sp-drive-dev-api node --import tsx services/api/src/main.ts > .dev/api.log 2>&1) &15(cd apps/web && exec node_modules/.bin/vite --port 5183 --strictPort > ../../.dev/web.log 2>&1) &16for i in {1..60}; do curl -sf http://127.0.0.1:8661/api/v1/health/live >/dev/null && break; sleep 0.5; done17curl -sf http://127.0.0.1:8661/api/v1/health/live >/dev/null && echo "API ready on :8661, web on http://localhost:5183 (logs in .dev/)" || { echo "API did not start:"; tail -20 .dev/api.log; exit 1; }18