Something went wrong. Try again.
A community based topic aggregation platform built on atproto
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778#!/bin/bash# Web frontend development server runner# Starts both Coves backend AND Vite frontend, uses Caddy proxy on port 8080## Usage: make run-web (or ./scripts/web-dev-run.sh)
set -a # automatically export all variablessource .env.devset +a
# Override for web frontend development# OAuth callback needs to use the proxy port (8080) for cookie sharing# MUST use 127.0.0.1 (not localhost) per RFC 8252 - PDS rejects localhost in redirect_uriexport APPVIEW_PUBLIC_URL="http://127.0.0.1:8080"
# Resolve paths relative to this script (no hardcoded absolute paths)SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"COVES_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
# Frontend location (override with COVES_FRONTEND_DIR env var)COVES_FRONTEND_DIR="${COVES_FRONTEND_DIR:-$COVES_DIR/../coves-frontend}"
# Cleanup functioncleanup() { echo "" echo "🛑 Shutting down..." # Kill the Vite process if it's running if [ -n "$VITE_PID" ]; then kill $VITE_PID 2>/dev/null wait $VITE_PID 2>/dev/null fi exit 0}
# Set up trap for clean shutdowntrap cleanup SIGINT SIGTERM
echo "🌐 Starting Coves WEB FRONTEND development environment..."echo ""echo " IS_DEV_ENV: $IS_DEV_ENV"echo " PLC_DIRECTORY_URL: $PLC_DIRECTORY_URL"echo " APPVIEW_PUBLIC_URL: $APPVIEW_PUBLIC_URL (via Caddy proxy)"echo " PDS_URL: $PDS_URL"echo " Build tags: dev"echo ""
# Check if the frontend directory existsif [ ! -d "$COVES_FRONTEND_DIR" ]; then echo "❌ Frontend directory not found: $COVES_FRONTEND_DIR" exit 1fi
# Start Vite in backgroundecho "🚀 Starting Vite frontend (coves-frontend) on :5173..."cd "$COVES_FRONTEND_DIR" && pnpm dev &VITE_PID=$!
# Give Vite a moment to startsleep 2
# Return to Coves directorycd "$COVES_DIR"
echo ""echo "🚀 Starting Coves backend on :8081..."echo ""echo " ⚠️ Make sure Caddy proxy is running: make web-proxy"echo " 📍 Access your app at: http://127.0.0.1:8080"echo ""echo " Press Ctrl+C to stop both services"echo ""
# Run Go server (foreground - will block)go run -tags dev ./cmd/server
# If Go server exits, clean up Vitecleanup