sunbeam-g2v 0.1.1

Sunbeam Service Framework - A ConnectRPC-based framework for building microservices
Documentation
#![warn(missing_docs)]
//! # Sunbeam Service Framework
//!
//! A ConnectRPC-based framework for building microservices within the Sunbeam ecosystem.
//!
//! ## Overview
//!
//! This framework provides opinionated abstractions, common patterns, and boilerplate
//! reduction for building production-ready microservices using **connect-rust**.
//!
//! ## Key Features
//!
//! - **Service Trait**: Base trait for all Sunbeam services with lifecycle hooks
//! - **Configuration**: Figment-based configuration with environment variable support
//! - **Error Handling**: Unified error types with automatic ConnectError conversion
//! - **Router**: Enhanced router with Sunbeam conventions
//! - **Server**: Axum and standalone server abstractions
//! - **Middleware**: Auth, logging, metrics, tracing, rate limiting, etc.
//! - **Database**: SQLx integration with automatic migrations
//! - **Message Queue**: NATS/JetStream integration
//! - **Leader Election**: Vault/OpenBAO and NATS-based leader election
//! - **Client Utilities**: Factory, retry, circuit breaker patterns
//! - **Testing**: Test harness, mocks, fixtures, testcontainers integration
//! - **Automatic Instrumentation**: Proc-macro derive for metrics and tracing
//!
//! ## Quick Start
//!
//! See the `examples/` directory for complete working examples.
//!
//! ```rust,ignore
//! // Example usage (conceptual - see examples for real code)
//! use sunbeam_g2v::prelude::*;
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
//!     let config = ServiceConfig::load()?;
//!
//!     let router = ServiceRouter::new();
//!
//!     ServerBuilder::new()
//!         .with_router(router)
//!         .with_metrics()
//!         .with_tracing()
//!         .with_health_check("/health")
//!         .serve()
//!         .await
//! }
//! ```

#![allow(refining_impl_trait_internal, refining_impl_trait_reachable)]

pub mod config;
pub mod error;
pub mod health;
pub mod middleware;
pub mod metrics;
pub mod prelude;
pub mod router;
pub mod service;
pub mod testing;

pub use health::HealthRouter;

pub mod client;
pub mod db;
pub mod election;
pub mod mq;
pub mod server;

// Re-export connectrpc essentials for convenience
pub use connectrpc::{
    ConnectError, ConnectRpcBody, ConnectRpcService, Context, ErrorCode, Protocol,
    Router, Server,
};

// Re-export buffa essentials
pub use buffa::view::{MessageView, OwnedView};

/// Boxed error type for middleware
pub type BoxError = Box<dyn std::error::Error + Send + Sync>;

/// Boxed future type
pub type BoxFuture<T> = std::pin::Pin<Box<dyn std::future::Future<Output = T> + Send>>;

/// Result type using BoxError
pub type BoxResult<T> = Result<T, BoxError>;

#[cfg(test)]
mod tests {
    #[test]
    fn test_lib_compiles() {
        // This test just verifies the library compiles
        // Real tests are in the tests/ directory
    }
}