durable-streams-server
durable-streams-server is a Rust implementation of the
Durable Streams protocol,
built with axum and tokio.
It can be run as a standalone HTTP server or embedded into an existing axum
application with build_router or build_router_with_ready.
Features
- Durable Streams HTTP API with create, append, read, head, close, and delete operations
- Live reads via long-polling and Server-Sent Events (SSE)
- In-memory, file-backed, and ACID (
redb) storage backends - Layered configuration from TOML files and
DS_*environment variables - Structured
application/problem+jsonerror responses - Request telemetry via
tracingwith OpenTelemetry/ECS-friendly field names
Running
From the workspace root:
By default the server listens on http://localhost:4437, exposes health checks
at /healthz and /readyz, and mounts the protocol at /v1/stream.
Use http.stream_base_path or DS_HTTP__STREAM_BASE_PATH to mount the
protocol at another path.
Storage Backends
The default storage mode is in-memory. For persistence, choose a backend via
DS_STORAGE__MODE:
| Mode | Durability | Use case |
|---|---|---|
memory |
None (lost on restart) | Development and testing |
file-fast |
Buffered writes | Lower-latency persistence where recent data loss is acceptable |
file-durable |
Fsynced writes | Durable persistence without external dependencies |
acid |
Crash-resilient (redb) |
Production workloads requiring transactional durability |
Examples:
DS_STORAGE__MODE=file-durable DS_STORAGE__DATA_DIR=./data
DS_STORAGE__MODE=acid DS_STORAGE__DATA_DIR=./data
Configuration
Configuration is loaded in this order, with later sources overriding earlier ones:
- Built-in defaults
config/default.tomlconfig/<profile>.tomlconfig/local.toml--config <path>- Environment variables
Examples:
Common environment variables:
DS_SERVER__PORTDS_SERVER__LONG_POLL_TIMEOUT_SECSDS_SERVER__SSE_RECONNECT_INTERVAL_SECSDS_HTTP__CORS_ORIGINSDS_HTTP__STREAM_BASE_PATHDS_LIMITS__MAX_MEMORY_BYTESDS_LIMITS__MAX_STREAM_BYTESDS_STORAGE__MODEDS_STORAGE__DATA_DIRDS_STORAGE__ACID_SHARD_COUNTDS_STORAGE__ACID_BACKENDDS_TLS__CERT_PATHDS_TLS__KEY_PATHDS_LOG__RUST_LOGRUST_LOG
Library Use
For embedding, the main entry points are:
ConfigandConfigLoadOptionsfor configuration loadingbuild_routerandbuild_router_with_readyfor mounting the HTTP APIInMemoryStorage,FileStorage, andAcidStoragefor backend selection
Verification