# bare-config
**The type-safe configuration authority for Rust.**
A pluggable framework that evolves beyond static loading to provide full CRUD operations across multiple backends, enforcing "Parse, don't validate" for the entire configuration lifecycle.
## Overview
`bare-config` is not just another configuration loader. It is a **Configuration Authority** that:
- **Validates at boundaries** - Configuration is parsed and validated once at system entry points
- **Enforces type safety** - Strongly typed configuration values prevent invalid states
- **Supports full CRUD** - Read, create, update, and delete operations across multiple backends
- **Pluggable backends** - File system, environment variables, remote services, and custom backends
- **Zero runtime overhead** - After validation, configuration access is cost-free
## Philosophy
### Parse, Don't Validate
Traditional configuration libraries mix parsing and validation throughout the codebase. `bare-config` separates these concerns:
1. **Parse** - Convert raw configuration data (TOML, YAML, JSON, etc.) into typed values
2. **Validate** - Ensure values meet constraints at system boundaries
3. **Trust** - Use validated values without re-checking within the system
This eliminates primitive obsession and ensures data integrity where it matters most.
## Quick Start
```rust
use bare_config::{Config, ConfigBuilder};
#[derive(Debug, Clone)]
struct AppConfig {
host: String,
port: u16,
max_connections: usize,
}
fn main() -> Result<(), Box<dyn std::error::Error>> {
let config: AppConfig = ConfigBuilder::new()
.load_file("config.toml")?
.load_env()?
.build()?;
println!("Server running on {}:{}", config.host, config.port);
Ok(())
}
```
## Features
- **Type-safe configuration** - Strongly typed values with compile-time guarantees
- **Multiple backends** - File system, environment variables, and extensible backend system
- **CRUD operations** - Full lifecycle management of configuration values
- **Hot reloading** - Optional runtime configuration updates
- **Validation** - Schema-based validation with detailed error messages
- **Zero dependencies** - Core functionality has no external dependencies
## Roadmap
- [ ] Core configuration framework
- [ ] File system backends (TOML, YAML, JSON, INI)
- [ ] Environment variable backend
- [ ] Validation schema system
- [ ] CRUD operations
- [ ] Hot reloading
- [ ] Remote configuration backends
- [ ] Configuration migration tools
## License
Licensed under either of:
- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE))
- MIT License ([LICENSE-MIT](LICENSE-MIT))
## Contributing
Contributions are welcome! Please open an issue or submit a PR.
## Related Crates
- [bare-types](https://crates.io/crates/bare-types) - Zero-cost foundation for type-safe domain modeling