A NestJS wrapper for @remnawave/xtls-sdk
Find a file
2026-01-29 02:43:32 +03:00
.github/workflows chore: bump package version to 0.6.1, update NestJS and nice-grpc dependencies, and refactor configuration interfaces 2026-01-29 02:43:32 +03:00
src chore: bump package version to 0.6.1, update NestJS and nice-grpc dependencies, and refactor configuration interfaces 2026-01-29 02:43:32 +03:00
.eslintrc.js feat: init 2024-11-15 19:00:00 +03:00
.gitignore feat: init 2024-11-15 19:00:00 +03:00
.prettierrc chore: update package version to 0.0.13, adjust peer dependencies, and clean up module imports 2024-12-23 15:07:41 +03:00
LICENCE chore: change license from MIT to AGPL-3.0-only in package.json and README.md 2025-01-10 00:08:07 +03:00
nest-cli.json feat: init 2024-11-15 19:00:00 +03:00
package-lock.json chore: bump package version to 0.6.1, update NestJS and nice-grpc dependencies, and refactor configuration interfaces 2026-01-29 02:43:32 +03:00
package.json chore: bump package version to 0.6.1, update NestJS and nice-grpc dependencies, and refactor configuration interfaces 2026-01-29 02:43:32 +03:00
README.md chore: change license from MIT to AGPL-3.0-only in package.json and README.md 2025-01-10 00:08:07 +03:00
tsconfig.json fix: remove logs 2024-11-15 21:49:16 +03:00

NestJS XTLS SDK Module

GitHub top language GitHub Repo stars

npm version GitHub Tag

Build Status Downloads License NPM Last Update

Known Vulnerabilities Coverage Status

A NestJS module wrapper for the XTLS SDK, providing seamless integration of XTLS functionality into your NestJS applications.

Installation

npm install @remnawave/xtls-sdk-nestjs

Features

  • 🚀 Easy integration with NestJS applications
  • Supports both synchronous and asynchronous configuration
  • 🔄 Automatic cleanup on application shutdown
  • 🌐 Global module availability
  • 🎯 Custom decorator for easy injection

Quick Start

Synchronous Configuration

import { XtlsSdkNestjsModule } from '@remnawave/xtls-sdk-nestjs';

@Module({
  imports: [
    XtlsSdkNestjsModule.forRoot({
      ip: 'your-ip-address',
      port: 'your-port',
    }),
  ],
})
export class AppModule {}

Asynchronous Configuration

import { XtlsSdkNestjsModule } from '@remnawave/xtls-sdk-nestjs';

@Module({
  imports: [
    XtlsSdkNestjsModule.forRootAsync({
      imports: [ConfigModule],
      useFactory: async (configService: ConfigService) => ({
        ip: configService.get('XTLS_IP'),
        port: configService.get('XTLS_PORT'),
      }),
      inject: [ConfigService],
    }),
  ],
})
export class AppModule {}

Usage in Services

Use the @InjectXtls() decorator to inject the XTLS SDK instance into your services:

import { Injectable } from '@nestjs/common';
import { InjectXtls } from '@remnawave/xtls-sdk-nestjs';
import { XtlsApi } from '@remnawave/xtls-sdk';

@Injectable()
export class YourService {
  constructor(@InjectXtls() private readonly xtlsApi: XtlsApi) {}

  async yourMethod() {
    // Use xtlsApi here
  }
}

Configuration Options

Option Type Description
ip string The IP address for the XTLS connection
port string The port number for the XTLS connection

API Reference

XtlsSdkNestjsModule

  • forRoot(options: XtlsModuleOptions): Static method for synchronous module configuration
  • forRootAsync(options: AsyncModuleOptions): Static method for asynchronous module configuration

Decorators

  • @InjectXtls(): Decorator for injecting the XTLS SDK instance

License

AGPL-3.0-only

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Support

For support, please open an issue in the GitHub repository.