open-index/open-npm huggingface dataset:
npm package: @leadinvr/jwt-guard
Description: JWT guard for nestjs
Author: Stanley
Latest version: 1.1.12

# leadinvr-jwt-guard

JWT Guard for NestJS framework

<p align="center">
  <a href="https://www.npmjs.com/package/@leadinvr/jwt-guard">
    <img src="https://img.shields.io/npm/v/@leadinvr/jwt-guard.svg?style=for-the-badge" alt="npm version" />
  </a>
  <a href="https://www.npmjs.com/package/@leadinvr/jwt-guard">
    <img src="https://img.shields.io/npm/dt/@leadinvr/jwt-guard.svg?style=for-the-badge" alt="npm total downloads" />
  </a>
  <a href="https://www.npmjs.com/package/@leadinvr/jwt-guard">
    <img src="https://img.shields.io/npm/dm/@leadinvr/jwt-guard.svg?style=for-the-badge" alt="npm monthly downloads" />
  </a>
  <a href="https://www.npmjs.com/package/@leadinvr/jwt-guard">
    <img src="https://img.shields.io/npm/l/@leadinvr/jwt-guard.svg?style=for-the-badge" alt="npm license" />
  </a>
</p>

# Features

-   Implement JWT guard in NestJS

# Install

```bash
npm i @leadinvr/jwt-guard
```

# Quick Start

### Register Option

```ts
// Module Options
export class JWTGuardModuleOptions {
    /**
     * Redis URL for storing revoked tokens
     * This URL is used to connect to a Redis instance where revoked tokens are stored.
     * If not provided, the service will use in-memory storage.
     * Example: "redis://localhost:6379" or "redis://username:password@localhost:6379"
     * @default ""
     */
    redisUrl: string = "";
    /**
     * JWT Secret
     */
    secret: string = "";

    /**
     * Jwt Issuer
     */
    issuer?: string;

    /**
     * Jwt Audience
     */
    audience?: string;
}
```

### Register

```ts
JwtGuardModule.register({
    redisUrl: "",
    secret: "test-secret",
    issuer: "test",
    audience: "test",
});

JwtGuardModule.registerAsync({
    useFactory: () => ({
        redisUrl: "",
        secret: "test-secret",
        issuer: "test",
        audience: "test",
    }),
});
```

# Trouble Shooting

-   JWT Guard Module should register before other guard providers, otherwise the payload may not inject correctly
npm package: @leadinvr/nestjs-starter
Description: startup for nestjs projects
Author: Stanley
Latest version: 1.2.16

# Starter for NestJS

starter module for nestjs

<p align="center">
  <a href="https://www.npmjs.com/package/@leadinvr/nestjs-starter">
    <img src="https://img.shields.io/npm/v/@leadinvr/nestjs-starter.svg?style=for-the-badge" alt="npm version" />
  </a>
  <a href="https://www.npmjs.com/package/@leadinvr/nestjs-starter">
    <img src="https://img.shields.io/npm/dt/@leadinvr/nestjs-starter.svg?style=for-the-badge" alt="npm total downloads" />
  </a>
  <a href="https://www.npmjs.com/package/@leadinvr/nestjs-starter">
    <img src="https://img.shields.io/npm/dm/@leadinvr/nestjs-starter.svg?style=for-the-badge" alt="npm monthly downloads" />
  </a>
  <a href="https://www.npmjs.com/package/@leadinvr/nestjs-starter">
    <img src="https://img.shields.io/npm/l/@leadinvr/nestjs-starter.svg?style=for-the-badge" alt="npm license" />
  </a>
</p>

# Quick Start

## Install

```bash
npm i @leadinvr/nestjs-starter
```

## Usage

### Environment Setup

启动模块需要设置以下变量

```ts
/**
 * StarterOption interface for configuring the NestJS application.
 * It includes options for body parser limit, CORS, and an initialization function.
 */
export class StarterModuleOptions {
    /**
     * The URL for the Redis server.
     */
    redisUrl: string = "";

    /**
     * The time-to-live (TTL) for Redis cache in seconds.
     */
    redisTTL: number = 10; // Default TTL for Redis cache in seconds

    /**
     * The workspace name for Redis, default is "default".
     */
    redisWorkspace: string = "default";

    /**
     * The secret for JWT tokens.
     */
    jwtSecret: string = "jwt-secret";

    /**
     * The issuer for JWT tokens.
     */
    jwtIssuer: string = "jwt-issuer";

    /**
     * The audience for JWT tokens.
     */
    jwtAudience: string = "jwt-audience";
}
```

### Startup

```ts
export async function startup(module: any, opt: StarterOption);
```