Create start-all.bat
This commit is contained in:
67
start-all.bat
Normal file
67
start-all.bat
Normal file
@@ -0,0 +1,67 @@
|
||||
@echo off
|
||||
REM Grateful Journal - Start All Services (Windows)
|
||||
REM Runs MongoDB, FastAPI backend, and Vite frontend in one command
|
||||
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
REM Color codes for output
|
||||
set "GREEN=[92m"
|
||||
set "YELLOW=[93m"
|
||||
set "RED=[91m"
|
||||
set "RESET=[0m"
|
||||
|
||||
echo.
|
||||
echo Starting Grateful Journal...
|
||||
echo.
|
||||
|
||||
REM Check if MongoDB is running on port 27017
|
||||
echo Checking MongoDB...
|
||||
netstat -ano | findstr :27017 >nul
|
||||
if !errorlevel! equ 0 (
|
||||
echo MongoDB already running on port 27017
|
||||
) else (
|
||||
echo MongoDB is not running. Please start MongoDB first.
|
||||
echo You can start MongoDB using:
|
||||
echo - MongoDB Compass GUI
|
||||
echo - mongod.exe from command line
|
||||
echo - MongoDB service (if installed as service^)
|
||||
echo.
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo.
|
||||
|
||||
REM Start Backend (FastAPI with Python venv)
|
||||
echo Starting FastAPI backend...
|
||||
if not exist "venv\Scripts\activate.bat" (
|
||||
echo Python venv not found. Creating virtual environment...
|
||||
python -m venv venv
|
||||
call venv\Scripts\activate.bat
|
||||
pip install -r backend\requirements.txt
|
||||
) else (
|
||||
call venv\Scripts\activate.bat
|
||||
)
|
||||
|
||||
start "Grateful Journal Backend" cmd /k "cd /d %CD% && venv\Scripts\python backend\main.py"
|
||||
echo Backend running on http://localhost:8001
|
||||
timeout /t 2 /nobreak
|
||||
|
||||
echo.
|
||||
|
||||
REM Start Frontend (Vite)
|
||||
echo Starting Vite frontend...
|
||||
start "Grateful Journal Frontend" cmd /k "cd /d %CD% && npm run dev -- --port 8000"
|
||||
echo Frontend running on http://localhost:8000
|
||||
timeout /t 2 /nobreak
|
||||
|
||||
echo.
|
||||
echo All services started!
|
||||
echo.
|
||||
echo Frontend: http://localhost:8000
|
||||
echo Backend: http://localhost:8001
|
||||
echo API Docs: http://localhost:8001/docs
|
||||
echo.
|
||||
echo To stop services, close the command windows or press Ctrl+C in each window.
|
||||
echo.
|
||||
pause
|
||||
Reference in New Issue
Block a user