const { spawn } = require('child_process'); const path = require('path'); const isWindows = process.platform === 'win32'; const backendDir = path.join(__dirname, 'backend'); const frontendDir = path.join(__dirname, 'frontend'); const backend = spawn( isWindows ? '.venv\\Scripts\\python.exe' : 'python', isWindows ? ['-m', 'uvicorn', 'main:app', '--reload'] : ['-m', 'uvicorn', 'main:app', '--reload'], { cwd: backendDir, shell: true, stdio: 'inherit' } ); const frontend = spawn(isWindows ? 'npm.cmd' : 'npm', ['run', 'dev'], { cwd: frontendDir, shell: true, stdio: 'inherit' }); console.log('\n--- Backend (FastAPI) running at http://127.0.0.1:8000 ---\n'); console.log('--- Frontend (Next.js) running at http://localhost:3000 ---\n'); const cleanup = () => { console.log('\n\nShutting down servers...'); backend.kill(); frontend.kill(); process.exit(0); }; process.on('SIGINT', cleanup); process.on('SIGTERM', cleanup);