A powerful, real-time system monitoring and statistics dashboard with automatic database initialization
curl -fsSL https://raw.githubusercontent.com/vaultscope/statistics/main/installer.sh | sudo bashOr clone and install:
git clone -b dev https://github.com/vaultscope/statistics.git && cd statistics && sudo bash installer.shThe installer will:
- Install Node.js 20+ (if not present)
- Set up server and client applications
- Automatically create and initialize databases
- Configure systemd services
- Set up Nginx reverse proxy (optional)
- Configure SSL certificates (optional)
- Generate admin API keys
- Operating System: Linux (Ubuntu/Debian preferred), macOS, or WSL2
- Node.js: Version 20.0.0 or higher
- Memory: Minimum 1GB RAM
- Disk Space: 500MB free space
- Permissions: Root/sudo access for installation
This project consists of two standalone applications that work together:
- Port: 4000
- Database: SQLite with WAL mode
- Auto-initialization: Creates 17 tables on first run
- API: RESTful with token authentication
- Features:
- Real-time system metrics collection
- Alert engine with notifications
- API key management with permissions
- Process and network monitoring
- Port: 4001
- Framework: Next.js 15 + React 19
- Database: JSON file (lightweight)
- Auto-initialization: Creates structure with defaults
- Features:
- Modern responsive dashboard
- Real-time data visualization
- User and role management
- Node monitoring interface
# Download and run installer
wget https://raw.githubusercontent.com/vaultscope/statistics/main/installer.sh
chmod +x installer.sh
sudo ./installer.sh
# Follow the interactive prompts:
# 1. Choose installation type (full/server/client)
# 2. Configure domains (optional)
# 3. Set up SSL (optional)
# 4. Configure Nginx (optional)# Clone the repository
git clone https://github.com/vaultscope/statistics.git
cd statistics
# Start with Docker Compose
docker-compose up -d
# Check status
docker-compose ps
# View logs
docker-compose logs -fgit clone https://github.com/vaultscope/statistics.git
cd statistics# Install dependencies for both applications
npm run install:all
# Or install separately
cd server && npm install && cd ..
cd client && npm install && cd ..# Build both applications
npm run build:all
# Or build separately
npm run build:server
npm run build:clientDevelopment Mode:
# Run both in development mode with hot reload
npm run dev
# Or run separately in different terminals
npm run server:dev # Server on http://localhost:4000
npm run client:dev # Client on http://localhost:4001Production Mode:
# Start both in production
npm run start:all
# Or use PM2 for process management
npm install -g pm2
pm2 start ecosystem.config.jsBoth applications automatically create their databases on first startup! No manual setup required.
Automatically creates 17 tables:
users- User accountsroles- Permission rolessessions- Active sessionsaudit_logs- Audit trailnodes- Monitored serversnode_metrics- Performance datanode_events- System eventscategories- Node categoriesapi_keys- API authenticationapi_key_logs- API usage logsalerts- Alert definitionsalert_history- Alert triggersnotification_channels- Alert destinations- Plus supporting tables
Automatically creates structure with:
- 5 default categories (Production, Development, Testing, Backup, Monitoring)
- 2 default roles (Administrator, Viewer)
- Ready for user and node registration
After installation, generate your first admin key:
cd server
npm run apikey create "Admin Key" -- --admin --viewStats --createApiKey --deleteApiKey --viewApiKeys --usePowerCommands
# Output will show:
# API Key created successfully!
# API Key: 64-character-key-here
# Save this key securely!Include in requests:
# Header method
curl -H "x-api-key: YOUR_API_KEY" http://localhost:4000/api/stats
# Bearer token
curl -H "Authorization: Bearer YOUR_API_KEY" http://localhost:4000/api/stats
# Query parameter
curl "http://localhost:4000/api/stats?apiKey=YOUR_API_KEY"# List all API keys
vss apikey list
# Create a new API key
vss apikey create "My Key" --viewStats
# Delete an API key
vss apikey delete <key-id>GET /health- Health check (no auth required)GET /api- API information
GET /api/stats- System statisticsGET /api/stats/cpu- CPU informationGET /api/stats/ram- Memory statisticsGET /api/stats/disk- Disk usageGET /api/stats/network- Network interfacesGET /api/stats/process- Process listPOST /api/nodes- Register new nodeGET /api/nodes- List all nodesGET /api/alerts- Active alertsPOST /api/alerts- Create alert rule
Create .env files in respective directories:
Server Configuration (server/.env):
NODE_ENV=production
PORT=4000
DATABASE_PATH=./database.db
JWT_SECRET=your-secret-key-here
RATE_LIMIT_MAX=100
RATE_LIMIT_WINDOW=900000
CORS_ORIGIN=http://localhost:4001Client Configuration (client/.env):
NEXT_PUBLIC_API_URL=http://localhost:4000
NEXT_PUBLIC_APP_NAME=VaultScope Statistics
NEXT_PUBLIC_APP_VERSION=2.0.0Services are automatically created by installer at:
/etc/systemd/system/vss-server.service/etc/systemd/system/vss-client.service
Manual service management:
# Start services
sudo systemctl start vss-server
sudo systemctl start vss-client
# Enable on boot
sudo systemctl enable vss-server
sudo systemctl enable vss-client
# Check status
sudo systemctl status vss-server
sudo systemctl status vss-client
# View logs
sudo journalctl -u vss-server -f
sudo journalctl -u vss-client -fstatistics/
├── server/ # Backend API server
│ ├── db/ # Database schemas & migrations
│ │ ├── schema/ # Drizzle ORM schemas
│ │ ├── migrations/ # SQL migrations
│ │ └── init.sql # Initial database setup
│ ├── functions/ # Core functionality
│ │ ├── auth.ts # Authentication middleware
│ │ ├── keys/ # API key management
│ │ └── stats/ # System statistics
│ ├── routes/ # API route handlers
│ ├── services/ # Business logic
│ │ ├── alertEngine.ts # Alert monitoring
│ │ └── databaseInitializer.ts
│ ├── types/ # TypeScript definitions
│ └── index.ts # Server entry point
│
├── client/ # Frontend dashboard
│ ├── app/ # Next.js app router
│ │ ├── api/ # API routes
│ │ ├── (dashboard)/ # Dashboard pages
│ │ └── layout.tsx # Root layout
│ ├── components/ # React components
│ │ ├── dashboard/ # Dashboard widgets
│ │ └── ui/ # UI components
│ ├── lib/ # Utilities
│ │ └── db-json.ts # JSON database handler
│ └── next.config.js # Next.js configuration
│
├── installer.sh # Automated installer script
├── docker-compose.yml # Docker configuration
├── package.json # Root package scripts
└── README.md # This file
Root Level:
npm run install:all # Install all dependencies
npm run dev # Run both in dev mode
npm run server # Run server in dev mode
npm run client # Run client in dev mode
npm run build # Build both applications
npm run start # Start both in production
npm run clean # Clean all build artifactsCLI Tool (vss):
vss --help # Show all available commands
vss setup # Run setup wizard
vss health # Check system health
vss apikey create # Create new API key
vss logs server # View server logs
vss restart # Restart all servicesServer Scripts:
cd server
npm run dev # Development with hot reload
npm run build # Build TypeScript
npm run start # Start production server
npm run apikey # API key management CLI
npm run speed # Run speed test
npm run sysinfo # Display system infoClient Scripts:
cd client
npm run dev # Next.js development
npm run build # Build for production
npm run start # Start production server
npm run lint # Run ESLint- Token Authentication: Secure API key system
- Rate Limiting: Per-key request throttling
- SQL Injection Protection: Parameterized queries via Drizzle ORM
- XSS Protection: Content Security Policy headers
- CORS Configuration: Controlled cross-origin access
- Session Management: Secure session handling
- Audit Logging: Complete activity trail
- Input Validation: Comprehensive request validation
- HTTPS Support: SSL/TLS encryption ready
After installation, verify everything is working:
# Check service status
systemctl status vss-server vss-client
# Test server health
curl http://localhost:4000/health
# Test client
curl http://localhost:4001
# Check logs
journalctl -u vss-server --since "10 minutes ago"
journalctl -u vss-client --since "10 minutes ago"
# Use CLI health check
vss healthPort Already in Use:
# Find process using port
sudo lsof -i :4000
sudo lsof -i :4001
# Kill process
sudo kill -9 <PID>Database Permission Issues:
# Fix server database permissions
sudo chown -R $USER:$USER server/database.db*
# Fix client database permissions
sudo chown -R $USER:$USER client/database.jsonNode.js Version Issues:
# Install Node.js 20
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt-get install -y nodejsBuild Errors:
# Clear caches and rebuild
npm run clean
rm -rf node_modules package-lock.json
rm -rf server/node_modules server/package-lock.json
rm -rf client/node_modules client/package-lock.json
npm run install:all
npm run build:allWe welcome contributions! Please see CONTRIBUTING.md for guidelines.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Security: Report vulnerabilities to [email protected]
- Built with Next.js and Express
- Database powered by SQLite and Drizzle ORM
- System information via systeminformation
- Process monitoring with ps-list
VaultScope Statistics - Enterprise-grade monitoring made simple