-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdev.sh
More file actions
executable file
·63 lines (52 loc) · 2.54 KB
/
dev.sh
File metadata and controls
executable file
·63 lines (52 loc) · 2.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# Launch the Patent Diagram Generator web application for development.
#
# This starts:
# 1. FastAPI backend on port 8000
# 2. Vite dev server on port 5173 (proxies /api and /editor to backend)
#
# Usage:
# ./dev.sh
# open http://localhost:5173
#
set -e
ROOT="$(cd "$(dirname "$0")" && pwd)"
# ── Colors ──────────────────────────────────────────────────────
RED='\033[0;31m'
GREEN='\033[0;32m'
CYAN='\033[0;36m'
NC='\033[0m'
echo -e "${CYAN}════════════════════════════════════════════════════════${NC}"
echo -e "${CYAN} Patent Diagram Generator — Dev Server${NC}"
echo -e "${CYAN}════════════════════════════════════════════════════════${NC}"
# ── Check dependencies ──────────────────────────────────────────
echo -e "\n${GREEN}[1/4]${NC} Checking Python dependencies…"
pip install -q -r "$ROOT/backend/requirements.txt"
echo -e "${GREEN}[2/4]${NC} Checking Node dependencies…"
cd "$ROOT/frontend"
if [ ! -d node_modules ]; then
npm install
fi
# ── Start backend ───────────────────────────────────────────────
echo -e "${GREEN}[3/4]${NC} Starting FastAPI backend on :8000…"
cd "$ROOT/backend"
uvicorn main:app --host 0.0.0.0 --port 8000 --reload --reload-dir "$ROOT/backend" &
BACKEND_PID=$!
# ── Start frontend dev server ──────────────────────────────────
echo -e "${GREEN}[4/4]${NC} Starting Vite dev server on :5173…"
cd "$ROOT/frontend"
npx vite &
FRONTEND_PID=$!
echo -e "\n${GREEN}✓ Ready!${NC}"
echo -e " Frontend: ${CYAN}http://localhost:5173${NC}"
echo -e " Backend: ${CYAN}http://localhost:8000${NC}"
echo -e " Editor: ${CYAN}http://localhost:8000/editor/method-draw/${NC}"
echo -e "\n Press Ctrl+C to stop.\n"
# ── Cleanup on exit ─────────────────────────────────────────────
cleanup() {
echo -e "\n${RED}Shutting down…${NC}"
kill $BACKEND_PID 2>/dev/null
kill $FRONTEND_PID 2>/dev/null
wait
}
trap cleanup SIGINT SIGTERM
wait