import subprocess import os import time log_dir = "/mnt/fam/SERVER/IfixKartEcommerce/docs/12-ai/logs" os.makedirs(log_dir, exist_ok=True) # 1. Start Backend FastAPI backend_cwd = "/mnt/fam/SERVER/IfixKartEcommerce/Backend" backend_log = open(os.path.join(log_dir, "backend.log"), "a") subprocess.Popen( ["/mnt/fam/SERVER/IfixKartEcommerce/Backend/venv/bin/uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"], cwd=backend_cwd, stdout=backend_log, stderr=backend_log, start_new_session=True ) # 2. Start Admin Panel Next.js (port 3022) admin_cwd = "/mnt/fam/SERVER/IfixKartEcommerce/New admin panel/ikixkart-dashboard" admin_log = open(os.path.join(log_dir, "admin.log"), "a") subprocess.Popen( ["npx", "next", "dev", "-p", "3022"], cwd=admin_cwd, stdout=admin_log, stderr=admin_log, start_new_session=True ) # 3. Start Storefront Next.js (port 3021) storefront_cwd = "/mnt/fam/SERVER/IfixKartEcommerce/storefrontnewone/storefront" storefront_log = open(os.path.join(log_dir, "storefront.log"), "a") subprocess.Popen( ["npx", "next", "dev", "-p", "3021", "--turbo"], cwd=storefront_cwd, stdout=storefront_log, stderr=storefront_log, start_new_session=True ) print("Local daemon launcher executed successfully.")