๐ฏ
Declarative API
Clean, intuitive subscriber API inspired by Rails and NestJS. Write less boilerplate, focus on business logic.
๐
Battle-Tested Reliability
Built-in Inbox/Outbox patterns, Dead Letter Queue, and automatic retries ensure your messages are delivered.
๐
Cross-Language
Full TypeScript and Ruby implementations with identical APIs. Build polyglot microservices with ease.
โก
Production Ready
Comprehensive monitoring, health checks, and observability. Battle-tested in high-throughput production systems.
๐งช
Developer Experience
Extensive testing utilities, fake modes, and comprehensive documentation make development a breeze.
๐ง
Auto-Topology
Automatic JetStream stream and consumer management. No manual NATS configuration required.
JavaScript/TypeScript
import { Publisher, Subscriber } from 'nats-pubsub';
// Publish a message
const publisher = new Publisher(config);
await publisher.publish('order.created', {
orderId: '123',
amount: 99.99
});
// Subscribe to messages
class OrderSubscriber extends Subscriber {
constructor() {
super('order.created');
}
async handle(message, metadata) {
await processOrder(message);
}
}Ruby
require 'nats_pubsub'
# Publish a message
NatsPubsub.publish('order.created', {
order_id: '123',
amount: 99.99
})
# Subscribe to messages
class OrderSubscriber < NatsPubsub::Subscriber
subscribe_to 'order.created'
def handle(message, context)
process_order(message)
end
endReady to get started?
Choose your language and start building in minutes