confers

Crates.ioconfers
lib.rsconfers
version0.2.2
created_at2025-12-27 11:28:02.161464+00
updated_at2026-01-25 08:08:56.448075+00
descriptionA modern, type-safe configuration management library with validation, diff, and hot-reload support
homepagehttps://github.com/Kirky-X/confers
repositoryhttps://github.com/Kirky-X/confers
max_upload_size
id2007068
size1,074,356
Kirky (Kirky-X)

documentation

https://docs.rs/confers

README

Confers Logo

CI Status Version Documentation Downloads License Rust 1.75+ Coverage

A modern, type-safe configuration management library for Rust

✨ Features β€’ πŸš€ Quick Start β€’ πŸ“š Documentation β€’ πŸ’» Examples β€’ 🀝 Contributing


🎯 Zero-Boilerplate Configuration Management

Confers provides a declarative approach to configuration management with:

✨ Type Safety πŸ”„ Auto Reload πŸ” AES-256 Encryption 🌐 Remote Sources
Compile-time checks Hot reload support Sensitive data protection etcd, Consul, HTTP
use confers::Config;
use serde::{Deserialize, Serialize};

#[derive(Debug, Clone, Serialize, Deserialize, Config)]
#[config(validate)]
pub struct AppConfig {
    pub name: String,
    pub port: u16,
    pub debug: bool,
}

// Configuration loads automatically from files, env vars, and CLI args
let config = AppConfig::load()?;

πŸ“‹ Table of Contents

πŸ“‘ Table of Contents (Click to expand)

✨ Features

🎯 Core Features ⚑ Optional Features
Always available Enable as needed

🎯 Core Features (Always Available)

Status Feature Description
βœ… Type-safe Configuration Auto-generate config structs via derive macros (derive feature)
βœ… Multi-format Support TOML, YAML, JSON, INI configuration files
βœ… Environment Variable Override Support environment variable overrides
βœ… CLI Argument Override Support command-line argument overrides (cli feature)

⚑ Optional Features

Status Feature Description
πŸ” Configuration Validation Built-in validator integration (validation feature)
πŸ“Š Schema Generation Auto-generate JSON Schema (schema feature)
πŸš€ File Watching & Hot Reload Real-time file monitoring (watch feature)
πŸ” Configuration Encryption AES-256 encrypted storage (encryption feature)
🌐 Remote Configuration etcd, Consul, HTTP support (remote feature)
πŸ“¦ Audit Logging Record access & change history (audit feature)
⚑ Parallel Validation Parallel validation for large configs (parallel feature)
πŸ“ˆ System Monitoring Memory usage monitoring (monitoring feature)
πŸ”§ Configuration Diff Compare configs with multiple output formats
🎨 Interactive Wizard Generate config templates via CLI
πŸ›‘οΈ Security Enhancements Nonce reuse detection, SSRF protection

πŸ“¦ Feature Presets

Preset Features Use Case
minimal derive Minimal config loading (no validation, no CLI)
recommended derive, validation Recommended for most applications
dev derive, validation, cli, schema, audit, monitoring, tracing Development with all tools
production derive, validation, watch, encryption, remote, monitoring, tracing Production-ready configuration
full All features Complete feature set

Note: The cli feature automatically includes derive, validation, and encryption dependencies.

🎨 Feature Architecture

graph LR
    A[<b>Configuration Sources</b><br/>πŸ“ Files β€’ 🌐 Env β€’ πŸ’» CLI] --> B[<b>ConfigLoader</b><br/>πŸ”§ Core Engine]
    B --> C[<b>Validation</b><br/>βœ… Type & Business Rules]
    B --> D[<b>Schema</b><br/>πŸ“„ JSON Schema Gen]
    B --> E[<b>Encryption</b><br/>πŸ” AES-256-GCM]
    B --> F[<b>Audit</b><br/>πŸ“‹ Access Logs]
    B --> G[<b>Monitoring</b><br/>πŸ“Š Memory Watch]
    C --> H[<b>Application Config</b><br/>πŸš€ Ready to Use]
    D --> H
    E --> H
    F --> H
    G --> H
    
    style A fill:#DBEAFE,stroke:#1E40AF,stroke-width:2px
    style B fill:#FEF3C7,stroke:#92400E,stroke-width:2px
    style H fill:#DCFCE7,stroke:#166534,stroke-width:2px

πŸš€ Quick Start

πŸ“¦ Installation

πŸ¦€ Rust Installation

Installation Type Configuration Use Case
Default confers = "0.2.2" Includes only derive (minimal config loading)
Minimal confers = { version = "0.2.2", default-features = false, features = ["minimal"] } Only config loading (same as default)
Recommended confers = { version = "0.2.2", default-features = false, features = ["recommended"] } Config + validation
CLI with Tools confers = { version = "0.2.2", features = ["cli"] } CLI with validation and encryption
Full confers = { version = "0.2.2", features = ["full"] } All features

Individual Features:

Feature Description Default
derive Derive macros for config structs βœ…
validation Config validation support ❌
cli Command-line interface tools ❌
watch File watching and hot reload ❌
audit Audit logging ❌
schema JSON Schema generation ❌
parallel Parallel validation ❌
monitoring System monitoring ❌
remote Remote config (etcd, consul, http) ❌
encryption Config encryption ❌

πŸ”§ CLI Command Feature Dependencies

Command Required Features Optional Features Description
generate cli (includes: derive, validation, encryption) schema Generate configuration templates
validate cli (includes: derive, validation, encryption) schema Validate configuration files
diff cli (includes: derive, validation, encryption) - Compare configuration files
encrypt cli (includes: derive, validation, encryption) - Encrypt configuration values
key cli (includes: derive, validation, encryption) - Manage encryption keys
wizard cli (includes: derive, validation, encryption) - Interactive configuration wizard
completions cli (includes: derive, validation, encryption) - Generate shell completions

Note: The cli feature automatically includes derive, validation, and encryption for convenience.

πŸ’‘ Basic Usage

🎬 5-Minute Quick Start

Required Features: derive, validation (use: features = ["recommended"])

Step 1: Define Config Structure

use confers::Config;
use serde::{Deserialize, Serialize};

#[derive(Debug, Clone, Serialize, Deserialize, Config)]
#[config(validate)]
#[config(env_prefix = "APP_")]
pub struct AppConfig {
    pub name: String,
    pub port: u16,
    pub debug: bool,
}

Step 2: Create Config File

# config.toml
name = "my-app"
port = 8080
debug = true

Step 3: Load Config

fn main() -> anyhow::Result<()> {
    let config = AppConfig::load()?;
    println!("βœ… Loaded: {:?}", config);
    Ok(())
}

Step 4: Environment Override

# Environment variables automatically override
export APP_PORT=9090
export APP_DEBUG=true
πŸ“– Complete Working Example
use confers::Config;
use serde::{Deserialize, Serialize};

#[derive(Debug, Clone, Serialize, Deserialize, Config)]
#[config(validate)]
#[config(env_prefix = "APP_")]
pub struct AppConfig {
    pub name: String,
    pub port: u16,
    pub debug: bool,
}

fn main() -> anyhow::Result<()> {
    // Create config file
    let config_content = r#"
name = "my-app"
port = 8080
debug = true
"#;
    std::fs::write("config.toml", config_content)?;

    // Load configuration
    let config = AppConfig::load()?;

    // Print configuration
    println!("πŸŽ‰ Configuration loaded successfully!");
    println!("πŸ“‹ Name: {}", config.name);
    println!("πŸ”Œ Port: {}", config.port);
    println!("πŸ› Debug: {}", config.debug);

    Ok(())
}

πŸ“š Documentation


User Guide

Complete usage guide

API Reference

Complete API docs

Examples

Code examples

πŸ“– Additional Resources

Resource Description
❓ FAQ Frequently asked questions
πŸ“– Contributing Guide Code contribution guidelines
πŸ“˜ API Reference Complete API documentation
πŸ—οΈ Architecture Decisions ADR documentation
πŸ“š Library Integration Guide How to integrate confers CLI into your projects

πŸ”Œ Library Integration

Confers provides a unified ConfersCli API for easy integration into other Rust projects.

Quick Start

[dependencies]
confers = { version = "0.2.2", features = ["cli"] }
use confers::ConfersCli;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Generate configuration template
    ConfersCli::generate(Some("config.toml"), "full")?;
    
    // Validate configuration
    ConfersCli::validate("config.toml", "full")?;
    
    // Compare configurations
    ConfersCli::diff("config1.toml", "config2.toml", Some("unified"))?;
    
    // Encrypt values
    let encrypted = ConfersCli::encrypt("secret", None)?;
    
    Ok(())
}

Available Methods

Method Description Example
generate(output, level) Generate config templates ConfersCli::generate(Some("app.toml"), "minimal")?
validate(config, level) Validate config files ConfersCli::validate("app.toml", "full")?
diff(file1, file2, format) Compare configs ConfersCli::diff("old.toml", "new.toml", Some("side-by-side"))?
encrypt(value, key) Encrypt values ConfersCli::encrypt("secret", None)?
wizard(non_interactive) Interactive setup ConfersCli::wizard(false)?
completions(shell) Generate completions ConfersCli::completions("bash")?
key(subcommand) Key management ConfersCli::key(&KeySubcommand::Generate)?

πŸ“š Complete Integration Guide β†’


πŸ’» Examples

πŸ’‘ Real-World Examples

πŸ“ Example 1: Basic Configuration

use confers::Config;
use serde::{Deserialize, Serialize};

#[derive(Debug, Clone, Serialize, Deserialize, Config)]
#[config(validate)]
pub struct BasicConfig {
    pub name: String,
    pub port: u16,
}

fn basic_example() -> anyhow::Result<()> {
    let config = BasicConfig::load()?;
    println!("βœ… Name: {}, Port: {}", config.name, config.port);
    Ok(())
}
View Output
βœ… Name: my-app, Port: 8080

πŸ”₯ Example 2: Advanced Configuration

use confers::Config;
use serde::{Deserialize, Serialize};

#[derive(Debug, Clone, Serialize, Deserialize, Config)]
#[config(validate)]
#[config(env_prefix = "MYAPP_")]
pub struct AdvancedConfig {
    #[config(description = "Server port number")]
    pub port: u16,
    #[config(default = "localhost")]
    pub host: String,
    #[config(sensitive = true)]
    pub api_key: String,
}

fn advanced_example() -> anyhow::Result<()> {
    let config = AdvancedConfig::load()?;
    println!("πŸš€ Server: {}:{}", config.host, config.port);
    Ok(())
}
View Output
πŸš€ Server: localhost:8080

πŸ“‚ Explore All Examples β†’


πŸ—οΈ Architecture

πŸ—οΈ System Architecture

graph TB
    subgraph Sources ["πŸ“₯ Configuration Sources"]
        A[πŸ“ Local Files<br/>TOML, JSON, YAML, INI]
        B[🌐 Environment Variables]
        C[πŸ’» CLI Arguments]
        D[☁️ Remote Sources<br/>etcd, Consul, HTTP]
    end
    
    subgraph Core ["πŸ”§ Core Engine"]
        E[⚑ ConfigLoader<br/>Multi-source Merge]
    end
    
    subgraph Processing ["πŸ”¨ Processing Layer"]
        F[βœ… Validation<br/>Type & Business Rules]
        G[πŸ“„ Schema Generation]
        H[πŸ” Encryption<br/>AES-256-GCM]
        I[πŸ“‹ Audit Logging]
        J[πŸ‘οΈ File Watching]
        K[πŸ“Š Memory Monitoring]
    end
    
    subgraph Output ["πŸ“€ Application"]
        L[πŸš€ Application Configuration<br/>Type-Safe & Validated]
    end
    
    Sources --> Core
    Core --> Processing
    Processing --> Output
    
    style Sources fill:#DBEAFE,stroke:#1E40AF
    style Core fill:#FEF3C7,stroke:#92400E
    style Processing fill:#EDE9FE,stroke:#5B21B6
    style Output fill:#DCFCE7,stroke:#166534

πŸ“ Component Status

Component Description Status
ConfigLoader Core loader with multi-source support βœ… Stable
Configuration Validation Built-in validator integration βœ… Stable
Schema Generation Auto-generate JSON Schema βœ… Stable
File Watching Real-time monitoring with hot reload βœ… Stable
Remote Configuration etcd, Consul, HTTP support 🚧 Beta
Audit Logging Record access and change history βœ… Stable
Encrypted Storage AES-256 encrypted storage βœ… Stable
Configuration Diff Multiple output formats βœ… Stable
Interactive Wizard Template generation βœ… Stable

βš™οΈ Configuration

πŸŽ›οΈ Configuration Options

Basic Configuration

[project]
name = "my-app"
version = "1.0.0"

[server]
host = "localhost"
port = 8080

[features]
debug = true
logging = true

Advanced Configuration

[project]
name = "my-app"
version = "1.0.0"

[server]
host = "0.0.0.0"
port = 8080
workers = 4

[database]
url = "postgres://localhost/db"
pool_size = 10

[performance]
cache_size = 1000
πŸ”§ All Configuration Options
Option Type Default Description
name String - Project name
version String "1.0.0" Version number
host String "localhost" Server host
port u16 8080 Server port
debug Boolean false Enable debug mode
workers usize 4 Number of worker threads
cache_size usize 1000 Cache size in MB

πŸ§ͺ Testing

🎯 Test Coverage

codecov

# πŸ§ͺ Run all tests
cargo test --all-features

# πŸ“Š Generate coverage report
cargo tarpaulin --out Html

# ⚑ Run benchmarks
cargo bench

# 🎯 Run specific test
cargo test test_name
πŸ“Š Test Statistics
Category Test Count Coverage
πŸ§ͺ Unit Tests 50+ 85%
πŸ”— Integration Tests 20+ 80%
⚑ Performance Tests 10+ 75%
πŸ“ˆ Total 80+ 80%

πŸ“Š Performance

⚑ Benchmark Results

πŸ“Š Throughput

Operation Performance
Config Load 1,000,000 ops/sec
Validation 500,000 ops/sec
Schema Gen 2,000,000 ops/sec

⏱️ Latency

Percentile Latency
P50 0.5ms
P95 1.2ms
P99 2.5ms
πŸ“ˆ Detailed Benchmarks
# Run benchmarks
cargo bench

# Sample output:
test bench_config_load  ... bench: 1,000 ns/iter (+/- 50)
test bench_validate     ... bench: 2,000 ns/iter (+/- 100)
test bench_schema_gen   ... bench: 500 ns/iter (+/- 25)

πŸ”’ Security

πŸ›‘οΈ Security Features


Memory Safety
Zero-copy & secure cleanup

Audited
Regular security audits

Privacy
No data collection

Compliance
Industry standards
πŸ” Security Details

πŸ›‘οΈ Security Measures

Measure Description API Reference
βœ… Memory Protection Automatic secure cleanup with zeroization SecureString, zeroize crate
βœ… Side-channel Protection Constant-time cryptographic operations AES-256-GCM encryption
βœ… Input Validation Comprehensive input sanitization ConfigValidator, InputValidator
βœ… Audit Logging Full operation tracking AuditConfig, audit trails
βœ… SSRF Protection Server-Side Request Forgery prevention validate_remote_url()
βœ… Sensitive Data Detection Automatic detection of sensitive fields SensitiveDataDetector
βœ… Error Sanitization Remove sensitive info from error messages ErrorSanitizer, SecureLogger
βœ… Nonce Reuse Detection Prevent cryptographic nonce reuse Built into encryption module

πŸ” Security APIs

// Secure string handling
use confers::security::{SecureString, SensitivityLevel};
let secure_str = SecureString::new("sensitive_data", SensitivityLevel::High);

// Input validation
use confers::security::ConfigValidator;
let validator = ConfigValidator::new();
let result = validator.validate_input(user_input);

// Error sanitization
use confers::security::ErrorSanitizer;
let sanitizer = ErrorSanitizer::default();
let safe_error = sanitizer.sanitize(&error_message);

// Audit logging
#[cfg(feature = "audit")]
use confers::audit::AuditConfig;
let audit = AuditConfig::new().enable_sensitive_field_tracking();

🚨 Security Best Practices

  1. Use SecureString for sensitive data: Automatically zeroizes memory
  2. Enable audit logging: Track all configuration access and changes
  3. Validate all inputs: Use built-in validators for user inputs
  4. Use encryption: Enable encryption feature for sensitive configs
  5. Follow principle of least privilege: Minimize sensitive data exposure

πŸ“§ Reporting Security Issues

Please report security vulnerabilities to: security@confers.example


πŸ—ΊοΈ Roadmap

🎯 Development Roadmap

gantt
    title Confers Development Roadmap
    dateFormat  YYYY-MM
    section Core Features βœ…
    Type-safe Configuration     :done, 2024-01, 2024-06
    Multi-format Support       :done, 2024-02, 2024-06
    Environment Variable Override     :done, 2024-03, 2024-06
    section Validation System βœ…
    Basic Validation Integration     :done, 2024-04, 2024-07
    Parallel Validation Support     :done, 2024-05, 2024-08
    section Advanced Features 🚧
    Schema Generation      :active, 2024-06, 2024-09
    File Watching Hot Reload   :done, 2024-07, 2024-09
    Remote Configuration Support     :active, 2024-08, 2024-12
    Audit Logging         :done, 2024-08, 2024-10

βœ… Completed

  • Type-safe Configuration
  • Multi-format Support (TOML, YAML, JSON, INI)
  • Environment Variable Override
  • Configuration Validation System
  • Schema Generation
  • File Watching & Hot Reload
  • Audit Logging
  • Encrypted Storage Support
  • Remote Configuration Support (etcd, Consul, HTTP)

πŸ“‹ Planned

  • Configuration Diff Comparison
  • Configuration Version Management
  • Plugin System
  • More Remote Providers
  • Performance Optimization
  • Web UI Management Interface
  • Cloud-native Integration
  • Distributed Configuration Sync

🀝 Contributing

πŸ’– Thank You to All Contributors!

Contributors

πŸ› Report Bugs

Found an issue?
Create Issue

πŸ’‘ Feature Suggestions

Have a great idea?
Start Discussion

πŸ”§ Submit PR

Want to contribute code?
Fork & PR

πŸ“ Contribution Guidelines

πŸš€ How to Contribute

  1. Fork this repository
  2. Clone your fork: git clone https://github.com/yourusername/confers.git
  3. Create a branch: git checkout -b feature/amazing-feature
  4. Make your changes
  5. Test your changes: cargo test --all-features
  6. Commit your changes: git commit -m 'feat: Add amazing feature'
  7. Push to the branch: git push origin feature/amazing-feature
  8. Create a Pull Request

πŸ“‹ Code Standards

  • βœ… Follow Rust standard coding conventions
  • βœ… Write comprehensive tests
  • βœ… Update documentation
  • βœ… Add examples for new features
  • βœ… Pass cargo clippy -- -D warnings

πŸ“„ License

This project is licensed under MIT License:

License: MIT


πŸ™ Acknowledgments

🌟 Built With Amazing Tools


Rust

GitHub

Open Source

Community

πŸ’ Special Thanks

Category Description
🌟 Dependency Projects serde - Serialization framework
figment - Configuration management
validator - Validation library
πŸ‘₯ Contributors Thanks to all contributors!
πŸ’¬ Community Special thanks to community members

πŸ“ž Contact & Support


Issues

Report bugs & issues

Discussions

Ask questions & share ideas

GitHub

View source code

⭐ Star History

Star History Chart


πŸ’ Support This Project

If you find this project useful, please consider giving it a ⭐️!

Built with ❀️ by Kirky.X


⬆ Back to Top


Β© 2026 Kirky.X. All rights reserved.

Commit count: 139

cargo fmt