Quick commands to manage all SmartBus services.
Starts all three services in separate PowerShell windows:
- AI Server (Python FastAPI) - Port 8000
- Backend (Node.js Express) - Port 5000
- Frontend (React Vite) - Port 5173
Usage:
.\start.ps1What it does:
- ✅ Checks if AI server exists
- ✅ Starts AI server with Python
- ✅ Starts backend with
npm run dev - ✅ Starts frontend with
npm run dev - ✅ Opens each in separate window for easy log viewing
Stops all running SmartBus services.
Usage:
.\stop.ps1What it does:
- ✅ Stops all Node.js processes (Backend + Frontend)
- ✅ Stops all Python processes (AI Server)
- ✅ Closes gracefully
Verifies Python and AI server dependencies are installed.
Usage:
cd smart-bus-ai
.\check-dependencies.ps1What it does:
- ✅ Checks Python installation
- ✅ Checks/creates virtual environment
- ✅ Verifies requirements.txt
- ✅ Checks installed packages
- ✅ Installs missing dependencies
- Install dependencies:
# Backend
cd smart-bus-backend
npm install
# Frontend
cd ../smart-bus-frontend
npm install
# AI Server
cd ../smart-bus-ai
python -m venv venv
venv\Scripts\Activate.ps1
pip install -r requirements.txt- Setup database:
cd smart-bus-backend
npm run init-db- Start everything:
cd ..
.\start.ps1Start all services:
.\start.ps1Access applications:
- Frontend: http://localhost:5173
- Backend API: http://localhost:5000
- AI Server: http://localhost:8000
Stop all services:
.\stop.ps1Or just close the PowerShell windows.
- Technology: Python, FastAPI, DeepFace
- Purpose: Face recognition, voice assistant, predictions
- Endpoints:
GET /health- Health checkPOST /ai/face/register- Register facePOST /ai/face/verify- Verify faceDELETE /ai/face/delete/:userId- Delete facePOST /ai/voice/query- Voice queriesPOST /ai/predict/low-balance- Balance predictions
- Technology: Node.js, Express, MySQL
- Purpose: Business logic, authentication, RFID management
- Key Endpoints:
POST /auth/register- User registrationPOST /auth/login- Login (password or face)PUT /auth/me/settings/face- Face auth settingsGET /auth/me- Get current userPOST /cards- Card managementPOST /transactions- Transactions
- Technology: React, Vite, TailwindCSS
- Purpose: User interface
- Features:
- User authentication (password + face)
- Dashboard
- Card management
- Face auth settings
- Real-time updates
cd smart-bus-ai
.\check-dependencies.ps1# Kill specific port
netstat -ano | findstr :8000
taskkill /PID <PID> /F.\stop.ps1
# Or manually:
Get-Process -Name "node","python" | Stop-Process -Force- Ensure HTTPS or use localhost
- Check browser permissions
- Verify AI server is running
Create .env files in each directory:
smart-bus-backend/.env
DB_HOST=localhost
DB_USER=root
DB_PASSWORD=your_password
DB_NAME=smartbus
JWT_SECRET=your_secret_key
AI_SERVER_URL=http://localhost:8000smart-bus-ai/.env
USE_LOCAL_LLM=true
LOCAL_LLM_MODEL=llama3.1
DB_HOST=localhost
DB_NAME=smartbus-
Development Mode: All services run with auto-reload
- Backend: nodemon watches for changes
- Frontend: Vite HMR (Hot Module Replacement)
- AI Server: FastAPI auto-reload
-
Production: Use proper process managers
- Backend: PM2
- Frontend: Build and serve static files
- AI Server: Gunicorn + systemd
-
Logs: Each service runs in separate window for easy debugging
| Script | Purpose | Usage |
|---|---|---|
start.ps1 |
Start all services | .\start.ps1 |
stop.ps1 |
Stop all services | .\stop.ps1 |
smart-bus-ai/check-dependencies.ps1 |
Check AI deps | cd smart-bus-ai; .\check-dependencies.ps1 |
Happy coding! 🚀