Node.js SDK
TypeScript/JavaScript SDK for VaultScope Statistics Server. Monitor system resources, manage alerts, and control infrastructure with a fully typed API.
Full-Featured Statistics Server Client
The VaultScope Statistics Server SDK provides a complete TypeScript interface for monitoring system resources, managing alerts, and controlling infrastructure. Built with modern Node.js best practices and complete type safety.
Key Features
- Complete TypeScript definitions for all API responses
- Automatic retry logic with configurable attempts and delays
- Comprehensive error handling with status codes and messages
- Monitor CPU, memory, disk, network, GPU, and processes
- Manage alerts, API keys, and system logs programmatically
- Execute power commands with safety controls and delays
Requires Node.js 18+ and a valid VaultScope Statistics Server API key.
Installation
Quick Start
import { VSSClient } from '@vaultscope/vss-sdk';
const client = new VSSClient({
baseURL: 'http://localhost:4000',
apiKey: 'your-api-key-here',
timeout: 30000,
retryAttempts: 3
});
// Get system stats
const stats = await client.stats();
console.log(stats);Comprehensive API Coverage
Access every aspect of your VaultScope Statistics Server with fully typed methods
System Statistics
Monitor CPU, memory, disk, network interfaces, processes, and GPU metrics in real-time
stats()cpu()memory()Alert Management
Create, update, and manage system alerts with customizable thresholds and actions
createAlert()listAlerts()Power Commands
Execute shutdown, reboot, and other power operations with safety delays and force options
power()cancelPower()API Key Management
Programmatically create, update, and manage API keys with granular permissions
createApiKey()listApiKeys()Hardware Information
Access detailed hardware specs including mainboard, BIOS, chassis, and GPU details
hardware()gpu()Network Speed Test
Run comprehensive network speed tests and monitor bandwidth performance over time
speedTest()networkHistory()Code Examples
Get started quickly with these common use cases
System Monitoring
// Monitor CPU and memory
const stats = await client.stats();
console.log(`CPU: ${stats.cpu.usage}%`);
console.log(`Memory: ${stats.memory.used}MB`);
// Get process list
const processes = await client.processes({
sortBy: 'cpu',
limit: 10
});Alert Creation
// Create high CPU alert
const alert = await client.createAlert({
name: 'High CPU Alert',
type: 'cpu',
condition: 'greater_than',
threshold: 80,
action: 'notify',
severity: 'high'
});Error Handling
try {
const stats = await client.stats();
} catch (error) {
if (error.status === 401) {
console.error('Invalid API key');
} else if (error.code === 'NETWORK_ERROR') {
console.error('Connection failed');
}
}TypeScript Types
import { SystemStats, CPUInfo } from '@vaultscope/vss-sdk';
const stats: SystemStats = await client.stats();
const cpu: CPUInfo = stats.cpu;
const usage: number = cpu.usage;Configuration Options
interface VSSConfig {
baseURL: string;
apiKey: string;
timeout?: number; // Default: 30000ms
retryAttempts?: number; // Default: 3
retryDelay?: number; // Default: 1000ms
}- Configurable timeout and retry logic
- Runtime configuration updates
- Custom request methods for new endpoints
Built-in Features
- Automatic Retries
Failed requests retry automatically with exponential backoff
- Type Safety
Complete TypeScript definitions for all responses and parameters
- Error Details
Comprehensive error messages with status codes and error types
- Promise-Based
Modern async/await API for clean, readable code
Start Building Today
Install the VaultScope Statistics Server SDK and start monitoring your infrastructure with TypeScript.