tier is a Rust configuration library for typed, layered application config.
It is built for projects that want one serde config type fed by code
defaults, TOML files, environment variables, and CLI overrides.
By default, tier only enables TOML support. derive, clap, schema,
watch, json, and yaml stay opt-in.
- Loads config from defaults, files, env, and CLI in a predictable order
- Deserializes directly into typed Rust structs
- Treats env and
--setinputs as strings first, with primitive coercion at deserialize time - Tracks where each value came from and surfaces validation and warning output
- Optionally adds derive metadata, schema/docs export, and runtime reload
use serde::{Deserialize, Serialize};
use tier::ConfigLoader;
#[derive(Debug, Clone, Serialize, Deserialize)]
struct AppConfig {
port: u16,
}
impl Default for AppConfig {
fn default() -> Self {
Self { port: 3000 }
}
}
let loaded = ConfigLoader::new(AppConfig::default())
.file("config/app.toml")
.load()?;
assert_eq!(loaded.config().port, 3000);
# Ok::<(), tier::ConfigError>(())toml: TOML file parsing and commented TOML examplesderive:#[derive(TierConfig)]metadata generationclap: reusable config flags and diagnostics commandsschema: JSON Schema, env docs, and machine-readable reportswatch: native filesystem watcher backendjson: JSON file parsingyaml: YAML file parsing
- Crate documentation:
crates/tier/README.md - Examples:
crates/tier/examples - API docs: https://docs.rs/tier
Current scope stays focused on typed layered loading, metadata, diagnostics, validation, schema/docs output, and reload support.
Out of scope for the current crate line:
- remote configuration backends
- full application-specific CLI generation from derive metadata