
🚀 MarzbanSDK
📖 Table of Contents
- ✨ Features
- 📦 Installation
- 🚀 Quick Start
- 🔍 How It Works
- 📚 API Documentation
- 📡 WebSocket Support
- 🤝 Contributing
- 📜 License
- ⭐ Support the Project
✨ Features
- ✅ Full TypeScript Support – Schema definitions for all parameters, responses, and methods.
- 🔄 Automatic Token Refresh – Keeps your session alive without manual intervention.
- 🔁 Retry Mechanism – Ensures resilience against network failures.
- 🛠️ Comprehensive API Support – Access all Marzban API features.
- 📡 WebSocket Support – Real-time log streaming from core services and nodes.
📦 Installation
Install MarzbanSDK via npm:
npm install marzban-sdk
Or using yarn:
yarn add marzban-sdk
🚀 Quick Start
import { MarzbanSDK, Config } from "marzban-sdk";
const config: Config = {
baseUrl: "https://api.example.com",
username: "your-username",
password: "your-password",
retries: 3, // Option. default 3
token: 'token' // Option
};
const sdk = new MarzbanSDK(config);
// Fetch user details
sdk.user.getUserById("user-id").then((user) => {
console.log(user);
});
// get an authorization token
sdk.getAuthToken().then((token) => {
console.log(token)
});
🔍 How It Works
1️⃣ Full Typing and Schema
MarzbanSDK provides full TypeScript typing and schema definitions for all API methods, parameters, and responses.
2️⃣ Generated Sources
The SDK is auto-generated from the OpenAPI specification, ensuring it stays up-to-date with API changes.
- The entry point for the SDK is the
MarzbanSDK
class. - All API methods are dynamically generated based on the OpenAPI schema.
📚 API Documentation
For detailed API reference, visit the API Documentation.
📡 WebSocket Support
MarzbanSDK supports WebSocket for real-time log streaming.
You can receive logs from both the core server and individual nodes.
For more details, check the WebSocket Guide.
🤝 Contributing
We welcome contributions! If you'd like to improve MarzbanSDK, please:
- Fork the repository 🚀
- Create a new branch 🔧
- Submit a pull request 🎉
For details, check our Contribution Guidelines.
📜 License
This project is licensed under the MIT License.
⭐ Support the Project
If you find marzban-sdk useful, please give it a star on GitHub! It helps us stay motivated and grow the project.