@bitspacerlabs/rabbit-relay
v0.6.1
Published
A RabbitMQ-based event framework
Maintainers
Readme
Why Rabbit Relay?
amqplib is powerful, but it’s low-level. Rabbit Relay keeps “real RabbitMQ concepts” (exchanges, queues, routing keys), and adds:
- Type-safe events (typed payloads + versioning)
- Cleaner publish / consume APIs (less boilerplate)
- Explicit topology & ownership (no hidden abstractions)
- Reliable defaults (so every service doesn’t reinvent the same setup)
If you already use RabbitMQ and you want a better TypeScript developer experience, Rabbit Relay is for you.
Installation
npm i @bitspacerlabs/rabbit-relayTip: Rabbit Relay ships TypeScript-first and supports both ESM and CommonJS builds.
Quickstart (typed events)
import { RabbitMQBroker, event } from "@bitspacerlabs/rabbit-relay";
const broker = new RabbitMQBroker("example.service");
// Create a publisher bound to your queue + exchange
const pub = await broker
.queue("example.q")
.exchange("example.exchange", { exchangeType: "topic" });
// Define typed events (name + version)
const send = event("send", "v1").of<{ message: string }>();
// Build a typed API and publish
const api = pub.with({ send });
await api.send({ message: "hello world" });Direct publish (produce)
import { RabbitMQBroker, event } from "@bitspacerlabs/rabbit-relay";
const broker = new RabbitMQBroker("example.publisher");
const pub = await broker
.queue("example.q")
.exchange("example.direct", { exchangeType: "direct" });
const hello = event("hello", "v1").of<{ msg: string }>();
await pub.produce(hello({ msg: "world" }));Examples
See runnable examples in:
examples/→ https://github.com/bitspacerlabs/rabbit-relay/tree/main/examples
When to use Rabbit Relay
- You already use RabbitMQ
- You want type-safe events
- You prefer explicit topology and ownership
- You don’t want “magic” abstractions
Project status
Rabbit Relay is actively evolving. If something is unclear or missing, please open an issue (or start a discussion) with:
- what you’re trying to build
- the RabbitMQ pattern you’re using (pub/sub, work queue, RPC, etc.)
- a small code snippet
Contributing
Contributions are welcome ❤️
- Read:
CONTRIBUTING.md - Code of Conduct:
CODE_OF_CONDUCT.md - Security:
SECURITY.md
If you want to help but don’t know where to start, check issues labeled good first issue.
License
MIT © BitSpacer Labs
