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

aluvia-ts-sdk

v2.1.3

Published

Official Aluvia proxy management SDK for Node.js and modern JavaScript environments

Readme

Aluvia SDK for TypeScript

npm version License: MIT TypeScript Node.js

The official Aluvia SDK for TypeScript, designed for managing your Aluvia connectivity credentials, retrieving usage data, and integrating mobile network access into automation tools, backend services, and browser environments.

This SDK works in Node.js, browsers, serverless runtimes, and modern build tools.


Features

  • Universal — Works in Node.js, Browser, Deno, Bun, and edge runtimes
  • TypeScript Native — Complete typings and IntelliSense
  • Lightweight — Zero heavy dependencies, powered by native fetch
  • Secure — Built-in auth + structured error handling
  • Tested — High test coverage
  • Documented — Clean API with helpful examples
  • Production Ready — Ideal for automation platforms, dashboards, and backend services

Installation

npm install aluvia-ts-sdk
yarn add aluvia-ts-sdk
pnpm add aluvia-ts-sdk

Quick Start

Basic Setup

import Aluvia from "aluvia-ts-sdk";

// Initialize with your API token
const aluvia = new Aluvia("your-api-token");

Get Your First Credential

try {
  const credential = await aluvia.first();

  if (credential) {
    console.log("Connection URL:", credential.toUrl());
    console.log("HTTPS URL:", credential.toUrl("https"));
    console.log("Username:", credential.username);
    console.log("Password:", credential.password);
    console.log("Host:", credential.host);
  } else {
    console.log("No credentials available. Create one first!");
  }
} catch (error) {
  console.error("Error fetching credential:", error.message);
}

Usage Examples

Creating Connectivity Credentials

import Aluvia from "aluvia-ts-sdk";

const aluvia = new Aluvia("your-api-token");

try {
  // Create a single credential
  const [credential] = await aluvia.create(1);
  console.log("Created credential:", credential.toUrl());

  // Create multiple credentials
  const credentials = await aluvia.create(5);
  console.log(`Created ${credentials.length} credentials`);

  credentials.forEach((c, index) => {
    console.log(`Credential ${index + 1}: ${c.toUrl()}`);
  });
} catch (error) {
  console.error("Error:", error.message);
}

Managing Connectivity Credentials

// Find a specific credential by username
const credential = await aluvia.find("username123");

if (credential) {
  console.log("Found credential:", credential.toJSON());

  // Update credential settings
  await aluvia.update("username123", {
    useSticky: true,
  });

  // Retrieve usage information
  const usage = await aluvia.getUsage("username123");
  console.log(`Data used: ${usage.dataUsed} GB`);
} else {
  console.log("Credential not found");
}

Advanced Credential Features

const credential = await aluvia.first();

if (credential) {
  credential.useSticky = true;
  await credential.save(); // Apply changes

  // Connection URL with current settings
  const enhancedUrl = credential.toUrl();
  console.log("Connection URL:", enhancedUrl);

  console.log("Username:", credential.username);
  console.log("Password:", credential.password);
  console.log("Host:", credential.host);
  console.log("HTTP Port:", credential.httpPort);
  console.log("HTTPS Port:", credential.httpsPort);
  console.log("Sticky enabled:", credential.useSticky);

  const usage = await credential.getUsage();
  console.log(`Data used: ${usage.dataUsed} GB`);
}

Usage Analytics

const currentUsage = await aluvia.getUsage("username123");
console.log("Current usage:", currentUsage);

const weekAgo = Math.floor(Date.now() / 1000) - 7 * 24 * 60 * 60;
const now = Math.floor(Date.now() / 1000);

const weeklyUsage = await aluvia.getUsage("username123", {
  usageStart: weekAgo,
  usageEnd: now,
});

console.log(`Weekly data usage: ${weeklyUsage.dataUsed} GB`);

Error Handling

import Aluvia, {
  ApiError,
  ValidationError,
  NetworkError,
  NotFoundError,
} from "aluvia-ts-sdk";

const aluvia = new Aluvia("your-api-token");

try {
  const credential = await aluvia.first();
} catch (error) {
  if (error instanceof ValidationError) {
    console.error("Validation failed:", error.message);
  } else if (error instanceof ApiError) {
    console.error("API error:", error.message);
  } else if (error instanceof NetworkError) {
    console.error("Network error:", error.message);
  } else if (error instanceof NotFoundError) {
    console.error("Not found:", error.message);
  } else {
    console.error("Unexpected error:", error);
  }
}

API Reference

Aluvia Class

Constructor

new Aluvia(token: string)

Parameters:

  • token: Your Aluvia API authentication token

Methods

first(): Promise<Proxy | null>

Returns the most recent connectivity credential.

find(username: string): Promise<Proxy | null>

Find a specific credential by username.

create(count?: number): Promise<Proxy[]>

Create one or more credentials.

update(username: string, options: UpdateOptions): Promise<Proxy | null>

Update a credential’s configuration (only useSticky).

delete(username: string): Promise<void>

Delete a credential.

getUsage(username: string, options?: UsageOptions): Promise<UsageInfo>

Retrieve usage analytics for a credential.

all(): Promise<Proxy[]>

Returns all credentials.


Proxy Class

Properties

  • username: string
  • password: string
  • host: string
  • httpPort: number
  • httpsPort: number
  • useSticky: boolean

Methods

  • toUrl(protocol?: 'http' | 'https'): string
  • save(): Promise<this>
  • delete(): Promise<void>
  • getUsage(options?: UsageOptions): Promise<UsageInfo>
  • toJSON(): Record<string, any>

Type Definitions

interface ProxyCredential {
  username: string;
  password: string;
  useSticky?: boolean;
  sessionSalt?: string;
}

interface ProxyConfig {
  host: string;
  httpPort: number;
  httpsPort: number;
}

interface UsageOptions {
  usageStart?: number;
  usageEnd?: number;
}

interface UsageInfo {
  usageStart: number;
  usageEnd: number;
  dataUsed: number;
}

Testing

npm test
npm run test:watch
npm run test:coverage

License

MIT License – see the LICENSE file for details.