nido-svc-common 0.1.0-alpha.1

Shared health, error, OpenAPI, SSE, and middleware primitives for nido-*-svc crates
Documentation

nido-svc-common

Crates.io docs.rs

Shared HTTP-service primitives for the nido-*-svc family: health probes, an RFC 7807 error type, OpenAPI spec building, server-sent-event helpers, and a composable middleware stack.

Install

[dependencies]
nido-svc-common = "0.1"

What's inside

  • health::health_router(name, version) — a ready-to-merge GET /health axum router.
  • error::NidoSvcError — a thiserror enum implementing axum IntoResponse as RFC 7807 problem JSON (NotFound, InvalidArgument, Unauthorized, Internal).
  • openapi::OpenApiSpec — a small builder that emits an OpenAPI document and a GET handler for it.
  • sse::sse_with_keepalive(...) — server-sent-event streams with keep-alive.
  • middleware — a composable tower-http stack (compression, trace, request-id, CORS, timeout, sensitive-headers).

Usage

use axum::Router;
use nido_svc_common::health::health_router;

let app: Router = Router::new()
    .merge(health_router("my-svc", env!("CARGO_PKG_VERSION")));

Why a separate crate?

Every nido-*-svc microservice needs the same health / error / OpenAPI / SSE scaffolding. Extracting it here keeps each service crate thin and prevents the scaffolding from drifting between services.

License

Dual-licensed under MIT or Apache 2.0 at your choice. Inherited from the workspace root.

Related crates in the nido ecosystem

See securanido.com for the broader project.