| Crates.io | rust_bus |
| lib.rs | rust_bus |
| version | 1.2.0 |
| created_at | 2025-07-08 12:26:05.494659+00 |
| updated_at | 2025-07-25 15:26:08.941853+00 |
| description | bus β Lightweight CQRS Library for Rust |
| homepage | |
| repository | https://github.com/bordunosp/bus |
| max_upload_size | |
| id | 1742592 |
| size | 297,218 |
bus is a modular, async-first CQRS library for Rust that helps you structure your application around clear boundaries:
Commands, Queries, and
Events. It supports both in-memory and database-backed event processing, middleware pipelines, and graceful shutdown β all with minimal boilerplate.
bus introduces a clean, extensible architecture for:in-memory or persisted)CQRS stands for Command Query Responsibility Segregation β a pattern that separates:
This separation improves clarity, testability, and scalability.
A command represents an intention to change state. It is handled by a single handler and returns a result.
π Read more β command.md
A query retrieves data without modifying state. It is also handled by a single handler.
π Read more β query.md
An event represents something that has already happened. It can be:
In-memory β handled immediately during bus::publish(...)
Database-backed β persisted and processed asynchronously by background workers
You can wrap handlers with composable pipelines for:
Supported for:
Add bus to your Cargo.toml:
[dependencies]
bus = { package = "rust_bus", version = "" }
ctor = "0.4" # Required for automatic handler & pipeline registration
Why ctor?
bus uses the ctor crate to automatically register handlers and pipelines at startup. Without it, nothing will be
wired up.
If you're using database-backed events with SeaORM, you must apply the required database migrations before running workers.
All required migrations are located in the root of the repository under the migration/ directory:
/migration
βββ 2023_..._create_bus_events_table.sql
βββ 2023_..._create_bus_events_archive.sql
βββ ...
You can apply them using your preferred migration tool (e.g. SeaORM CLI, refinery, sqlx-cli, or manually via psql/MySQL client).
| Topic | File |
|---|---|
| π§ CQRS Overview | this file |
| π¨ Commands | command.md |
| π Queries | query.md |
| π£ Events (in-memory) | event.md |
| ποΈ Events (database-backed) | event_database_sea_orm.md |
| π§© Event Pipelines (in-memory) | event_pipeline.md |
| π§© Event Pipelines (database) | event_database_pipeline.md |
| π§© Request Pipelines | request_pipeline.md |
| π Migrations | bus app folder migration |
This project aims to show support for Ukraine and its people amidst a war that has been ongoing since 2014. This war has a genocidal nature and has led to the deaths of thousands, injuries to millions, and significant property damage. We believe that the international community should focus on supporting Ukraine and ensuring security and freedom for its people.
Join us and show your support using the hashtag #StandForUkraine. Together, we can help bring attention to the issues faced by Ukraine and provide aid.