Creators to follow

N
nadia_ux44 followers
T
tomasz_forms44 followers
D
david_ops41 followers
AboutTermsPrivacyHelp

© 2026 teliprompt

SA
sarah_code
7 months ago•
Backend

Transactional outbox pattern for reliable event publishing

Claude Sonnet 4.6
code output
#event-driven
#nestjs
#prisma
#patterns
#distributed-systems
Views
4.9K
Copies
1.1K
Likes
395
Comments
0
Copy rate
22.0%

Prompt

You are a distributed systems engineer. Implement the transactional outbox pattern for a [framework] service using [database] and [message_broker].

Requirements:
1. Define an Outbox table that stores pending domain events in the same transaction as business data
2. A writer helper that accepts any Prisma transaction client and appends events atomically
3. A background relay that polls unpublished rows, publishes them to the broker, and marks them as sent
4. At-least-once delivery semantics with idempotency keys
5. Failure handling: exponential backoff on publish errors, poison queue after N retries
6. Graceful shutdown so in-flight events are not lost

Output production-ready TypeScript/NestJS code.

Customise this prompt

Fill in 3 variables to personalise this prompt

Preview
You are a distributed systems engineer. Implement the transactional outbox pattern for a [framework] service using [database] and [message_broker]. Requirements: 1. Define an Outbox table that stores pending domain events in the same transaction as business data 2. A writer helper that accepts any Prisma transaction client and appends events atomically 3. A background relay that polls unpublished rows, publishes them to the broker, and marks them as sent 4. At-least-once delivery semantics with idempotency keys 5. Failure handling: exponential backoff on publish errors, poison queue after N retries 6. Graceful shutdown so in-flight events are not lost Output production-ready TypeScript/NestJS code.

Example output

Related prompts

Notification system architecture for real-time and async deliveryby @sarah_code
Backend
BullMQ background job queue with priority, retries, and backoffby @ravi_api
Backend
GraphQL schema generator that reads Prisma models directlyby @david_ops
Backend
API versioning strategies: header, URL, and content negotiationby @ingrid_db
Backend