-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.sh
More file actions
executable file
·58 lines (48 loc) · 1.8 KB
/
start.sh
File metadata and controls
executable file
·58 lines (48 loc) · 1.8 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
#!/bin/bash
# Lexis — single-command launcher
# Usage: ./start.sh (or double-click in Finder after chmod +x)
set -e
DIR="$(cd "$(dirname "$0")" && pwd)"
echo "→ Killing any existing processes on ports 8000 and 5173..."
lsof -ti :8000 | xargs kill -9 2>/dev/null || true
lsof -ti :5173 | xargs kill -9 2>/dev/null || true
sleep 0.5
echo "→ Starting backend (uvicorn on :8000)..."
cd "$DIR"
uvicorn server:app --port 8000 > /tmp/lexis-backend.log 2>&1 &
BACKEND_PID=$!
echo "→ Starting frontend (vite on :5173)..."
cd "$DIR/frontend"
npm run dev > /tmp/lexis-frontend.log 2>&1 &
FRONTEND_PID=$!
# Wait for frontend to be ready
echo "→ Waiting for servers to boot..."
for i in $(seq 1 30); do
if curl -s http://localhost:5173 > /dev/null 2>&1; then
break
fi
sleep 0.5
done
echo "→ Opening http://localhost:5173 ..."
open "http://localhost:5173"
echo ""
echo "╔══════════════════════════════════════════════╗"
echo "║ Lexis is running ║"
echo "║ Frontend → http://localhost:5173 ║"
echo "║ Backend → http://localhost:8000 ║"
echo "║ ║"
echo "║ Logs: tail -f /tmp/lexis-backend.log ║"
echo "║ Press Ctrl+C to stop both servers ║"
echo "╚══════════════════════════════════════════════╝"
# Stream both logs to terminal
tail -f /tmp/lexis-backend.log /tmp/lexis-frontend.log &
TAIL_PID=$!
# On Ctrl+C, kill everything
cleanup() {
echo ""
echo "→ Shutting down..."
kill $BACKEND_PID $FRONTEND_PID $TAIL_PID 2>/dev/null
exit 0
}
trap cleanup INT TERM
wait $BACKEND_PID