Skip to main content

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 start an
8//! [Axum](https://docs.rs/axum) HTTP server with graceful shutdown support.
9//!
10//! # Quick start
11//!
12//! ```no_run
13//! use ironflow_runtime::prelude::*;
14//!
15//! #[tokio::main]
16//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
17//!     Runtime::new()
18//!         .webhook("/hooks/github", WebhookAuth::github("my-secret"), |payload| async move {
19//!             println!("received: {payload}");
20//!         })
21//!         .cron("0 */5 * * * *", "health-check", || async {
22//!             println!("running health check");
23//!         })
24//!         .serve("0.0.0.0:3000")
25//!         .await?;
26//!
27//!     Ok(())
28//! }
29//! ```
30//!
31//! # Modules
32//!
33//! - [`runtime`] - The [`runtime::Runtime`] builder and HTTP server.
34//! - [`webhook`] - Webhook authentication strategies ([`webhook::WebhookAuth`]).
35//! - `cron` - Internal cron job representation (crate-private).
36
37pub(crate) mod cron;
38pub mod error;
39pub mod runtime;
40pub mod webhook;
41
42/// Convenience re-exports for common usage.
43///
44/// # Contents
45///
46/// - [`Runtime`](crate::runtime::Runtime) - The server builder.
47/// - [`WebhookAuth`](crate::webhook::WebhookAuth) - Webhook authentication configuration.
48pub mod prelude {
49    pub use crate::error::RuntimeError;
50    pub use crate::runtime::Runtime;
51    pub use crate::webhook::WebhookAuth;
52}