panza 0.1.1

The squire for your CLI — clap serve, bind, health, static.
Documentation

panza

Crates.io docs.rs Build Rust

All this time Sancho remained upon the hill, beholding, with amazement, the madness of his master, tearing his beard, and cursing the hour and minute on which it was his fate to know him.

The squire for your CLI — clap serve, bind, health, static.

In active development — expect breaking changes.

What it owns

Piece Behavior
ServeArgs clap: --host (default 127.0.0.1), --port / -p (default 8787), --open
ServeMeta service + version for health JSON
run tokio + axum: bind, Ctrl-C shutdown, log listen URL
GET /health { "ok", "service", "version", "uptime_secs" }
Access log info: METHOD path[?query] -> status on the full router
StaticMount None / Dir / Embedded with SPA index.html fallback
Router merge host supplies an axum::Router; panza merges it

What it does not own

  • Domain routes / DB access
  • Frontend framework or shared UI
  • Auth (warns if bind ≠ loopback)

Usage

use clap::Parser;
use panza::{ServeArgs, ServeMeta, StaticMount, run};

#[derive(Parser)]
struct ServeCli {
    #[command(flatten)]
    serve: ServeArgs,
}

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let cli = ServeCli::parse();
    let api = axum::Router::new(); // host routes here
    run(
        ServeMeta {
            service: "my-tool",
            version: env!("CARGO_PKG_VERSION"),
        },
        cli.serve,
        api,
        StaticMount::None, // or Dir(ui_dist) / Embedded(...)
    )
    .await
}

For tests or custom bind loops, use serve_router instead of run.

License

MIT OR Apache-2.0