Skip to main content

Crate ch_rds

Crate ch_rds 

Source
Expand description

§ch-rds

ch-rds resolves runtime resources and starts conventional local services when an application uses loopback endpoints.

More information is available in the API documentation.

§High-level features

  • Typed loaders for web listeners, MariaDB, and SpacetimeDB
  • Explicit production behavior with no local fallback
  • Conventional .env, .env.local, and services.env discovery
  • Protocol-verified local Docker Compose startup for loopback resources
  • Optional frontend/backend development process orchestration

§Usage

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let runtime = ch_rds::Runtime::bootstrap()?;
    let bind_addr = runtime
        .load(ch_rds::WebBind::builder().addr("127.0.0.1:8080"))
        .await?;

    println!("{bind_addr}");
    Ok(())
}

Runtime resolves configured remote endpoints directly. Production mode rejects local fallbacks. ENV_FILE selects one explicit dotenv file, while PORT overrides only the port of the fallback listener address.

Conventional layouts auto-discover MariaDB and crates/database/spacetimedb; builders cover custom stacks. Protocol-level readiness permits one locked service restart, while SpacetimeDB updates publish in place to preserve data and identity.

§Development runner

The dev feature provides ProjectProfile and run_project. Vite owns frontend hot-module replacement; Watchexec restarts the backend when Rust sources, manifests, lockfiles, Cargo configuration, or SQL migrations change.

cargo install watchexec-cli --version 2.5.1 --locked

§Feature flags

FeatureProvides
devFrontend/backend process orchestration and project profiles
btcpayLocal BTCPay setup in addition to dev

§Minimum supported Rust version

ch-rds requires Rust 1.96 or newer.

§License

Licensed under the Sustainable Use License 1.0. See LICENSE.md.

Modules§

cronjob
Background-job scheduling and execution primitives.
dev
Development commands for building and running an application workspace.

Structs§

LocalStack
Settings for the bundled local Docker Compose stack.
MariaDB
Configures how a MariaDB resource should be resolved for the runtime.
MariaDbResource
Intermediate configuration derived from MariaDB used during loading.
Project
Filesystem layout discovered for the running application.
Runtime
Runtime facade used by app entrypoints to load shared resources before handing control to the app server future.
SpacetimeDB
Configures how a SpacetimeDB endpoint should be resolved for the runtime.
SpacetimeDbConnection
Resolved SpacetimeDB endpoint plus the private module-owner token when the shared runtime manages a local development module.
SpacetimeDbResource
Intermediate configuration derived from SpacetimeDB used during loading.
WebBind
Configures the app web listener address for the runtime.
WebBindResource
Intermediate configuration derived from WebBind used during loading.

Enums§

RuntimeEnvironment
Describes the execution environment used to resolve resources.