Infrastructure
crabbyq
A declarative, asynchronous Rust framework for message-driven microservices.
Axum's ergonomics, a broker's mindset.
CrabbyQ takes the broker subscription loop and the route dispatch off your desk so the code you write is handlers and domain logic. Underneath it is Tower — routes are tower::Services, which is what lets layers and middleware fall out naturally rather than being bolted on.
The core stays light on purpose: only JSON is on by default, and every broker backend is an explicit Cargo feature.
-
Broker-agnostic core
One
Routerwith typed shared state, and route registration that composes — including whole sub-routers. - Familiar extractors State, Subject, Headers, Body, and optional payload extractors like Json and Cbor, with the axum rule that body-consuming extractors go last.
- Request–reply RPC-style round trips through handler return values, on top of a publish/subscribe substrate.
- Real backends NATS (including JetStream routes and publishing), Redis pub/sub, and MQTT.
A handler is a function.
No subscription loop, no dispatch table — a route name and something async to run.
use crabbyq::prelude::*;
use crabbyq::brokers::NatsBroker;
async fn handle(e: Event) -> CrabbyResult<()> {
info!("got: {}", e.subject());
Ok(())
}
let app = Router::new()
.route("test.simple", handle)
.into_service(nats_broker);
Lamantin AI