| Crates.io | eventdbx-client |
| lib.rs | eventdbx-client |
| version | 1.2.1 |
| created_at | 2025-11-11 06:55:47.044407+00 |
| updated_at | 2025-11-27 11:45:21.892946+00 |
| description | Async Rust client and CLI for EventDBX |
| homepage | https://eventdbx.com |
| repository | https://github.com/eventdbx/eventdbx-client |
| max_upload_size | |
| id | 1926791 |
| size | 162,236 |
Async Rust client for EventDBX. The library wraps the Cap'n Proto wire protocol exposed by EventDBX so applications can programmatically list aggregates and events, append or patch data, select subsets of fields, toggle archive status, and verify Merkle roots.
with_noise(false) to request plaintext for tests.ClientConfig so multiple clients can share the same runtime settings.proto/control.capnp; the build script compiles it
automatically, so no manual capnp compile invocation is needed.cargo build
Running cargo check is usually faster for edit/compile cycles:
cargo check
use eventdbx_client::{
AppendEventRequest, ClientConfig, EventDbxClient, ListAggregatesOptions, PatchEventRequest,
PublishTarget,
};
use serde_json::json;
#[tokio::main]
async fn main() -> eventdbx_client::Result<()> {
let config = ClientConfig::new("127.0.0.1", "<token>")
.with_tenant("tenant-123") // custom tenant
.with_port(7000); // custom port, 6363; call `.with_noise(false)` to request plaintext
let client = EventDbxClient::connect(config).await?;
// list aggregates
let aggregates = client
.list_aggregates(ListAggregatesOptions::default())
.await?;
println!("Aggregates: {}", aggregates.aggregates);
// append a new event
let append = AppendEventRequest::new(
"person",
"p-110",
"person_status_updated",
json!({ "status": "active" }),
);
append
.publish_targets
.push(PublishTarget::new("search-indexer").with_mode("event-only"));
client.append_event(append).await?;
// patch an existing event with JSON Patch semantics
let patch = PatchEventRequest::new(
"person",
"p-110",
"person_status_updated",
json!([{ "op": "replace", "path": "/status", "value": "inactive" }]),
);
client.patch_event(patch).await?;
Ok(())
}
See src/main.rs for dbxtest-cli, a small binary that can exercise individual API calls.
Configure it via environment variables (or pass --host/--port/--token/--tenant):
EVENTDBX_HOST (required)EVENTDBX_PORT (optional, defaults to 6363)EVENTDBX_TOKEN (required)EVENTDBX_TENANT (optional, defaults to "default")Available commands mirror the client surface area: list, select, get, events, append,
patch, create, archive, and verify. Any argument you omit is filled with synthetic data
generated via the fake crate, which makes it easy to sanity-check serialization. Examples:
cargo run list --take 5
cargo run append --aggregate-type person --aggregate-id p-1 \
--event-type person_created --payload '{"status":"active"}'
cargo run verify --aggregate-type person --aggregate-id p-1
proto/control.capnp.cargo build (or cargo check). The build script scans proto/ and regenerates
control_capnp.rs inside OUT_DIR.cargo test
No integration tests are checked in yet, but the command validates the build and runs any
future unit tests. Combine with cargo fmt --check in CI to ensure formatting.
cargo fmt & cargo clippy --all-targets before submitting patches.proto/control.capnp and the corresponding
client/type definitions.