EventBase
A type-safe, macro-driven event-driven framework for Rust applications.
What it is:
event_base is a lightweight, macro-driven event-driven framework for building reliable, observable, and scalable applications in Rust. With event_base, you declare handlers, chain middleware, and define reliable workflowsβall at compile time.
What it is not:
event_base is not a distributed message queue. It does not transport data between services. Ievent_base focuses on orchestrating events inside your application: defining events, declaring handlers, managing state, and ensuring reliability.
β¨ Features
- π Type-safe events β Define events as plain Rust structs. The compiler guarantees correctness.
- π Pluggable backends β
memory(flume),file,redis,kafka,mqtt. Swap without changing your handlers. - β‘ Macro-driven DX β
#[handler]turns any async function into a message handler. No boilerplate. - π¦ Multiple delivery modes β Standard (competing consumers), Broadcast (all workers), and Repeated (N times).
- πΎ Application-level WAL β Durable persistence with crash recovery. Your events survive restarts.
- π Automatic retry & Dead Letter Queue β Failed messages retry with configurable backoff, then land in DLQ.
- π Built-in observability β Audit logging (
_system.audit) and distributed tracing (_system.trace) enabled by default. - π― Middleware support β Compose logging, metrics, retries, and custom logic via middleware pipeline.
- π Distributed-ready β Host/Worker node model with built-in discovery and shutdown coordination.
- π Graceful shutdown β 7 shutdown strategies, including two-stage drain and force timeout.
- π§© gRPC management API β Query node status, list workers, trigger shutdown, stream metrics.
β Why event_base?
In Rust, you have message queue clients (lapin, rdkafka) and event sourcing libraries (eventastic, sourcerer). But nothing bridges the gap β application-level event orchestration with macro-driven DX and enterprise-grade reliability built in.
event_base is for you if:
- You want type-safe, compile-time guaranteed event handlers.
- You need persistence and crash recovery without running a separate message broker.
- You want observability (audit + trace) enabled by default, not as an afterthought.
- You're building a Rust application and want the best developer experience for event-driven architecture.
π Production Ready
- Dogfooded β We use
event_basein my next project. It won't be abandoned. - Auditable β Every line is human-written, reviewable, and explainable. No vibe coding.
- Long-term maintenance β This is not a side project. We depend on it too.
π Documentation
π§© Templates
Get started in seconds with cargo generate:
# Core template
# GUI template (Slint + event_base)
π€ Contributing
We welcome contributions! Please see CONTRIBUTING.md for details.
π License
See the LICENSE file for details.
Built with β€οΈ by RedElectricity.