Skip to main content

riverbase_core

riverbase_coreCore · v0.2.0

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​

ModuleStart here forPage
domainDomain, DomainRuntime, DomainStoreSpec, invokersDomains
commandCommandEngine, CommandMeta, CommandTarget, MessageBus, CommandPolicyCommands
command::aggregateAggregate, AggregateCore, #[domain_action] sessionsAggregates
queryQueryResource, QueryEngine, FrontendQuery, reportsQueries
datastoreDataStore, PgDataStore, DataQuery, entity macros, migrationsDatastore
logstoreDomainLogStore, audit channels, outbox, retentionAudit log
transportNATS, Redis, Postgres buses; StreamBus; dispatch actorsTransport
configRiverbaseConfig, sections, env overlay, remote fetchConfig
baseEngineContext, RiverbaseError, IDs, FqName, tenant policyErrors
applog, otelinit_logging, LogFormat, OpenTelemetry hooksObservability

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​

MacroGenerates
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.