Expand description
§acton-service
Production-ready Rust microservice framework with dual-protocol support (HTTP + gRPC).
§Features
- Dual-protocol: HTTP (axum) + gRPC (tonic) on single port
- Middleware stack: JWT auth, rate limiting, request tracking, panic recovery, body size limits
- Resilience: Circuit breaker, retry with backoff, bulkhead (concurrency limiting)
- Observability: OpenTelemetry tracing, HTTP metrics, request ID propagation
- Connection pooling: Database (YSQL), Redis, NATS JetStream
- Health checks: Liveness and readiness probes
- Graceful shutdown: Proper signal handling (SIGTERM, SIGINT)
§Example
use acton_service::prelude::*;
#[tokio::main]
async fn main() -> Result<()> {
// Load configuration
let config = Config::load()?;
// Initialize tracing
init_tracing(&config)?;
// Build application state
let state = AppState::builder()
.config(config.clone())
.build()
.await?;
// Create router
let app = Router::new()
.route("/health", get(health))
.route("/ready", get(readiness))
.with_state(state);
// Run server
Server::new(config)
.serve(app)
.await?;
Ok(())
}Modules§
- build_
utils - Build-time utilities for compiling protocol buffers
- config
- Configuration management using Figment
- error
- Error types and HTTP response conversion
- health
- Health check handlers
- middleware
- Middleware modules for authentication, rate limiting, and more
- observability
- OpenTelemetry tracing and observability
- pool_
health - Connection pool health monitoring
- prelude
- Prelude module for convenient imports
- responses
- HTTP response builders with correct status codes
- server
- HTTP server with graceful shutdown
- service_
builder - Type-safe service builder that enforces API versioning and best practices
- state
- Application state management
- versioning
- API versioning utilities for managing API evolution