Files
jiang13-bbs/start.bat
freefire 5052bcd805 chore(dev): 按端口杀进程树,避免 Windows 孤儿监听
新增 stop.bat/ps1/sh,并写入本地开发规则:停服务用脚本、停后复核端口。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-16 07:27:45 +08:00

65 lines
1.8 KiB
Batchfile

@echo off
title jiang13-bbs launcher
echo ============================================
echo jiang13-bbs Dev Launcher
echo ============================================
echo.
REM ---- 1. Start PostgreSQL ----
echo [1/3] Starting database (Docker Compose)...
docker compose up -d postgres
if errorlevel 1 (
echo [FAIL] Database failed to start. Is Docker running?
pause
exit /b 1
)
echo [OK] Database started
echo.
REM ---- 2. Backend ----
echo [2/3] Checking backend config...
if not exist "backend\app.ini" (
copy "backend\app.ini.example" "backend\app.ini" >nul
echo Created backend\app.ini from template
)
if not exist "backend\data" mkdir "backend\data"
echo Starting backend (port 3001, cwd=backend, data=backend\data)...
start "jiang13-backend" cmd /k "cd /d %~dp0backend && go run ./cmd/jiang13"
echo [OK] Backend started
echo.
REM ---- 3. Frontend ----
echo [3/3] Checking frontend config...
if not exist "frontend\.env.local" (
copy "frontend\.env.example" "frontend\.env.local" >nul
echo Created frontend\.env.local from template
)
if not exist "frontend\node_modules" (
echo First run, installing dependencies...
cd /d %~dp0frontend
call npm install
cd /d %~dp0
)
echo Starting frontend (port 3000)...
start "jiang13-frontend" cmd /k "cd /d %~dp0frontend && npm run dev"
echo [OK] Frontend started
echo.
echo ============================================
echo All services started!
echo.
echo Frontend: http://localhost:3000
echo Backend: http://localhost:3001
echo Data dir: %~dp0backend\data
echo Database: localhost:5432
echo.
echo Prefer stop: stop.bat (kills :3000/:3001 process trees)
echo Or close each service window.
echo Stop database: docker compose down
echo ============================================
pause