Skip to main content

@nest-native/messaging

Transactional outbox + idempotent inbox for NestJS, on Drizzle + Kafka

Out

Transactional Outbox

enqueue() writes the event row inside your business transaction via nestjs-cls, so the event and your writes commit atomically. A background claimer relays committed rows to the broker.

In

Idempotent Inbox

runOnce() dedups redeliveries on a unique (source, message_key) row written in the same transaction as the side effect — effective exactly-once processing.

DB

Drizzle-Native Stores

Per-dialect stores for better-sqlite3 (sync) and Postgres (async), with table factories you add to your schema and migrate with drizzle-kit. The core engine stays dialect-agnostic.

Bus

Pluggable Transport

The claimer publishes through a dependency-free OutboxTransport seam. Ship to Kafka via @nest-native/kafka, or stay in-process — the core never imports a broker client.

Zero

Zero Runtime Dependencies

The published package keeps runtime dependencies empty. Nest, Drizzle, your driver, and the optional Kafka client stay under the host application's control as peer dependencies.

Test

100% Tested

The core engine is covered to 100% across branches, functions, lines, and statements — both dialects and the Kafka path, with a gated real-broker run proving exactly-once under redelivery.