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

marzban-sdk

v4.1.0

Published

The complete TypeScript SDK for the Marzban API — fully typed endpoints, auto token refresh, resilient retries, a WebSocket reconnect state machine for log streaming, HMAC-verified webhooks, Zod validation and a terminal shutdown lifecycle. Isomorphic for

Readme

MarzbanSDK

The complete TypeScript SDK for the Marzban API.

Typed endpoints, auto token refresh, retries, WebSocket log streaming, webhooks and runtime validation — isomorphic for Node.js and the browser.

npm version npm downloads total downloads bundle size types license

Documentation · Quick Start · API Reference


marzban-sdk bundles the infrastructure layer a serious Marzban integration needs — auth, retries, resilient WebSocket reconnects, webhooks, structured errors, and a clean shutdown lifecycle — so you ship features, not plumbing. The typed API surface itself is generated straight from the official OpenAPI spec, so every endpoint, parameter and response has full autocomplete and never drifts from what the panel actually accepts.

Install

npm install marzban-sdk

Also works with pnpm add, yarn add, or bun add.

Quick start

import { createMarzbanSDK } from 'marzban-sdk'

// One call authenticates and wires up every API module.
// Token refresh and retries are handled for you.
const sdk = await createMarzbanSDK({
  baseUrl: 'https://panel.example.com',
  username: 'admin',
  password: 'secret',
})

const { users } = await sdk.user.getUsers({ status: 'active', limit: 10 })

// Stream real-time logs from the core over WebSocket — auto-reconnects on drop
const stream = await sdk.logs.connectByCore({
  onMessage: data => console.log(data),
})

Features

  • 🔠 End-to-end type safety — every endpoint, parameter and response is fully typed, generated straight from the official OpenAPI spec, with matching Zod schemas.
  • 🌐 Truly cross-runtime — one package, one identical API across Node.js, Bun, Deno and the browser.
  • 🔑 Flexible authentication — log in on init or hand it an existing JWT; expired sessions refresh transparently, so your code never touches a token.
  • 🔁 Built-in resilience — exponential back-off with jitter for transient HTTP failures, plus a full WebSocket reconnect state machine (time-budgeted, replay-deduplicated) for log streams.
  • 🎯 Classified errors — AuthError, HttpError, ConfigurationError and webhook errors all extend SdkError with a machine-readable code and type-guard helpers.
  • 📡 Real-time logs & webhooks — WebSocket log streams from the core and nodes, plus HMAC-verified inbound webhooks with typed event subscriptions.
  • 🔐 Custom CA support — pass a Node httpsAgent to trust a self-hosted panel's self-signed certificate, without disabling TLS verification.
  • 🧹 Explicit shutdown — await sdk.destroy() is idempotent and terminal: it closes WebSocket streams, clears webhook listeners and the stored token, and every guarded operation on that instance rejects with SdkDestroyedError from then on.

Documentation

Full guides, configuration reference and the complete typed API live at ilmar7786.github.io/marzban-sdk:

Contributing

This package lives in the marzban-sdk monorepo — see the root CONTRIBUTING.md for how to submit a patch. Found a bug or have an idea? Open an issue.

License

MIT © ilmar7786