From 4143141de578abe6e1a21b8d8bd49ec80a19d277 Mon Sep 17 00:00:00 2001 From: Bretton Date: Sat, 21 Feb 2026 12:10:50 -0800 Subject: [PATCH] chore(dev): refine dev proxy routing and update frontend tooling Narrow the Caddy /api/* catch-all to only proxy /api/me to the Go backend, since SvelteKit now owns /api/auth/* and /api/proxy/*. Update the dev script to auto-detect the coves-frontend directory (falling back to kelp) and switch from npm to pnpm. Changes: - Replace broad /api/* proxy rule with specific /api/me route - Add coves-frontend directory auto-detection in web-dev-run.sh - Switch frontend dev server from npm to pnpm - Normalize Caddyfile.dev indentation to tabs Co-Authored-By: Claude Opus 4.6 --- Caddyfile.dev | 49 +++++++++++++++++++++--------------------- scripts/web-dev-run.sh | 11 ++++++++-- 2 files changed, 34 insertions(+), 26 deletions(-) diff --git a/Caddyfile.dev b/Caddyfile.dev index 6c19d9a..4597c76 100644 --- a/Caddyfile.dev +++ b/Caddyfile.dev @@ -9,33 +9,34 @@ # Access at: http://localhost:8080 :8080 { - # OAuth routes -> Coves backend - handle /oauth/* { - reverse_proxy 127.0.0.1:8081 - } + # OAuth routes -> Coves backend + handle /oauth/* { + reverse_proxy 127.0.0.1:8081 + } - # XRPC API routes -> Coves backend - handle /xrpc/* { - reverse_proxy 127.0.0.1:8081 - } + # XRPC API routes -> Coves backend + handle /xrpc/* { + reverse_proxy 127.0.0.1:8081 + } - # OAuth client metadata -> Coves backend - handle /oauth-client-metadata.json { - reverse_proxy 127.0.0.1:8081 - } + # OAuth client metadata -> Coves backend + handle /oauth-client-metadata.json { + reverse_proxy 127.0.0.1:8081 + } - # Image proxy routes -> Coves backend - handle /img/* { - reverse_proxy 127.0.0.1:8081 - } + # Image proxy routes -> Coves backend + handle /img/* { + reverse_proxy 127.0.0.1:8081 + } - # API routes (if any) -> Coves backend - handle /api/* { - reverse_proxy 127.0.0.1:8081 - } + # Go backend API routes -> Coves backend + # Only route Go-specific endpoints here; SvelteKit owns /api/auth/* and /api/proxy/* + handle /api/me { + reverse_proxy 127.0.0.1:8081 + } - # Everything else -> Vite dev server (frontend) - handle { - reverse_proxy localhost:5173 - } + # Everything else -> Vite dev server (frontend) + handle { + reverse_proxy localhost:5173 + } } diff --git a/scripts/web-dev-run.sh b/scripts/web-dev-run.sh index 0d9fcc9..d07cb84 100755 --- a/scripts/web-dev-run.sh +++ b/scripts/web-dev-run.sh @@ -18,7 +18,14 @@ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" COVES_DIR="$(cd "$SCRIPT_DIR/.." && pwd)" # Frontend location (override with KELP_DIR env var) -KELP_DIR="${KELP_DIR:-$COVES_DIR/../kelp}" +# Try coves-frontend first, fall back to kelp for backwards compatibility +if [ -z "$KELP_DIR" ]; then + if [ -d "$COVES_DIR/../coves-frontend" ]; then + KELP_DIR="$COVES_DIR/../coves-frontend" + else + KELP_DIR="$COVES_DIR/../kelp" + fi +fi # Cleanup function cleanup() { @@ -52,7 +59,7 @@ fi # Start Vite in background echo "🚀 Starting Vite frontend (kelp) on :5173..." -cd "$KELP_DIR" && npm run dev & +cd "$KELP_DIR" && pnpm dev & VITE_PID=$! # Give Vite a moment to start -- 2.51.2