Introduction Profig is a configuration framework for Rust designed to simplify and enhance the development experience when managing configuration files, avoiding the manual and repetitive work that many developers have faced for years.
Origin and motivation After finding that in JavaScript there are several mature and useful configuration managers, the need arose for a solid alternative in the Rust ecosystem; faced with limited options such as config, config-manager, and figment, Profig was born as a lightweight solution focused on developer ergonomics.
Main features Profig in its v0.1 version offers functionalities designed for small and medium-sized projects: macros to derive configuration schemas like #[derive(Profig)] and #[profig(...)] attributes to describe metadata; restriction of allowed formats via #[profig(format=json,toml,yaml)]; per-field metadata such as min, max, default, regex, and doc for validation and documentation; loading data from files with AppConfig::load(config.yaml) returning a typed instance; automatic validation and filling with default values when applicable; generation of example files with AppConfig::sample_config(sample.json) and automatic generation of markdown documentation with AppConfig::generate_doc(docs.md); modular support for JSON, TOML, and YAML formats via feature flags.
Installation To get started, simply add the dependency and enable the desired backends, for example cargo add profig --features json,yaml, so that only the necessary dependencies are incorporated and the binary is not bloated.
Schema definition The schema definition is done with Profig's macros and attributes, for example using #[derive(Profig)] and #[profig(format=json,yaml)] on a structure that declares fields with metadata such as min, max, default, regex, and doc; each field gets validation and metadata that are then used to generate examples and documentation.
Basic usage Loading configuration is simple and straightforward: HostConfig::load(config.yaml) returns a HostConfig object with all fields validated and filled as needed, ready to be used in the application logic, for example to start a server or configure a CLI.
Example generation With a single call HostConfig::sample_config(sample.json) Profig creates an example file that reflects the restrictions and default values defined in the metadata, for example a JSON represented in a readable way could look like { threads: 4, hostname: localhost, port: 1, email: REQUIRED; must match ^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$ } where the rules and notes appear next to each field.
Documentation generation With HostConfig::generate_doc(docs.md) you get a markdown document that describes each field, its type, restrictions, and the help provided in doc, facilitating the creation of manuals and communication with users and operations teams.
Technology and architecture Profig leverages the Rust ecosystem and consolidated crates: serde for serialization and validation, serde_json, serde_yaml, and toml to read different formats, procedural macros to offer a developer-friendly API, and feature flags to keep the package lightweight and modular. This architecture allows a clear flow: schema defined as Rust structs and attributes, validated reading from files, generation of examples and documentation based on metadata.
Practical use case Imagine a CLI that needs host, port, email, and number of threads. With Profig you define the structure with metadata, allow JSON and YAML, and at runtime call HostConfig::load(config.yaml) to get all validated values ready to use. If you want a configuration example, you generate it with HostConfig::sample_config(sample.json) and if you need docs, generate HostConfig::generate_doc(docs.md).
About Q2BSTUDIO Q2BSTUDIO is a software development company specialized in custom applications and custom software, with experience in artificial intelligence and AI for businesses, cybersecurity, AWS and Azure cloud services, business intelligence services, and visualization solutions like Power BI. Our team integrates AI agents and develops custom solutions that combine AI models, secure architectures, and cloud deployments to deliver measurable value to clients across different sectors.
How Q2BSTUDIO can help If you want to integrate Profig into a professional project or need a custom solution, Q2BSTUDIO offers consulting and development to adapt configuration frameworks, automate deployment pipelines in AWS and Azure cloud services, implement cybersecurity controls, and design artificial intelligence solutions and business intelligence services that leverage AI agents and Power BI for decision-making.
Advantages for your business Working with Q2BSTUDIO means accessing expertise in custom applications, custom software, applied artificial intelligence, security improvement through advanced cybersecurity practices, and cloud architecture optimized for AWS and Azure. Additionally, we can accompany you in business intelligence projects to turn data into actionable information through efficient pipelines and visualizations with Power BI.
Project status and final notes Profig is at an initial stage v0.1 but is already useful for specific cases and projects looking for a declarative and validated way to manage configurations. The project will continue to evolve to a version 1 with more features and robustness. We value community feedback and collaborations with companies like Q2BSTUDIO that can help mature the project and apply it in production environments.
Contact and next steps If you are interested in trying Profig or need professional assistance to integrate it into enterprise solutions, contact Q2BSTUDIO to explore custom software development services, artificial intelligence integration, cybersecurity, AWS and Azure cloud services, business intelligence services, AI agents, and Power BI visualization; we can help you design, implement, and deploy the solution your company needs.




