Smart Site
Home Docs Smart SCADA Installation Guide

Installation Guide

This guide introduces the complete installation process of Smart SCADA Editor from environment preparation to startup verification, covering both development and production build scenarios.

The SCADA editor is a frontend application and requires the backend Smart Data service for data binding and real-time communication capabilities.

1. Environment Requirements

1.1 Required Environment

Component Min Version Recommended Description
Node.js 18.0 18.x LTS / 20.x LTS Runtime environment
pnpm 8.0 8.15+ Package manager (Monorepo)
Git 2.20 Latest Clone repository
Browser Chrome 90+ Chrome Latest Run web editor

1.2 Optional Environment

Component Purpose Default State
Backend Smart Data Device data, tag real-time values, WebSocket push Editor works without it, but data binding has no real-time data
InfluxDB Historical trend data Trend charts have no history when not configured
Electron / Tauri Desktop app packaging Install as needed

⚠️ Complete screen runtime requires backend Smart Data service support. Starting the backend is recommended.

1.3 Operating System

  • Windows 10/11 (main development environment)
  • Linux (Ubuntu 20.04+ / CentOS 7+, production deployment)
  • macOS (development compatible)

1.4 Browser Compatibility

Browser Min Version Description
Chrome 90 Recommended, native support for all features
Edge 90 Chromium-based, good compatibility
Firefox 88 Supported, some CSS features may differ
Safari 14 Supported, 3D shape performance slightly lower

⚠️ IE browser is not supported. Konva canvas rendering and ES Module features require modern browsers.

2. Clone Repository and Install Dependencies

2.1 Clone Code

git clone <repository-url> smart-site
cd smart-site

2.2 Install Frontend Dependencies

cd ss-editor
pnpm install
cd ss-services\ss-data
pnpm install

💡 You can also run pnpm install directly in the root directory. pnpm workspace will recursively install all sub-package dependencies.

3. Configure .env Files

3.1 Frontend Environment Configuration

Frontend config is located at ss-editor/apps/web/.env.development:

# Backend API address
VITE_API_BASE_URL=http://localhost:4000
VITE_WS_URL=http://localhost:4000

# Debug mode (optional, skip token check in frontend route guard)
VITE_DEBUG_SKIP_AUTH=false

3.2 Backend Environment Configuration

Backend provides environment config templates in ss-services\ss-data:

File Scenario Load Condition
.env.dev Local development APP_ENV=dev (default)
.env.ss Deployment (ss-run) Deployment script specified
.env.pro Production APP_ENV=pro

Key parameters:

# Application config
NODE_ENV=development
PORT=4000

# Data directory
DATA_DIR=./data
DATABASE_PATH=${DATA_DIR}/ss-data.db

# JWT config (must change in production)
JWT_SECRET=your-super-secret-jwt-key-change-this-in-production
JWT_EXPIRES_IN=7d

⚠️ After changing backend PORT, you must also update frontend VITE_API_BASE_URL and VITE_WS_URL.

4. Initialize Database

Database is automatically created on first startup, no manual SQL execution needed:

  • Global DB: {DATA_DIR}/ss-data.db (users, system config, menus, etc.)
  • Project DB: {PROJECTS_DIR}/{projectName}/db/system.db (devices, tags, alarms, etc.)

To manually initialize (e.g., reset database):

# Delete old database file and restart service to auto-rebuild
del ss-services\ss-data\data\ss-data.db

5. Start Services

Execute in repository root:

.\bin\start.bat

This script starts both frontend and backend in separate windows, automatically installs dependencies, and compiles workspace packages.

5.2 Start Backend Only

cd ss-services\ss-data
pnpm dev

Success indicators:

🚀 Smart SCADA Server running on: http://localhost:4000
📚 API Docs: http://localhost:4000/api/docs
💚 Health Check: http://localhost:4000/api/v1/system/health

5.3 Start Frontend Only

cd ss-editor
pnpm dev:web

Success indicators:

  VITE v5.x  ready in xxx ms

  ➜  Local:   http://localhost:5173/
  ➜  Network: use --host to expose

6. Verify Installation

6.1 Frontend Verification

Check Method Expected Result
Page load Visit http://localhost:5173 Login page or init wizard displays
Editor entry Visit http://localhost:5173/editor Enter editor home
Canvas load Create/open screen Canvas, toolbar, property panel display normally
Shape library Check left shape library Shows basic/industrial/electrical categorized shapes
Drag shape Drag shape from library to canvas Shape renders successfully on canvas

6.2 Backend Verification

Check Method Expected Result
Service alive Visit http://localhost:4000/api/v1/system/health Returns {"status":"ok"}
API docs Visit http://localhost:4000/api/docs Swagger page loads normally
Database Check ss-services/ss-data/data/ss-data.db exists File created
WebSocket Enter editor runtime preview Real-time data pushes normally

6.3 Frontend-Backend Connectivity Verification

Check Method Expected Result
API connectivity Browser F12 → Network No CORS errors
Data binding Shape property → Data → Bind tag Can select device tags
Runtime data Runtime preview screen Shape data updates in real-time

7. Production Build

7.1 Frontend Build

cd ss-editor
pnpm build:web          # Build core + editor + system packages + web app

Build output goes to ss-editor\apps\web\dist\, can be hosted by Nginx or other static servers.

7.2 Backend Build

cd ss-services\ss-data
pnpm build              # Compile all workspace packages
# Production start
pnpm start:prod

7.3 Desktop App Build (Optional)

# Electron desktop app
cd ss-editor
pnpm build:desktop

# Tauri desktop app
cd ss-editor
pnpm build:desktop-tauri

7.4 Production Checklist

  • [ ] Backend .env.pro has JWT_SECRET changed to a strong random value
  • [ ] NODE_ENV set to production
  • [ ] Frontend .env.production has VITE_API_BASE_URL pointing to production backend
  • [ ] CORS config restricted to production domains
  • [ ] Static assets hosted by Nginx with gzip and cache strategy configured
  • [ ] Browser cache handled via file hash

8. Common Installation Issues

Issue Cause Solution
pnpm install fails Network issues or low Node version Upgrade Node 18+, configure npm mirror
better-sqlite3 compilation fails Missing build tools (backend dependency) Windows: install windows-build-tools; Linux: install python3 make g++
Port 5173 occupied Other process using port Modify Vite port or release port
Port 4000 occupied Backend process using port Modify PORT in .env.dev, sync frontend config
Workspace package not effective Not recompiled after modification Run pnpm --filter @scada-editor/core build and restart
Editor white screen Check browser console for errors Verify browser version, clear cache and retry
Shapes not displaying Plugin package not compiled Run pnpm --filter @scada-editor/plugins build
API 404 Backend not started or wrong proxy address Confirm backend running, check VITE_API_BASE_URL