npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

nodesty-api

v1.0.2

Published

A TypeScript/JavaScript client library for Nodesty VPS management API

Readme

Nodesty API Client

A TypeScript/JavaScript npm package for managing VPS servers through the Nodesty API.

Installation

npm install nodesty-api

Features

  • TypeScript Support - Full type definitions included
  • JavaScript Compatible - Works with both TypeScript and JavaScript
  • Promise-based - Modern async/await support
  • Error Handling - Comprehensive error handling with retry logic
  • VPS Management - Complete VPS lifecycle management
  • Backup Operations - Backup creation and restoration
  • Monitoring - Resource usage and performance graphs
  • OS Templates - Operating system management
  • Task Tracking - Monitor long-running operations
  • User Management - Account information and sessions
  • Service Management - List all services
  • Ticket System - Support ticket operations
  • Invoice Management - Billing and invoice operations

Quick Start

TypeScript

import { NodestyClient } from 'nodesty-api';

// Option 1: Use unified client (recommended)
const client = new NodestyClient({
  apiKey: 'your-nodesty-api-key'
});

// VPS operations
const vpsInfo = await client.vps.getVpsInfo('your-service-id');
if (vpsInfo.success) {
  console.log('VPS Info:', vpsInfo.data);
}

// User operations
const userProfile = await client.user.getCurrentUser();
if (userProfile.success) {
  console.log('User:', userProfile.data);
}

// Option 2: Use individual clients
import { VpsApiClient, UserApiClient } from 'nodesty-api';

const vpsClient = new VpsApiClient({
  apiKey: 'your-nodesty-api-key'
});

const userClient = new UserApiClient({
  apiKey: 'your-nodesty-api-key'
});

// Start VPS
await client.vps.startVps('your-service-id');

// Get monitoring data
const graphs = await client.vps.getVpsGraphs('your-service-id');

JavaScript (CommonJS)

const { VpsApiClient } = require('nodesty-api');

const client = new VpsApiClient({
  apiKey: 'your-nodesty-api-key'
});

// Promise-based usage
client.getVpsInfo('your-service-id')
  .then(vpsInfo => {
    if (vpsInfo.success) {
      console.log('VPS Info:', vpsInfo.data);
    }
  })
  .catch(error => {
    console.error('Error:', error);
  });

API Reference

Configuration

// Option 1: Unified client (recommended)
const client = new NodestyClient({
  apiKey: 'your-personal-access-token', // Required: Your Nodesty Personal Access Token
  baseUrl: 'https://nodesty.com',       // Optional: API base URL (default)
  timeout: 30000,                       // Optional: Request timeout in ms (default: 30000)
  retries: 3                           // Optional: Number of retry attempts (default: 3)
});

// Option 2: Individual clients
const vpsClient = new VpsApiClient({ apiKey: 'your-pat' });
const userClient = new UserApiClient({ apiKey: 'your-pat' });

User Operations

Get Current User Profile

const userProfile = await client.user.getCurrentUser();
if (userProfile.success) {
  console.log('User ID:', userProfile.data.id);
  console.log('Email:', userProfile.data.email);
  console.log('Name:', userProfile.data.firstName);
  console.log('Country:', userProfile.data.country);
}

Get All Services

const services = await client.user.getServices();
if (services.success) {
  services.data.forEach(service => {
    console.log(`Service: ${service.name} (${service.type}) - ${service.status}`);
  });
}

Ticket Operations

// Get all tickets
const tickets = await client.user.getTickets();

// Get specific ticket
const ticket = await client.user.getTicket('ticket-id');

Invoice Operations

// Get all invoices
const invoices = await client.user.getInvoices();

// Get specific invoice
const invoice = await client.user.getInvoice('invoice-id');

User Sessions

const sessions = await client.user.getUserSessions();
if (sessions.success) {
  sessions.data.forEach(session => {
    console.log(`Session: ${session.ip} - ${session.isActive ? 'Active' : 'Inactive'}`);
  });
}

VPS Operations

Get VPS Information

const vpsInfo = await client.vps.getVpsInfo(serviceId);

VPS Control

// Start VPS (returns 204 on success)
await client.vps.startVps(serviceId);

// Stop VPS (returns 204 on success)
await client.vps.stopVps(serviceId);

// Restart VPS (returns 204 on success)
await client.vps.restartVps(serviceId);

// Power off VPS (returns 204 on success)
await client.vps.powerOffVps(serviceId);

Password Management

await client.vps.changeVpsPassword(serviceId, {
  username: 'admin',
  password: 'StrongPassword123!'
});

Reinstall VPS

// First get available OS templates to find the OS ID
const osTemplates = await client.vps.getVpsOsTemplates(serviceId);
// Example response: [{ "id": 1, "name": "Debian 9.5" }]

// Then reinstall with the OS ID
await client.vps.reinstallVps(serviceId, {
  password: 'StrongPassword123!',
  osId: 1  // Use the ID from OS templates
});

Get Available OS Templates

const osTemplates = await client.vps.getVpsOsTemplates(serviceId);
if (osTemplates.success) {
  console.log('Available OS templates:', osTemplates.data);
  // Example response: [{ "id": 1, "name": "Debian 9.5" }]
}

Monitoring & Graphs

// Get performance graphs
const graphs = await client.vps.getVpsGraphs(serviceId);

Backup Operations

// Get all backups
const backups = await client.getVpsBackups(serviceId);

// Restore from backup
if (backups.success && backups.data && backups.data.length > 0) {
  const backup = backups.data[0];
  await client.restoreVpsBackupFromObject(serviceId, backup);
}

OS Templates

// Get available OS templates
const osTemplates = await client.getVpsOsTemplates(serviceId);

// Response structure:
// {
//   success: true,
//   data: [
//     {
//       id: 1,
//       name: "Debian 9.5"
//     },
//     {
//       id: 2,
//       name: "Ubuntu 20.04"
//     }
//   ]
// }

Task Management

// Get VPS tasks
const tasks = await client.getVpsTasks(serviceId);
if (tasks.success && tasks.data) {
  tasks.data.forEach(task => {
    console.log('Action:', task.action);
    console.log('Progress:', task.progress);
    console.log('Started:', new Date(task.startedAt));
    console.log('Ended:', new Date(task.endedAt));
  });
}

API Response Format

All API methods return a standardized response format:

interface ApiResponse<T> {
  success: boolean;
  data?: T;
  message?: string;
  error?: string;
}

Error Handling

The client includes automatic retry logic with exponential backoff for failed requests. You can handle errors like this:

try {
  const result = await client.getVpsInfo(serviceId);
  if (result.success) {
    // Handle success
    console.log(result.data);
  } else {
    // Handle API error
    console.error('API Error:', result.error);
  }
} catch (error) {
  // Handle network/other errors
  console.error('Network Error:', error);
}

TypeScript Types

The package includes comprehensive TypeScript definitions:

import type {
  VpsInfo,
  VpsActionParams,
  VpsBackup,
  VpsOsTemplate,
  VpsTask,
  VpsGraphs
} from 'nodesty-api';

Requirements

  • Node.js 16 or higher
  • Valid Nodesty API key

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Support

For API documentation and support, visit Nodesty Documentation