원클릭으로
getting-started
Use when configuring NATS messaging, subscribers, or the simple NatsClient in NestJS applications.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Use when configuring NATS messaging, subscribers, or the simple NatsClient in NestJS applications.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Use when scanning NestJS providers with DiscoveryService-backed utilities.
Use when working with the @wisemen/nestjs-custom-fields package — developer-defined custom fields in NestJS with TypeORM persistence and runtime validation. Covers registering the CustomFieldDefinition entity, authoring definitions with customFieldDefinition(), storing resolved values via @CustomFieldValueColumn(), exposing them through CustomFieldValueDto / @IsCustomFields(), and validating submissions with CustomFieldDefinitionsRepository + validateCustomFieldValues(). Use this whenever a task involves custom field definitions, CustomFieldValue columns, custom-field DTOs, or tenant-scoped field definitions, even if the package is not named explicitly.
Use when defining Typesense collections, collectors, and search queries in NestJS APIs.
Generate PDFs through API2PDF in NestJS. Use when converting HTML or URLs to PDFs in apis.
Use when storing and validating multilingual text in NestJS apis with TypeORM and class-validator.
Use when writing tests for NestJS api packages with custom expect matchers, domain events, or transactional TypeORM use cases.
| name | getting-started |
| description | Use when configuring NATS messaging, subscribers, or the simple NatsClient in NestJS applications. |
Use NatsModule.forRoot(...) for decorator-driven subscribers, consumers,
services, and streams. Use NatsClientModule.forRootAsync(...) when you only
need the fire-and-forget NatsClient publisher.
import { Module } from '@nestjs/common'
import { NatsModule } from '@wisemen/nestjs-nats'
@Module({
imports: [
NatsModule.forRoot({
modules: [MySubscriberModule, MyConsumerModule],
defaultClient: MyNatsConnection,
streams: [MyStream]
})
]
})
export class NatsAppModule {}
import { ConfigService } from '@nestjs/config'
import { NatsConnection, NatsSubscriber, OnNatsMessage, NatsMessageData, NatsMsgDataJsonPipe } from '@wisemen/nestjs-nats'
@NatsConnection((config: ConfigService) => ({
name: 'default',
servers: config.getOrThrow('NATS_ENDPOINT')
}))
export class MyNatsConnection {}
@NatsSubscriber(() => ({
subject: 'my.subject',
name: 'my-subscriber'
}))
export class MySubscriber {
@OnNatsMessage()
async handle (@NatsMessageData(NatsMsgDataJsonPipe) payload: unknown): Promise<void> {
console.info(payload)
}
}
import { Module } from '@nestjs/common'
import { ConfigService } from '@nestjs/config'
import { credsAuthenticator } from '@nats-io/transport-node'
import { NatsClientModule } from '@wisemen/nestjs-nats'
@Module({
imports: [NatsClientModule.forRootAsync({
inject: [ConfigService],
useFactory: (config: ConfigService) => ({
client: {
servers: config.getOrThrow('NATS_ENDPOINT'),
authenticator: credsAuthenticator(
new TextEncoder().encode(config.getOrThrow('NATS_CREDS'))
)
},
onConnectError: (error) => {
console.error('Initial NATS connection failed', error)
}
})
})],
exports: [NatsClientModule]
})
export class OutboundNatsModule {}
client is passed directly to @nats-io/transport-node. If you use NATS
credentials, pass them through client.authenticator; there is no separate
package-level nkey option.
onConnectError runs only when a connection attempt fails before the first
successful connection. Later disconnects and reconnects are handled by the
underlying NATS client.
import { Injectable } from '@nestjs/common'
import { NatsClient } from '@wisemen/nestjs-nats'
@Injectable()
export class MyService {
constructor (private readonly nats: NatsClient) {}
async notifySomething (): Promise<void> {
await this.nats.publish(
'my.subject',
new TextEncoder().encode(JSON.stringify({ hello: 'world' }))
)
}
}