Skip to main content

ironflow_runtime/
lib.rs

1//! # ironflow-runtime
2//!
3//! The daemon/server layer for **ironflow**, providing webhook HTTP endpoints
4//! and trigger sources 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), then start a full
8//! [Axum](https://docs.rs/axum) HTTP server via [`runtime::Runtime::serve`] with
9//! graceful shutdown support.
10//!
11//! # Quick start
12//!
13//! ```no_run
14//! use ironflow_runtime::prelude::*;
15//!
16//! #[tokio::main]
17//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
18//!     Runtime::new()
19//!         .webhook("/hooks/github", WebhookAuth::github("my-secret"), |payload| async move {
20//!             println!("received: {payload}");
21//!         })
22//!         .serve("0.0.0.0:3000")
23//!         .await?;
24//!
25//!     Ok(())
26//! }
27//! ```
28//!
29//! # Modules
30//!
31//! - [`runtime`] - The [`runtime::Runtime`] builder and HTTP server.
32//! - [`webhook`] - Webhook authentication strategies ([`webhook::WebhookAuth`]).
33//! - [`trigger`] - Pluggable trigger sources (`EventTrigger`,
34//!   `NatsTrigger` behind `trigger-nats` feature).
35
36pub mod error;
37pub mod runtime;
38pub mod trigger;
39pub mod webhook;
40
41/// Convenience re-exports for common usage.
42///
43/// # Contents
44///
45/// - [`Runtime`](crate::runtime::Runtime) - The server builder.
46/// - [`WebhookAuth`](crate::webhook::WebhookAuth) - Webhook authentication configuration.
47pub mod prelude {
48    pub use crate::error::RuntimeError;
49    pub use crate::runtime::{Runtime, WebhookContext};
50    pub use crate::trigger::{Trigger, TriggerEvent, TriggerSink};
51    pub use crate::webhook::WebhookAuth;
52}