Installation
Prerequisites
- Node.js 18 or higher
- RabbitMQ or another AMQP 0.9.1 broker
Package Installation
Install the core packages:
bash
pnpm add @amqp-contract/contract @amqp-contract/client @amqp-contract/worker
pnpm add amqplib zod
pnpm add -D @types/amqplibbash
npm install @amqp-contract/contract @amqp-contract/client @amqp-contract/worker
npm install amqplib zod
npm install -D @types/amqplibbash
yarn add @amqp-contract/contract @amqp-contract/client @amqp-contract/worker
yarn add amqplib zod
yarn add -D @types/amqplibOptional Packages
AsyncAPI Generation
For generating AsyncAPI specifications:
bash
pnpm add @amqp-contract/asyncapiNestJS Integration
For NestJS applications, use the dedicated integration packages:
bash
# For publishing messages
pnpm add @amqp-contract/client-nestjs
# For consuming messages
pnpm add @amqp-contract/worker-nestjs
# Or install both
pnpm add @amqp-contract/client-nestjs @amqp-contract/worker-nestjsbash
npm install @amqp-contract/client-nestjs @amqp-contract/worker-nestjsbash
yarn add @amqp-contract/client-nestjs @amqp-contract/worker-nestjsThese packages include all necessary dependencies and provide automatic lifecycle management for NestJS applications.
Alternative Schema Libraries
Instead of Zod, you can use other Standard Schema-compatible libraries:
bash
# Valibot
pnpm add @amqp-contract/valibot valibot
# ArkType
pnpm add @amqp-contract/arktype arktypeRabbitMQ Setup
Using Docker
The easiest way to get started:
bash
docker run -d \
--name rabbitmq \
-p 5672:5672 \
-p 15672:15672 \
rabbitmq:4-managementAccess the management UI at http://localhost:15672 (guest/guest).
Manual Installation
Follow the official RabbitMQ installation guide.
Next Steps
- Follow the Getting Started guide
- Learn about Core Concepts
- Explore Examples
- For NestJS users: Check out NestJS Client Usage and NestJS Worker Usage