{"id":26833,"library":"clhq-auth-module","title":"clhq-auth-module","description":"A reusable authentication module for NestJS v11 applications, currently in early alpha (v1.1.0-alpha.189). It provides guards, decorators, and services for JWT-based auth with role-based access control. Differentiators: minimal configuration, full TypeScript support, and designed for monorepo workflows. Requires @nestjs/core >=11.0.0 and @nestjs/common >=11.0.0. Active development with frequent breaking changes before stable.","status":"active","version":"1.1.0-alpha.189","language":"javascript","source_language":"en","source_url":"https://github.com/reacthub-pricematch/clhq-api-monorepo","tags":["javascript","typescript"],"install":[{"cmd":"npm install clhq-auth-module","lang":"bash","label":"npm"},{"cmd":"yarn add clhq-auth-module","lang":"bash","label":"yarn"},{"cmd":"pnpm add clhq-auth-module","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency for NestJS integration","package":"@nestjs/core","optional":false},{"reason":"Peer dependency for NestJS integration","package":"@nestjs/common","optional":false}],"imports":[{"note":"ESM-only package; CommonJS require will fail.","wrong":"const AuthModule = require('clhq-auth-module')","symbol":"AuthModule","correct":"import { AuthModule } from 'clhq-auth-module'"},{"note":"Guard name is case-sensitive and includes 'Auth'.","wrong":"import { JWTGuard } from 'clhq-auth-module'","symbol":"JwtAuthGuard","correct":"import { JwtAuthGuard } from 'clhq-auth-module'"},{"note":"Custom Roles decorator provided by this module, not from passport.","wrong":"import { Roles } from '@nestjs/passport'","symbol":"Roles","correct":"import { Roles } from 'clhq-auth-module'"},{"note":"Use this decorator to access the authenticated user in route handlers.","wrong":"import { Req } from '@nestjs/common'","symbol":"CurrentUser","correct":"import { CurrentUser } from 'clhq-auth-module'"}],"quickstart":{"code":"import { Module } from '@nestjs/common';\nimport { AuthModule } from 'clhq-auth-module';\nimport { AppController } from './app.controller';\n\n@Module({\n  imports: [\n    AuthModule.forRoot({\n      jwtSecret: process.env.JWT_SECRET ?? '',\n      expiry: '1h',\n    }),\n  ],\n  controllers: [AppController],\n})\nexport class AppModule {}","lang":"typescript","description":"Shows how to import and configure AuthModule with a JWT secret in a NestJS application."},"warnings":[{"fix":"Pin to a specific alpha version and monitor release notes.","message":"The module API is unstable in alpha versions; forRoot() options may change without notice.","severity":"breaking","affected_versions":"<1.0.0"},{"fix":"Pass configuration directly to forRoot().","message":"Usage of 'AuthModule.forRootAsync()' with factory provider is deprecated in favor of synchronous forRoot().","severity":"deprecated","affected_versions":">=1.1.0-alpha.150"},{"fix":"Add @UseGuards(JwtAuthGuard) to controller class or individual routes.","message":"JwtAuthGuard must be applied to controllers or routes; it does not automatically protect all endpoints.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Define an enum for roles and pass an array of enum values.","message":"The 'Roles' decorator previously accepted an array of strings; now requires an array of enums.","severity":"breaking","affected_versions":">=1.1.0-alpha.170"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run 'npm install clhq-auth-module' and ensure 'moduleResolution' is 'node' or 'node16' in tsconfig.json.","cause":"Missing npm install or TypeScript not configured to resolve the module.","error":"Cannot find module 'clhq-auth-module' or its corresponding type declarations."},{"fix":"Provide a valid JWT token in the Authorization header: 'Bearer <token>'.","cause":"Request lacks valid JWT token or token is expired.","error":"Error: Forbidden resource"},{"fix":"Ensure @nestjs/core and @nestjs/common are installed and AuthModule.forRoot() is added to the imports array.","cause":"AuthModule.forRoot() not called or missing peer dependencies.","error":"Nest can't resolve dependencies of the AuthModule (JwtAuthGuard, ...)"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}