-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.sh
More file actions
executable file
·55 lines (46 loc) · 2.03 KB
/
start.sh
File metadata and controls
executable file
·55 lines (46 loc) · 2.03 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
#!/bin/bash
# ResearchOS — start backend + frontend in one command
# Usage: ./start.sh (or add to PATH and just run: researchos)
set -e
DIR="$(cd "$(dirname "$0")" && pwd)"
echo "🔬 Starting ResearchOS..."
# ── Kill anything already using our ports ─────────────────────────────────────
for PORT in 8000 3000; do
PID=$(lsof -ti tcp:$PORT 2>/dev/null || true)
if [ -n "$PID" ]; then
echo " → Killing existing process on port $PORT (PID $PID)"
kill -9 $PID 2>/dev/null || true
fi
done
# Wait for ports to be fully released
sleep 2
# ── Backend ───────────────────────────────────────────────────────────────────
echo " → Starting backend (FastAPI) on http://localhost:8000 ..."
cd "$DIR/backend"
python -m uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload &
BACKEND_PID=$!
# ── Frontend ──────────────────────────────────────────────────────────────────
echo " → Starting frontend (Next.js) on http://localhost:3000 ..."
cd "$DIR/frontend"
npm run dev &
FRONTEND_PID=$!
# ── Cleanup on exit ───────────────────────────────────────────────────────────
cleanup() {
echo ""
echo "🛑 Shutting down..."
kill $BACKEND_PID 2>/dev/null
kill $FRONTEND_PID 2>/dev/null
wait $BACKEND_PID 2>/dev/null
wait $FRONTEND_PID 2>/dev/null
echo " Done."
}
trap cleanup EXIT INT TERM
echo ""
echo "✅ ResearchOS is running!"
echo " Frontend: http://localhost:3000"
echo " Backend: http://localhost:8000"
echo " API docs: http://localhost:8000/docs"
echo ""
echo "Press Ctrl+C to stop."
# Wait for either process to exit
wait