-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.sh
More file actions
executable file
·73 lines (61 loc) · 1.49 KB
/
start.sh
File metadata and controls
executable file
·73 lines (61 loc) · 1.49 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
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/env bash
#
# Madrox — Start backend + frontend with a single command
#
# Usage:
# ./start.sh # Start both servers
# ./start.sh --be # Backend only (port 8001)
# ./start.sh --fe # Frontend only (port 3002)
#
# Note: When installed as a Claude Code plugin, start_plugin.sh is used instead.
set -e
ROOT_DIR="$(cd "$(dirname "$0")" && pwd)"
BE_PID=""
FE_PID=""
cleanup() {
echo ""
echo "Shutting down..."
[ -n "$FE_PID" ] && kill "$FE_PID" 2>/dev/null
[ -n "$BE_PID" ] && kill "$BE_PID" 2>/dev/null
wait 2>/dev/null
echo "Done."
}
trap cleanup EXIT INT TERM
start_backend() {
echo "Starting backend (port 8001)..."
cd "$ROOT_DIR"
# Activate venv if not already active
if [ -z "$VIRTUAL_ENV" ] && [ -f ".venv/bin/activate" ]; then
source .venv/bin/activate
fi
MADROX_TRANSPORT=http python run_orchestrator.py &
BE_PID=$!
}
start_frontend() {
echo "Starting frontend (port 3002)..."
cd "$ROOT_DIR/frontend"
# Install deps if needed
if [ ! -d "node_modules" ]; then
echo "Installing frontend dependencies..."
npm install
fi
npx next dev -p 3002 &
FE_PID=$!
}
# Parse args
case "${1:-}" in
--be) start_backend ;;
--fe) start_frontend ;;
*)
start_backend
sleep 2 # Let backend bind before frontend starts
start_frontend
;;
esac
echo ""
[ -n "$BE_PID" ] && echo " Backend: http://localhost:8001"
[ -n "$FE_PID" ] && echo " Dashboard: http://localhost:3002"
echo ""
echo " Press Ctrl+C to stop"
echo ""
wait