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

apisix-sdk

v0.0.6

Published

Apache APISIX SDK - Complete TypeScript/JavaScript client for APISIX Admin API and Control API with APISIX 3.0+ support

Readme

APISIX SDK

npm version npm downloads npm license Contributor Covenant

A comprehensive TypeScript/JavaScript SDK for Apache APISIX API Gateway. This SDK provides complete access to both the Admin API and Control API, making it easy to manage routes, services, upstreams, consumers, SSL certificates, plugins, and more.

Features

  • 🚀 Complete API Coverage: Full support for APISIX Admin API and Control API
  • 📝 TypeScript Support: Fully typed with comprehensive TypeScript definitions
  • 🔄 Modern HTTP Client: Built on top of ofetch for reliable HTTP requests
  • 🛡️ Error Handling: Robust error handling with detailed error messages
  • 📊 Pagination Support: Built-in support for APISIX v3 pagination
  • 🔍 Resource Filtering: Advanced filtering and search capabilities
  • 🏥 Health Monitoring: Built-in health checks and monitoring features
  • 🔧 Easy Configuration: Simple and flexible configuration options
  • 🔐 Credential Management: APISIX 3.0+ standalone credential support
  • 🗝️ Secret Management: Vault, AWS, and GCP secret store integration
  • 🌐 Stream Routes: TCP/UDP proxy configuration support
  • 🔗 Force Delete: Resource dependency management with force delete
  • 📋 Configuration Validation: Built-in validation for stream routes and secrets

Installation

npm install apisix-sdk
# or
yarn add apisix-sdk
# or
pnpm add apisix-sdk

Quick Start

import { ApisixSDK } from "apisix-sdk";

// Initialize the SDK
const client = new ApisixSDK({
  adminAPI: {
    baseURL: "http://127.0.0.1:9180",
    apiKey: "your-api-key",
    timeout: 30000,
  },
});

// Test connection
const isConnected = await client.testConnection();
console.log("Connected:", isConnected);

// Create a route
const route = await client.routes.create({
  name: "my-api",
  uri: "/api/v1/*",
  methods: ["GET", "POST"],
  upstream: {
    type: "roundrobin",
    nodes: {
      "127.0.0.1:8080": 1,
    },
  },
});

console.log("Route created:", route.id);

Configuration

interface ApisixSDKConfig {
  adminAPI: {
    baseURL: string; // APISIX Admin API base URL (default: http://127.0.0.1:9180)
    apiKey?: string; // API key for authentication (Admin API only)
    timeout?: number; // Request timeout in milliseconds (default: 30000)
    headers?: Record<string, string>; // Additional headers for Admin API
  };
  controlAPI?: {
    baseURL: string; // Control API base URL (default: http://127.0.0.1:9090)
    timeout?: number; // Control API specific timeout
    headers?: Record<string, string>; // Additional headers for Control API
  };
}

Basic Usage

import { ApisixSDK } from "apisix-sdk";

// Simple configuration (using default Control API endpoint)
const client = new ApisixSDK({
  adminAPI: {
    baseURL: "http://127.0.0.1:9180", // Admin API
    apiKey: "your-api-key",
  },
});

// Advanced configuration with separate Control API endpoint
const client = new ApisixSDK({
  adminAPI: {
    baseURL: "http://127.0.0.1:9180", // Admin API
    apiKey: "your-api-key",
    timeout: 30000,
  },
  controlAPI: {
    baseURL: "http://127.0.0.1:9090", // Control API
    timeout: 15000, // Separate timeout for Control API
  },
});

Prerequisites

Stream Routes Support

To use Stream Routes functionality, enable stream proxy in your APISIX configuration (config.yaml):

apisix:
  proxy_mode: http&stream # Enable both HTTP and Stream proxies
  stream_proxy:
    tcp:
      - 9100 # TCP proxy listening port
    udp:
      - 9200 # UDP proxy listening port

Control API Support

To use Control API features, ensure the Control API is enabled in your APISIX configuration:

apisix:
  enable_control: true
  control:
    ip: "127.0.0.1"
    port: 9090

Important: The Control API runs on a separate port (default: 9090) from the Admin API (default: 9180). The SDK automatically handles this separation:

  • Admin API (http://127.0.0.1:9180): Used for configuration management (routes, services, etc.)
  • Control API (http://127.0.0.1:9090): Used for monitoring, health checks, and runtime information

Control API does not require authentication - it's designed for internal monitoring and should only be accessible from trusted networks.

Documentation

For comprehensive API documentation and usage examples, please refer to:

API Overview

Core Resources

  • Routes - HTTP route management and configuration
  • Services - Service abstraction for upstream management
  • Upstreams - Backend server cluster management
  • Consumers - API consumer and authentication management
  • SSL Certificates - SSL/TLS certificate management
  • Plugins - Plugin configuration and management
  • Global Rules - Global plugin rules across all routes
  • Consumer Groups - Consumer grouping and management
  • Plugin Configs - Reusable plugin configurations
  • Stream Routes - TCP/UDP proxy routing
  • Secrets - Secret store management (Vault, AWS, GCP)
  • Credentials - Standalone credential management

Control API

  • Health Monitoring - System health checks and status
  • Runtime Information - Server info and metrics
  • Schema Management - Configuration schema access
  • Discovery Services - Service discovery integration

Support

License