-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstartup.sh
More file actions
executable file
·65 lines (52 loc) · 1.83 KB
/
startup.sh
File metadata and controls
executable file
·65 lines (52 loc) · 1.83 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
#!/bin/bash
# Shutdown any running backend/frontend processes for a clean start
./shutdown.sh
# Startup script for AI Code Walkthrough App
# Run from the root of the project folder
set -e
BACKEND_DIR="app/backend"
FRONTEND_DIR="app/frontend"
# Copy sample.env.txt to .env files if they don't exist
echo "Setting up environment files..."
if [ -f "$BACKEND_DIR/sample.env.txt" ] && [ ! -f "$BACKEND_DIR/.env" ]; then
cp "$BACKEND_DIR/sample.env.txt" "$BACKEND_DIR/.env"
echo "Created $BACKEND_DIR/.env from sample.env.txt"
elif [ -f "$BACKEND_DIR/sample.env.txt" ] && [ -f "$BACKEND_DIR/.env" ]; then
echo "$BACKEND_DIR/.env already exists, skipping copy"
fi
if [ -f "$FRONTEND_DIR/sample.env.txt" ] && [ ! -f "$FRONTEND_DIR/.env" ]; then
cp "$FRONTEND_DIR/sample.env.txt" "$FRONTEND_DIR/.env"
echo "Created $FRONTEND_DIR/.env from sample.env.txt"
elif [ -f "$FRONTEND_DIR/sample.env.txt" ] && [ -f "$FRONTEND_DIR/.env" ]; then
echo "$FRONTEND_DIR/.env already exists, skipping copy"
fi
# Install backend dependencies (only backend requirements)
echo "Installing backend dependencies..."
cd "$BACKEND_DIR"
uv venv --python=3.12
source .venv/bin/activate
uv pip install --upgrade pip
uv pip install -r requirements.txt
cd -
# Install frontend dependencies (only frontend requirements)
echo "Installing frontend dependencies..."
cd "$FRONTEND_DIR"
uv venv --python python3.12
source .venv/bin/activate
uv pip install -r requirements.txt
cd -
# Start backend
echo "Starting FastAPI backend..."
cd "$BACKEND_DIR"
source .venv/bin/activate
nohup uvicorn main:app --reload > backend.log 2>&1 &
cd -
# Start frontend
echo "Starting Python Flask frontend..."
cd "$FRONTEND_DIR"
source .venv/bin/activate
nohup python app.py > frontend.log 2>&1 &
cd -
echo "App launched!"
echo "Backend: http://localhost:8000"
echo "Frontend: http://localhost:5173"