apalis_rtui/lib.rs
1//! A drop-in replacement for `apalis-board`: HTTP surface, live updates, and the
2//! `apalis-tui` dashboard.
3//!
4//! This crate mounts a JSON API for `apalis` job queues on an axum or actix-web server, streams
5//! live task and log events over SSE, and serves a `ratatui` dashboard compiled to WebAssembly
6//! from the bundle it carries. The wire contract matches `apalis-board-api` 1.0.0-rc.8 route for
7//! route, and the extra routes on top of it (capabilities, actions, typed status events) are
8//! additive. Repository and full documentation:
9//! <https://github.com/ngriaznov/apalis-rtui>.
10//!
11//! Swap one line in `Cargo.toml`:
12//!
13//! ```toml
14//! apalis-board = { package = "apalis-rtui", version = "0.1.0-rc.1", features = ["axum"] }
15//! ```
16//!
17//! and every path a consumer already writes against `apalis-board` keeps working:
18//! `apalis_board::axum::framework::{ApiBuilder, RegisterRoute}`,
19//! `apalis_board::axum::sse::{TracingBroadcaster, TracingSubscriber}`,
20//! `apalis_board::axum::ui::ServeUI`, `apalis_board::axum::push_task`, and the rest of the
21//! framework-agnostic handler set. `apalis-rtui` mirrors that exact module shape under its own
22//! name: [`axum`] and [`actix`] are each the whole ported API surface, re-exported under a
23//! per-framework namespace, gated by the matching Cargo feature.
24//!
25//! See the crate README for the full drop-in story and feature table.
26
27#![forbid(unsafe_code)]
28#![warn(missing_docs)]
29#![warn(unreachable_pub)]
30#![warn(missing_debug_implementations)]
31
32// The ported `apalis-board-api` surface. Kept private: it is reachable only through the
33// per-framework `axum`/`actix` re-exports below, exactly as upstream's `apalis-board-api` is
34// reachable only once a consumer opts into `apalis-board`'s `axum`/`actix` feature.
35#[cfg(any(feature = "axum", feature = "actix"))]
36mod api;
37
38/// The axum HTTP surface: `ApiBuilder`, `RegisterRoute`, the framework-agnostic handler set,
39/// live-update SSE types (`events` feature), and `ServeUI` (`ui` feature).
40///
41/// This module is the whole ported API surface re-exported under the `axum` namespace, mirroring
42/// how `apalis_board::axum` is `pub use apalis_board_api::*` behind upstream's own `axum`
43/// feature. A consumer migrating from `apalis-board` writes the identical path:
44/// `apalis_rtui::axum::framework::{ApiBuilder, RegisterRoute}`.
45#[cfg(all(feature = "axum", not(target_arch = "wasm32")))]
46pub mod axum {
47 pub use crate::api::*;
48}
49
50/// The actix-web HTTP surface: `ApiBuilder`, `RegisterRoute`, the framework-agnostic handler
51/// set, live-update SSE types (`events` feature), and `ServeUI` (`ui` feature).
52///
53/// This module is the whole ported API surface re-exported under the `actix` namespace,
54/// mirroring `apalis_board::actix`'s identical role behind upstream's own `actix` feature.
55#[cfg(all(feature = "actix", not(target_arch = "wasm32")))]
56pub mod actix {
57 pub use crate::api::*;
58}