Files
archy/packages/app/scripts/dev.sh
T
DorianandClaude Opus 4.6 cc7d9fc19e fix(app): add dev server auth token to all API endpoints
Generate random VITE_DEV_API_TOKEN in dev.sh, validate Bearer token
in shared server/dev-auth.ts middleware. Applied to all Vite plugins
(fs, dev-chats, rss, web-search, tmdb, music-search) and claude-proxy.
Client-side uses apiFetch() wrapper to attach the token automatically.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 01:23:17 +00:00

39 lines
952 B
Bash
Executable File

#!/usr/bin/env bash
# Start Claude proxy and Vite dev server together.
# Both are killed when either exits or when this script receives SIGINT/SIGTERM.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
APP_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
cd "$APP_DIR"
# Generate a dev API token if not already set
if [ -z "$VITE_DEV_API_TOKEN" ]; then
export VITE_DEV_API_TOKEN=$(openssl rand -hex 16)
fi
cleanup() {
kill 0 2>/dev/null || true
wait 2>/dev/null || true
}
trap cleanup EXIT INT TERM
# Use local node_modules binaries
BIN="$APP_DIR/node_modules/.bin"
# Start Claude proxy in background (skip gracefully if already running on :3141)
if lsof -ti:3141 > /dev/null 2>&1; then
echo " Claude proxy already running on :3141 — skipping"
else
"$BIN/tsx" server/claude-proxy.ts &
sleep 0.3
fi
# Start Vite dev server in background
"$BIN/vite" --host &
# Wait for all background jobs (compatible with bash 3.2 on macOS)
wait