@echo off setlocal set "ROOT=%~dp0" set "BACKEND_PORT=8887" set "FRONTEND_PORT=8886" where php >nul 2>&1 if errorlevel 1 ( echo [ERROR] PHP was not found in PATH. pause exit /b 1 ) where npm >nul 2>&1 if errorlevel 1 ( echo [ERROR] npm was not found in PATH. pause exit /b 1 ) if not exist "%ROOT%backend\artisan" ( echo [ERROR] Backend was not found at "%ROOT%backend". pause exit /b 1 ) if not exist "%ROOT%frontend\package.json" ( echo [ERROR] Frontend was not found at "%ROOT%frontend". pause exit /b 1 ) set "VITE_BACKEND_URL=http://127.0.0.1:%BACKEND_PORT%" set "VITE_FRONTEND_HOST=127.0.0.1" set "VITE_FRONTEND_PORT=%FRONTEND_PORT%" echo Applying database migrations... pushd "%ROOT%backend" php artisan migrate --force if errorlevel 1 ( popd echo [ERROR] Database migration failed. Project was not started. pause exit /b 1 ) echo Synchronizing role permissions... php artisan permissions:sync-defaults if errorlevel 1 ( popd echo [ERROR] Permission synchronization failed. Project was not started. pause exit /b 1 ) popd echo Starting backend at http://127.0.0.1:%BACKEND_PORT% ... start "CRM Backend - %BACKEND_PORT%" /D "%ROOT%backend" cmd /k "php artisan serve --host=127.0.0.1 --port=%BACKEND_PORT%" echo Starting frontend at http://127.0.0.1:%FRONTEND_PORT% ... start "CRM Frontend - %FRONTEND_PORT%" /D "%ROOT%frontend" cmd /k "npm exec vite -- --host 127.0.0.1 --port %FRONTEND_PORT%" echo. echo Project processes were opened in separate windows. exit /b 0