Configuration Guide
This guide explains the various configuration options of Smart SCADA Data Platform (ss-data), covering environment variables, database, system settings, project configuration, and knowledge base configuration.
Configuration load priority: Environment variables > Database configuration (SystemConfigService) > Default values.
1. Environment Variables (.env)
1.1 Environment File Overview
Backend environment files are located in the ss-services\ss-node directory:
| File | Scenario | Load Condition |
|---|---|---|
| .env.dev | Local development | APP_ENV=dev (default) |
../../../../../../../ss-services/ss-node/.env.ss |
Deployment runtime (ss-run) | Specified by deployment script |
| .env.pro | Production environment | APP_ENV=pro |
| .env.example | Configuration template | Not loaded, reference only |
1.2 Core Environment Variables
Application Configuration
| Variable | Default | Description |
|---|---|---|
APP_ENV |
dev |
Runtime environment (dev / pro), determines which env file to load |
NODE_ENV |
development |
Node runtime mode (development / production) |
PORT |
4000 |
Backend service port |
Data Directory
| Variable | dev Default | ss Default | Description |
|---|---|---|---|
DATA_DIR |
./data |
../../ss-run/ss/data |
Data root directory (relative to ss-node) |
RUN_DIR |
— | ../../ss-run/ss |
Software runtime directory |
BACKUP_DIR |
— | ${RUN_DIR}/data/_bak |
Database backup directory |
LOG_DIR |
${DATA_DIR}/logs |
${DATA_DIR}/logs |
Log directory |
PROJECTS_DIR |
./data/projects |
../../ss-project |
Project materials directory |
Database Configuration
| Variable | Description |
|---|---|
DB_TYPE |
Database type (sqlite / mysql), default sqlite |
DATABASE_PATH |
SQLite file path, dev: ${DATA_DIR}/ss-node.db, ss: ${DATA_DIR}/db/ss-node.db |
DATABASE_HOST |
MySQL host (only when DB_TYPE=mysql) |
DATABASE_PORT |
MySQL port (default 3306) |
DATABASE_USER |
MySQL username |
DATABASE_PASSWORD |
MySQL password |
DATABASE_NAME |
MySQL database name (default smart_scada) |
PROJECT_DB_MODE |
Project database mode: isolated (independent) / unified (shared) |
PROJECT_DB_INIT_DIR |
SQL initialization scripts directory (default ./data/init) |
InfluxDB Configuration (Optional)
| Variable | Description |
|---|---|
INFLUXDB_URL |
InfluxDB address (default http://localhost:8086) |
INFLUXDB_TOKEN |
Access token (⚠️ required in production) |
INFLUXDB_ORG |
Organization name (default ss-org) |
INFLUXDB_BUCKET |
Bucket name (default ss_node_data) |
INFLUXDB_BATCH_SIZE |
Batch write size (default 1000) |
INFLUXDB_FLUSH_INTERVAL |
Flush interval in milliseconds (default 5000) |
Portable InfluxDB path in ss deployment mode:
INFLUXDB_BINARY_PATH=${BASE_SERVICES_DIR}/influxdb/influxd.exe
INFLUXDB_CONFIG_PATH=${BASE_SERVICES_DIR}/influxdb/influxdb.conf
INFLUXDB_DATA_DIR=${BASE_SERVICES_DIR}/influxdb/data
JWT Authentication
| Variable | Default | Description |
|---|---|---|
JWT_SECRET |
Placeholder | ⚠️ Must be changed to a strong random string in production |
JWT_EXPIRES_IN |
7d |
Token validity period (7d / 24h / 3600s) |
Redis Configuration (Optional)
| Variable | Description |
|---|---|
REDIS_HOST |
Redis host (default localhost) |
REDIS_PORT |
Redis port (default 6379) |
REDIS_BINARY_PATH |
Portable Redis path in ss mode |
When Redis is not configured, the system degrades to in-memory mode. WebSocket restarts will lose unread offline messages.
Base Service Management (ss mode)
| Variable | Description |
|---|---|
BASE_SERVICES_DIR |
Portable software root directory (Redis, InfluxDB) |
AUTO_START_BASE_SERVICES |
Whether to auto-start Redis/InfluxDB on startup (default false) |
MEMORY_WARN_PERCENT |
Memory warning threshold (default 70) |
MEMORY_CRITICAL_PERCENT |
Memory critical threshold (default 85) |
DISK_WARN_PERCENT |
Disk warning threshold (default 70) |
DISK_CRITICAL_PERCENT |
Disk critical threshold (default 85) |
Collection Protocols
| Variable | Description |
|---|---|
MQTT_BROKER_URL |
MQTT Broker address (mqtt://localhost:1883) |
OPCUA_SERVER_URL |
OPC UA Server address (opc.tcp://localhost:4840) |
MODBUS_TCP_HOST |
Modbus TCP host (default localhost) |
MODBUS_TCP_PORT |
Modbus TCP port (default 502) |
Logging Configuration
| Variable | Default | Description |
|---|---|---|
LOG_LEVEL |
debug |
Log level (error / warn / info / debug) |
LOG_MAX_SIZE |
100m |
Maximum single file size |
LOG_MAX_FILES |
10 |
Number of files to retain |
Internationalization
| Variable | Default | Description |
|---|---|---|
I18N_FALLBACK_LANGUAGE |
zh-CN |
Default language |
I18N_SUPPORTED_LANGUAGES |
zh-CN,en-US,zh-TW |
Supported language list |
I18N_WATCH |
true |
Hot-reload translation files in development |
I18N_RESPONSE_HEADER |
false |
Whether to return language in response header |
1.3 Frontend Environment Variables
Frontend config is located at ss-editor/apps/web/.env.development:
| Variable | Default | Description |
|---|---|---|
VITE_API_BASE_URL |
http://localhost:4000 |
Backend API address |
VITE_WS_URL |
http://localhost:4000 |
WebSocket address |
VITE_DEPLOY_BASE |
(empty) | Deployment base path |
VITE_PLUGIN_MODE |
mixed |
Plugin load mode |
VITE_DEBUG_SKIP_AUTH |
(empty) | Set to true to skip frontend auth (debug only) |
2. Database Configuration
2.1 Database Isolation Strategy
| Data Type | Storage Location | Description |
|---|---|---|
| Global Configuration | {DATA_DIR}/ss-node.db |
users, system_configs, sys_menus tables |
| Project Data | {PROJECTS_DIR}/{projectName}/db/system.db |
devices, device_groups, data_tags, alarms, etc. |
| Project Configuration | {PROJECTS_DIR}/{projectName}/projectinfo.json |
Not stored in DB |
| Time-Series Data | InfluxDB | Historical data collected from devices |
PROJECT_DB_MODE controls the project database mode:
isolated(recommended): Each project has an independent DB, isolated from each otherunified: All projects share the global DB, suitable for scenarios with few projects
2.2 Initialization Scripts
Located at ../../../../../../../ss-services/ss-node/data/init:
| Script | Purpose |
|---|---|
init-system-db.sql |
Global DB table structure, default menus, dictionaries |
init-event-db.sql |
Event database structure |
The database auto-executes initialization on first startup. Existing deployments are upgraded via INSERT OR IGNORE statements to add missing menus.
3. System Configuration (Web UI)
In addition to environment variables, runtime configurable items are managed via the web interface:
- Visit
http://localhost:5173/system/settings - Enter the System Configuration page
Configuration items are stored in the system_configs table (key-value structure) and read uniformly by SystemConfigService. Environment variables take higher priority.
Common configurable items:
- System name, logo
- Theme and interface preferences
- Alarm notification channels (email, SMS, TTS)
- Report scheduled tasks
- Collection scheduling parameters
4. Project Configuration (projectinfo.json)
The projectinfo.json file in each project root directory stores project-level configuration (not in DB):
{
"id": "uuid",
"name": "Demo Factory",
"code": "demo-factory",
"description": "Quick start demo project",
"createdAt": "2026-07-13T10:00:00.000Z",
"updatedAt": "2026-07-13T10:00:00.000Z",
"settings": {
"defaultLanguage": "zh-CN",
"timezone": "Asia/Shanghai"
}
}
⚠️ After manually editing
projectinfo.json, you need to restart the service or refresh the project cache.
5. Knowledge Base Configuration
The knowledge base (FAQ) stores operational documents, flowcharts, etc. This manual is located under the knowledge base directory.
5.1 Configuration Items
| Variable | Default | Description |
|---|---|---|
KB_ROOT |
${DATA_DIR}/faq |
Knowledge base root directory |
KB_DEFAULT_LANG |
zh-CN |
Default language (used when user does not specify) |
KB_SUPPORTED_LANGS |
zh-CN,en-US |
Supported language list (comma-separated) |
KB_AI_BUILD_ENABLED |
false |
Whether to enable AI auto-build of knowledge base |
5.2 Directory Structure
The knowledge base is organized by language, with each language having an independent subdirectory under KB_ROOT:
{DATA_DIR}/faq/
├── zh-CN/ # Chinese knowledge base
│ └── ss-data/ # ss-data product documentation
│ ├── 00-overview/ # Overview
│ ├── 00-manual/ # User manual (this directory)
│ ├── 01-permission/ # Permission management
│ ├── 03-device/ # Device management
│ └── ...
├── en-US/ # English knowledge base
│ └── ss-data/
│ └── ...
5.3 Document Frontmatter
Each Markdown document must include frontmatter at the top:
---
id: "00-manual/configuration" # Document unique ID
title: "Configuration Guide" # Title
lang: "en-US" # Language
product: "ss-data" # Product
module: "00-manual" # Module
category: "global" # Category
order: 4 # Sort order
tags: ["configuration", "env"] # Tags
updatedAt: "2026-07-13" # Update date
status: "published" # Status
---
5.4 Applying Changes
- After modifying
KB_ROOTorKB_SUPPORTED_LANGS, you must restart the backend service - Document content changes take effect in real time (the knowledge base service watches file changes)
6. Configuration Change Best Practices
- Backup first: Back up the database and env files before modifying production configuration
- Small steps: Change one item at a time, verify after restart
- Prefer UI: For items configurable via the web interface, avoid editing env files
- Sync frontend: Changing the backend port requires syncing the frontend
VITE_API_BASE_URL - Record changes: Production configuration changes should be recorded in the operations log
Related Links
- Installation Guide — Environment setup
- Troubleshooting — Configuration error diagnosis
- System Overview — Database isolation strategy
- System Management — System configuration API