#!/bin/bash # Define colors RED='\033[0;31m' YELLOW='\033[1;33m' GREEN='\033[0;32m' BLUE='\033[0;34m' NC='\033[0m' # No Color # Required Node.js version REQUIRED_NODE_VERSION="v22.15.0" # Check Node.js version NODE_VERSION=$(node -v 2>/dev/null) if [ "$NODE_VERSION" != "$REQUIRED_NODE_VERSION" ]; then echo -e "${YELLOW}Warning:${NC} Node.js version is $NODE_VERSION, but required is $REQUIRED_NODE_VERSION." else echo -e "${GREEN}Node.js version is correct: $NODE_VERSION${NC}" fi SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" REPO_ROOT="$SCRIPT_DIR/.." # Start the backend server cd "$REPO_ROOT/backend" || exit 1 echo -e "${BLUE}Starting backend server...${NC}" go run main.go & BACKEND_PID=$! echo -e "${GREEN}Backend server started with PID $BACKEND_PID.${NC}" # Start the frontend dev server from anywhere in the repo cd "$REPO_ROOT/frontend" || exit 1 # Install dependencies if [ -f package.json ]; then echo -e "${BLUE}Installing dependencies...${NC}" npm install echo -e "${GREEN}Dependencies installed.${NC}" else echo -e "${RED}Error:${NC} package.json not found in frontend directory!" exit 1 fi # Run dev server echo -e "${BLUE}Starting dev server...${NC}" npm run dev