ironflow_runtime/lib.rs
1//! # ironflow-runtime
2//!
3//! The daemon/server layer for **ironflow**, providing webhook HTTP endpoints and
4//! cron scheduling on top of [`ironflow_core`] operations.
5//!
6//! This crate exposes a [`runtime::Runtime`] builder that lets you declaratively register
7//! webhook routes (with pluggable authentication) and cron jobs, then either start a
8//! full [Axum](https://docs.rs/axum) HTTP server via [`runtime::Runtime::serve`] or run
9//! only the cron scheduler via [`runtime::Runtime::run_crons`], both with graceful
10//! shutdown support.
11//!
12//! # Quick start
13//!
14//! ```no_run
15//! use ironflow_runtime::prelude::*;
16//!
17//! #[tokio::main]
18//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
19//! Runtime::new()
20//! .webhook("/hooks/github", WebhookAuth::github("my-secret"), |payload| async move {
21//! println!("received: {payload}");
22//! })
23//! .cron("0 */5 * * * *", "health-check", || async {
24//! println!("running health check");
25//! })
26//! .serve("0.0.0.0:3000")
27//! .await?;
28//!
29//! Ok(())
30//! }
31//! ```
32//!
33//! # Modules
34//!
35//! - [`runtime`] - The [`runtime::Runtime`] builder and HTTP server.
36//! - [`webhook`] - Webhook authentication strategies ([`webhook::WebhookAuth`]).
37//! - `cron` - Internal cron job representation (crate-private).
38
39pub(crate) mod cron;
40pub mod error;
41pub mod runtime;
42pub mod webhook;
43
44/// Convenience re-exports for common usage.
45///
46/// # Contents
47///
48/// - [`Runtime`](crate::runtime::Runtime) - The server builder.
49/// - [`WebhookAuth`](crate::webhook::WebhookAuth) - Webhook authentication configuration.
50pub mod prelude {
51 pub use crate::error::RuntimeError;
52 pub use crate::runtime::Runtime;
53 pub use crate::webhook::WebhookAuth;
54}