"(static)-hub" — Your static and config hub, simplified
Note: This project is under active development and not yet production-ready. For detailed documentation, see the
docs/folder or visit the documentation site.
sthub is a lightweight, flexible static file server with built-in support for dynamic configuration via environment variables. It is ideal for serving static web applications (such as SPAs) and exposing runtime configuration at a dedicated endpoint.
- Serve static files from a configurable directory and URL prefix.
- Expose environment variables as a structured JSON tree at a configurable endpoint (default
/env). - Apache-style rewrite rules for advanced static file routing (e.g., SPA fallback).
- Custom response headers for static file responses.
- Configurable via YAML (
conf.yaml), including network, static, and configuration hubs. - CLI support for specifying the configuration file path.
-
Configure your server in
conf.yaml(seedocs/configuration.mdfor details). -
Run the server:
cargo run --release -- --configuration-path conf.yaml
Or use the built binary.
-
Access your static files at the configured
remote_path(e.g.,/public). -
Fetch environment/configuration variables:
curl http://localhost:8080/env
- Network: Set
hostandport. - Static hub:
remote_path: URL prefix for static files (e.g.,/public)path: Directory to serverewrite_rules: Apache-style rules for routing (optional)headers: Custom response headers (optional)
- Configuration hub:
remote_path: URL for environment/config endpoint (default/env)providers.env.prefix: Prefix for environment variables (must end with__)
See docs/configuration.md for full details and examples.
- Use double underscores (
__) for nesting (e.g.,STHUB__DATABASE__HOST). - Arrays and objects are supported.
- See
docs/environment_variable_notation.mdfor more.