Getting Started
Installation
Section titled “Installation”Install the core package:
Define a Domain
Section titled “Define a Domain”Contracts are the single source of truth. Define events, commands, and RPC operations with Zod schemas:
The returned OrdersDomain object contains typed contract objects for each operation. These carry all naming conventions — exchange names, routing keys, publication/subscription names — so you never deal with string literals.
Create Handlers
Section titled “Create Handlers”Handlers declare what your service processes. Each handler is bound to a contract:
Handler payloads are typed via z.infer from the contract’s schema. The context.broker gives handlers access to typed outbound methods for publishing events, sending commands, or making RPC calls.
Build the Service
Section titled “Build the Service”Pass handlers and publish declarations to hoppity.service() and call .build():
That’s it. Hoppity derives the full Rascal topology from your handlers and publish declarations — exchanges, queues, bindings, publications, and subscriptions — creates the broker, wires handlers, and attaches typed outbound methods.
Use the Broker
Section titled “Use the Broker”The returned ServiceBroker extends Rascal’s BrokerAsPromised with typed methods:
Handling RPC Errors
Section titled “Handling RPC Errors”broker.request() rejects with an RpcError that carries a code you can switch on:
NO_RESPONDER comes back immediately (via the AMQP mandatory flag) when a request routes to no queue — for example when no responder service is deployed — so you fail fast instead of waiting out the timeout. A responder whose durable queue exists but is currently offline still routes into that queue and surfaces as TIMEOUT.
Next Steps
Section titled “Next Steps”- Read the Concepts guide for a deep dive into middleware, the seven build phases, and naming conventions
- Read the Interceptors guide for tracing, metrics, and per-message cross-cutting concerns
- Browse the Examples to see runnable demos of pub/sub and contract-driven multi-service patterns
- Check the API reference in the sidebar for full type documentation