Installation Guide
This guide walks you through the complete installation and deployment of PROD-SYS, from system requirements to production deployment.System Requirements
Node.js
Version 18.x or higher
NPM
Version 9.x or higher
SQLite
Version 3.x (bundled with npm package)
Memory
Minimum 512MB RAM
Installation Steps
Run Setup Script
PROD-SYS includes an automated setup script that handles dependency installation and environment configuration:The script will:
- Install npm dependencies
- Create a
.envfile with secure defaults - Generate a random JWT secret
- Set up the database file path
Initialize the Database
Start the server to automatically initialize the SQLite database:The database initialization process will:
- Create all required tables with proper schemas
- Enable SQLite WAL mode for concurrent access
- Set up foreign key constraints
- Create indexes for performance
- Run any pending migrations
Bootstrap the System
On first run, you must bootstrap the system to create the admin user:
- Open your browser to
http://localhost:3000/bootstrap.html - Enter the
ADMIN_PASSWORDfrom your.envfile - Set a new secure password for the admin account
- The system will create the admin user and mark bootstrap as complete
Bootstrap can only be performed once. After completion, the bootstrap endpoint is permanently disabled for security.
Configuration Options
Environment Variables Reference
All environment variables from.env.example:
Secret key for signing JWT tokens. Must be at least 32 characters. Use a cryptographically secure random value.Generate with:
node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"Bootstrap password for initial admin account creation. Only used during system bootstrap.
HTTP port for the Express server.
Runtime environment:
development, test, or production.In production mode:- Detailed error messages are hidden
- Logging is optimized
- Security headers are enforced
SQLite database filename (stored in
backend/database/ directory).For testing, set to :memory: for an in-memory database.Winston logging level:
error, warn, info, http, verbose, or debug.Development only: Bypass permission checks for rapid prototyping.
Database Setup
Automatic Schema Management
PROD-SYS automatically manages database schema through migrations defined inbackend/database/sqlite.js:
backend/database/sqlite.js
SQLite Optimization
The database is configured for optimal performance:backend/database/sqlite.js
Production Deployment
Using Process Manager (PM2)
For production deployments, use PM2 to manage the Node.js process:- Automatic restart on crashes
- Log management
- Load balancing across CPU cores
- Zero-downtime reloads
Reverse Proxy Setup (Nginx)
For production, run PROD-SYS behind Nginx:nginx.conf
SSL/TLS with Let’s Encrypt
Docker Deployment
Create aDockerfile:
Dockerfile
Troubleshooting
Database Locked Errors
If you see “database is locked” errors:-
Verify WAL mode is enabled:
Should return
wal. -
Check for stale lock files:
- Restart the server to reinitialize connections.
Port Already in Use
If port 3000 is occupied:Bootstrap Already Completed
If you need to reset bootstrap:Permission Denied Errors
Ensure the database directory is writable:Next Steps
Quick Start
Get started with your first production order
Configuration
Customize system settings
User Management
Set up users and roles
API Reference
Integrate with external systems