Catalog npm
Back to packageRELEASE DETAILS

2.2.1

npm

3xworkaround

This is an interface for 3x-ui panel. It will help developers to create, edit and delete inbounds and clients in a simple way.

3x-ui3x-ui-jsx-uixrayapi
Published6 Jul 2025
Direct dependencies23
Transitive dependenciesNot calculated

README

Current package documentation

3x-ui Node.js SDK

The 3x-ui is a JavaScript library designed to facilitate communication with the 3x-ui panel, which runs Xray Core for proxy services. This SDK empowers JavaScript developers to create bots and websites for both commercial and non-commercial uses, providing simplicity, abstraction around the API, caching for improved performance, and mutex for asynchronous safety.

This package is developed based on MHSanaei Postman Collection and you can check it out for more information.

Features

  • ✅ Simplicity: Designed with simplicity in mind to streamline the process of interacting with the 3x-ui panel.
  • ✅ Abstraction: Provides an abstraction layer around the 3x-ui API to simplify finding clients by email, uuid (vmess, vless) or password (trojan).
  • ✅ Proxy: Utilizes an underlying proxy agent for communication with the panel if needed.
  • ✅ Caching: Caches responses for improved performance.
  • ✅ Mutex: Provides a mutex, a lock mechanism, to ensure asynchronous safety and prevent race conditions.
  • ✅ Debug Mode: Enables debug mode for detailed logging.
  • ✅ TTL: Allows you to set the cache time in seconds.

Installation

To install the 3x-ui SDK, use npm:

npm install 3x-ui

Usage

First, import the SDK:

import { XuiApi } from "3x-ui";

Initialize the SDK with the URL of your 3x-ui panel:

const api = new XuiApi("http://username:password@localhost:2053");
api.debug = true; // Enables debug mode - defualt is false
api.stdTTL = 60; // Cache time in seconds - default is 10s

Then, you can utilize the SDK functions:

const inbounds = await api.getInbounds();
const clientStat = await api.getClient("email or clientId");
const clientOptions = await api.getClientOptions("email or clientId");
const onlines = await api.getOnlineClients();

Proxy

The SDK uses an underlying proxy agent to connect to the panel. You can specify the proxy settings using environment variables such as HTTP_PROXY and HTTPS_PROXY. Refer to the proxy-agent documentation for more information.

HTTP_PROXY="http://proxy-server-over-tcp.com:3128"
HTTPS_PROXY="https://proxy-server-over-tls.com:3129"

API

Inbounds

  • getInbounds(): Returns an array of all inbounds.
  • getInbound(id: number): Returns the inbound with the specified ID.
  • addInbound(options: InboundOptions): Adds a new inbound with the provided options.
  • updateInbound(id: number, options: Partial<InboundOptions>): Updates the inbound with the specified ID using the provided options.
  • resetInboundsStat(): Resets statistics for all inbounds.
  • resetInboundStat(id: number): Resets statistics for the inbound with the specified ID.
  • deleteInbound(id: number): Deletes the inbound with the specified ID.

Clients

  • getClient(clientId: string): Returns a client with the given email or clientId.
  • getClientIps(clientId: string): Returns all client's IPs with the given email or clientId.
  • getClientOptions(clientId: string): Returns all client's options with the given email or clientId.
  • addClient(inboundId: number, options: ClientOptions): Adds a new client with the given options.
  • updateClient(clientId: string, options: Partial<ClientOptions>): Updates a client with the given email or clientId.
  • resetClientIps(clientId: string): Resets all client's IPs with the given email or clientId.
  • resetClientStat(clientId: string): Resets a client's stat with the given email or clientId.
  • deleteClient(clientId: string): Deletes a client with the given email or clientId.
  • deleteDepletedClients(): Deletes all clients that have depleted their traffic.
  • deleteInboundDepletedClients(inboundId: number): Deletes all clients of an inbound that have depleted their traffic.
  • getOnlineClients(): Returns all online clients.

Other Functions

  • sendBackup(): send backup file via Telegram bot.

Example

For more examples, check out the test directory on our GitHub repository.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 23

Native requirements
23 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
async-mutex
Environment
{
  "local_name": "async-mutex",
  "alias": false,
  "peer_metadata": null
}
^0.5.0runtime
axios
Environment
{
  "local_name": "axios",
  "alias": false,
  "peer_metadata": null
}
^1.6.4runtime
node-cache
Environment
{
  "local_name": "node-cache",
  "alias": false,
  "peer_metadata": null
}
^5.1.2runtime
proxy-agent
Environment
{
  "local_name": "proxy-agent",
  "alias": false,
  "peer_metadata": null
}
^6.3.1runtime
qs
Environment
{
  "local_name": "qs",
  "alias": false,
  "peer_metadata": null
}
^6.11.2runtime
url-join
Environment
{
  "local_name": "url-join",
  "alias": false,
  "peer_metadata": null
}
^5.0.0runtime
winston
Environment
{
  "local_name": "winston",
  "alias": false,
  "peer_metadata": null
}
^3.11.0runtime
@faker-js/faker
Environment
{
  "local_name": "@faker-js/faker",
  "alias": false,
  "peer_metadata": null
}
^9.0.3development
@types/node
Environment
{
  "local_name": "@types/node",
  "alias": false,
  "peer_metadata": null
}
^20.16.11development
@types/qs
Environment
{
  "local_name": "@types/qs",
  "alias": false,
  "peer_metadata": null
}
^6.9.11development
@typescript-eslint/eslint-plugin
Environment
{
  "local_name": "@typescript-eslint/eslint-plugin",
  "alias": false,
  "peer_metadata": null
}
^6.13.2development
@typescript-eslint/parser
Environment
{
  "local_name": "@typescript-eslint/parser",
  "alias": false,
  "peer_metadata": null
}
^6.13.2development
eslint
Environment
{
  "local_name": "eslint",
  "alias": false,
  "peer_metadata": null
}
^8.55.0development
eslint-config-prettier
Environment
{
  "local_name": "eslint-config-prettier",
  "alias": false,
  "peer_metadata": null
}
^9.1.0development
eslint-plugin-prettier
Environment
{
  "local_name": "eslint-plugin-prettier",
  "alias": false,
  "peer_metadata": null
}
^5.0.1development
prettier
Environment
{
  "local_name": "prettier",
  "alias": false,
  "peer_metadata": null
}
^3.1.0development
resolve-tspaths
Environment
{
  "local_name": "resolve-tspaths",
  "alias": false,
  "peer_metadata": null
}
^0.8.22development
tsx
Environment
{
  "local_name": "tsx",
  "alias": false,
  "peer_metadata": null
}
^4.6.2development
typescript
Environment
{
  "local_name": "typescript",
  "alias": false,
  "peer_metadata": null
}
^5.3.3development
vite-tsconfig-paths
Environment
{
  "local_name": "vite-tsconfig-paths",
  "alias": false,
  "peer_metadata": null
}
^5.0.1development
vitest
Environment
{
  "local_name": "vitest",
  "alias": false,
  "peer_metadata": null
}
^2.1.2development
xray-zod
Environment
{
  "local_name": "xray-zod",
  "alias": false,
  "peer_metadata": null
}
^1.0.0development
zod
Environment
{
  "local_name": "zod",
  "alias": false,
  "peer_metadata": null
}
^3.23.8development

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "integrity": "sha512-aDagZAk9es2sB+Z90rFwYizfOj7ke3+xsRWJal89iJwwVZJESpSBSHnPaBtttCFxPwRV2rawzb6zUKRCAP7stg==",
  "shasum": "34cd7197a3743b8545a031ea910bc94505bb1662",
  "tarball": "https://registry.npmjs.org/3xworkaround/-/3xworkaround-2.2.1.tgz",
  "fileCount": 56,
  "unpackedSize": 72564,
  "signatures": [
    {
      "keyid": "SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U",
      "sig": "MEQCIEuGpBnlz1LEv/x/N88x+xukgrP+7PmlkzjvXhvrduySAiA3WNXNfNUnMJJpAGmx9dN50vcePJ02JLlFYIkhgcB/jw=="
    }
  ]
}

Repository

PENDING
mehdikhody/3x-ui-js

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 19:56 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:e24a1067a8f73dfd0991a3fac6e1ca8088dd6dd48ca483a7ca28e862f42a4e68

Other collected versions

2.1.115 NovView all collected versions →