HorizonRepublic/nestjs-jetstream
NestJS transport for NATS JetStream — durable events, broadcast, ordered delivery, RPC, dead letter queues, and lifecycle hooks
The NATS JetStream transport NestJS microservices need —
durable, retried, traced — under the same @EventPattern
and @MessagePattern decorators you already use.
Documentation · Quick Start · API Reference
NestJS' built-in NATS transport loses messages on pod restart, doesn't retry on failure, and gives you nothing to debug with. JetStream fixes all three — but wiring it into NestJS by hand is a project on its own.
This library is the swap. Same , same , same . Durability, retries, and tracing underneath.
No download data available
No tracked packages depend on this.
@EventPattern@MessagePatternclient.emit()traceparent propagated through every hop.npm i @horizon-republic/nestjs-jetstream
// app.module.ts
@Module({
imports: [
JetstreamModule.forRoot({ servers: ['nats://localhost:4222'] }),
],
})
export class AppModule {}
// orders.controller.ts
@Controller()
export class OrdersController {
@EventPattern('orders.created')
async onCreated(@Payload() order: Order) {
await this.billing.charge(order);
}
}
That's it. At-least-once. Retries on throw. Traced end-to-end.
The full configuration surface, every pattern, and the production checklist live in the documentation.
The transport is covered by an extensive test suite (unit and integration) — see the Codecov report above.
Runnable demos for most supported patterns live under examples/.
MIT · © 2026 Horizon Republic · Changelog · Contributing · Security