riverbase_core
riverbase_core
Command and query engines, domains, Postgres datastore, audit log, message bus, configuration.
cargo add riverbase_core --git https://github.com/riverbase-io/riverbase- kerneldefault
- postgres
- http
- nats-io
- redis
- yaml
- otel
- cfgfetch
- cfgfetch-https
- cfgfetch-git
- cfgfetch-s3
- cfgfetch-oci
- cfgfetch-all
riverbase_core is everything a domain needs to accept commands and serve queries, without an HTTP
stack. Services add riverbase_http on top; workers and CLIs can use the kernel
alone.
Modules
| Module | Start here for | Page |
|---|---|---|
domain | Domain, DomainRuntime, DomainStoreSpec, invokers | Domains |
command | CommandEngine, CommandMeta, CommandTarget, MessageBus, CommandPolicy | Commands |
command::aggregate | Aggregate, AggregateCore, #[domain_action] sessions | Aggregates |
query | QueryResource, QueryEngine, FrontendQuery, reports | Queries |
datastore | DataStore, PgDataStore, DataQuery, entity macros, migrations | Datastore |
logstore | DomainLogStore, audit channels, outbox, retention | Audit log |
transport | NATS, Redis, Postgres buses; StreamBus; dispatch actors | Transport |
config | RiverbaseConfig, sections, env overlay, remote fetch | Config |
base | EngineContext, RiverbaseError, IDs, FqName, tenant policy | Errors |
applog, otel | init_logging, LogFormat, OpenTelemetry hooks | Observability |
The prelude
use riverbase_core::prelude::*;
The prelude re-exports the types most domain code touches: contexts, results and error helpers, the aggregate traits, and the datastore traits. Prefer explicit paths in library code and the prelude in examples and tests.
Macros at a glance
| Macro | Generates |
|---|---|
domain! | A Domain implementation binding engines to a namespace |
command_engine! (alias command!) | Command payloads, handlers, the engine type, typed helpers |
query_resource! / report_resource! | Query and report resources: interface, binding, policy |
query_engine! | A query engine with registered resources and reports |
diesel_table_with_domain_fields! | A Diesel table! with the shared _id, _created, … columns |
domain_row! | A row struct with the shared domain fields prepended |
pg_domain_entity! / pg_readonly_entity! | Postgres entity glue for PgDataStore |
declare_errors! | A crate's error catalogue |
aggregate_core_deref! | Deref from your aggregate to AggregateCore |
Full syntax is in the Macros reference.