Skip to content

Configuration Reference

This page documents all configuration options available in hyperstack-server.

The server is configured using a fluent builder pattern:

use hyperstack_server::Server;
Server::builder()
.spec(my_spec()) // Required: your stack specification
.websocket() // Enable WebSocket server
.bind("[::]:8877".parse()?)
.yellowstone(config) // Optional: manual Yellowstone config
.health_monitoring() // Enable health monitoring
.http_health() // Enable HTTP health endpoints
.reconnection() // Enable auto-reconnection
.start()
.await?;

These environment variables are read automatically by the generated parser code:

VariableRequiredDefaultDescription
YELLOWSTONE_ENDPOINTYesYellowstone gRPC endpoint URL
YELLOWSTONE_X_TOKENUsuallyAuthentication token for the endpoint
RUST_LOGNoinfoLog level filter (e.g., debug, info,hyperstack_server=debug)
// Enable with defaults (binds to [::]:8877)
Server::builder()
.websocket()
.start()
.await?;
// Or specify a custom bind address
Server::builder()
.websocket()
.bind("[::]:9000".parse()?)
.start()
.await?;

For full control, use websocket_config():

use hyperstack_server::WebSocketConfig;
let ws_config = WebSocketConfig {
bind_address: "[::]:8877".parse()?,
};
Server::builder()
.websocket_config(ws_config)
.start()
.await?;
FieldTypeDefaultDescription
bind_addressSocketAddr[::]:8877Address and port for the WebSocket server

The Yellowstone gRPC connection is typically configured via environment variables. However, you can also configure it programmatically:

use hyperstack_server::YellowstoneConfig;
let yellowstone = YellowstoneConfig::new("https://your-endpoint.com")
.with_token("your-secret-token");
Server::builder()
.yellowstone(yellowstone)
.start()
.await?;
FieldTypeDefaultDescription
endpointStringYellowstone gRPC endpoint URL
x_tokenOption<String>NoneAuthentication token
MethodDescription
YellowstoneConfig::new(endpoint)Create with endpoint
.with_token(token)Set authentication token

Health monitoring tracks stream connectivity and detects issues like stale connections.

// Enable with defaults
Server::builder()
.health_monitoring()
.start()
.await?;
use hyperstack_server::HealthConfig;
use std::time::Duration;
let health = HealthConfig::new()
.with_heartbeat_interval(Duration::from_secs(30))
.with_health_check_timeout(Duration::from_secs(10));
Server::builder()
.health_config(health)
.start()
.await?;
FieldTypeDefaultDescription
heartbeat_intervalDuration30sHow often to check stream health
health_check_timeoutDuration10sTimeout for health check operations
MethodDescription
HealthConfig::new()Create with defaults
.with_heartbeat_interval(duration)Set heartbeat interval
.with_health_check_timeout(duration)Set health check timeout

Exposes HTTP endpoints for orchestrators like Kubernetes to perform health checks.

// Enable with defaults (binds to [::]:8081)
Server::builder()
.http_health()
.start()
.await?;
// Or specify a custom bind address
Server::builder()
.http_health()
.health_bind("0.0.0.0:8081".parse()?)
.start()
.await?;
use hyperstack_server::HttpHealthConfig;
let http_health = HttpHealthConfig::new("0.0.0.0:9090".parse()?);
Server::builder()
.http_health_config(http_health)
.start()
.await?;
FieldTypeDefaultDescription
bind_addressSocketAddr[::]:8081Address and port for the HTTP health server
EndpointMethodDescription
/health or /healthzGETLiveness check — returns 200 OK if server is running
/ready or /readinessGETReadiness check — returns 200 OK if stream is healthy, 503 otherwise
/statusGETDetailed JSON status with health state and error count
{
"healthy": true,
"status": "Connected",
"error_count": 0
}

Controls automatic reconnection behavior when the Yellowstone gRPC connection drops.

// Enable with defaults
Server::builder()
.reconnection()
.start()
.await?;
use hyperstack_server::ReconnectionConfig;
use std::time::Duration;
let reconnect = ReconnectionConfig::new()
.with_initial_delay(Duration::from_millis(100))
.with_max_delay(Duration::from_secs(60))
.with_max_attempts(10)
.with_backoff_multiplier(2.0)
.with_http2_keep_alive_interval(Duration::from_secs(30));
Server::builder()
.reconnection_config(reconnect)
.start()
.await?;
FieldTypeDefaultDescription
initial_delayDuration100msDelay before first reconnection attempt
max_delayDuration60sMaximum delay between attempts (caps exponential backoff)
max_attemptsOption<u32>None (infinite)Maximum reconnection attempts before giving up
backoff_multiplierf642.0Multiplier for exponential backoff
http2_keep_alive_intervalOption<Duration>30sHTTP/2 keep-alive to prevent silent disconnects
MethodDescription
ReconnectionConfig::new()Create with defaults
.with_initial_delay(duration)Set initial reconnection delay
.with_max_delay(duration)Set maximum backoff delay
.with_max_attempts(n)Limit reconnection attempts
.with_backoff_multiplier(m)Set exponential backoff multiplier
.with_http2_keep_alive_interval(duration)Set HTTP/2 keep-alive interval

Enable optional features in your Cargo.toml:

[dependencies]
hyperstack-server = { version = "0.5.3", features = ["otel"] }
FeatureDefaultDescription
otelNoOpenTelemetry integration for metrics and distributed tracing

When the otel feature is enabled:

use hyperstack_server::Metrics;
let metrics = Metrics::new();
Server::builder()
.metrics(metrics)
.start()
.await?;

Here’s a production-ready configuration combining all options:

use hyperstack_server::{
Server, HealthConfig, HttpHealthConfig, ReconnectionConfig
};
use std::time::Duration;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
// TLS provider for gRPC
rustls::crypto::ring::default_provider()
.install_default()
.expect("Failed to install rustls crypto provider");
// Load environment variables
dotenvy::dotenv().ok();
// Initialize logging
tracing_subscriber::fmt()
.with_env_filter(
tracing_subscriber::EnvFilter::try_from_default_env()
.unwrap_or_else(|_| "info,hyperstack_server=debug".into()),
)
.init();
let spec = my_stack::spec();
Server::builder()
.spec(spec)
// WebSocket on port 8877
.websocket()
.bind("[::]:8877".parse()?)
// Health monitoring with custom intervals
.health_config(
HealthConfig::new()
.with_heartbeat_interval(Duration::from_secs(15))
)
// HTTP health endpoints on port 8081
.http_health()
.health_bind("0.0.0.0:8081".parse()?)
// Reconnection with limited attempts
.reconnection_config(
ReconnectionConfig::new()
.with_max_attempts(100)
.with_max_delay(Duration::from_secs(30))
)
.start()
.await?;
Ok(())
}