Skip to content
Researched developer tool comparisonsPrices dated · vendor sources linked · no star ratings
Search

Stage 01 · Write · Researched comparison

Best Rust Config Libraries in 2026

config-rs (the config crate) is the first pick for most applications that need layered configuration from files and environment variables, because it supports many formats and merging out of the box. figment suits projects that want a provider-based model with strong profile support. confy fits small apps that just need to load and save a config file with little setup.

By
Published 27 Nov 2026 · 6 tools compared

We run no ads and no affiliate links at launch. The order of a list follows our published method. See how we score.

Prices are the starting prices vendors list publicly. Plans change, so confirm the current price on the vendor page before you buy.

Key takeaways

  • config-rs, figment, confy, serde with toml, envy and dotenvy are all free and open source.
  • config-rs and figment handle layered sources; serde with toml handles a single TOML file.
  • confy writes and reads a config file for you, which suits small tools rather than large services.
  • These libraries run in your own process, so config values never leave your machine.

Who each pick is for

Comparison

The 6 tools at a glance
ToolBest forStandout featureListed starting priceFree plan or trial
1config-rs (config crate)Layered config from files and environment variablesSupports TOML, JSON, YAML, RON, INI and environment sourcesFree (open source)Free plan
2figmentProvider-based config with profiles and metadataClear provider model with built-in profile supportFree (open source)Free plan
3confySmall apps that need a saved config fileHandles config file location and creation for youFree (open source)Free plan
4serde with the toml crateReading a single TOML file into typed structsPrecise TOML parsing with strong serde integrationFree (open source)Free plan
5envyDeserializing environment variables into a structSmall focused API for env var to struct mappingFree (open source)Free plan
6dotenvyLoading .env files during developmentMaintained successor to the dotenv crateFree (open source)Free plan

How we picked

We picked crates that solve distinct parts of configuration loading in Rust: layered sources, single-format parsing, file management and environment variables. Criteria were fit for the job, supported platforms, licence and price, and the main limits of each crate. Sources are vendor pages, crate documentation and project repositories. Prices and licences can change, so confirm details on the project page before you commit.

The tools, one by one

01

config-rs (config crate)

Best for layered config from files and environment variables

Visit github.com
config-rs (config crate) homepage
config-rs (config crate) homepage, captured Nov 2026

What it is and where it fits

The config crate builds a configuration from one or more sources and merges them into a single value. You can layer a default file, an environment-specific file and environment variables, then deserialize the result into a struct with serde. It supports TOML, JSON, YAML, RON, INI and environment variable sources.

It runs anywhere Rust runs, including servers, CLI tools and embedded targets that support the standard library. The crate is dual licensed under MIT and Apache-2.0. It is free with no account or limits. The main cost is learning the merge order and the builder API, which has shifted between major versions. Projects that only read one TOML file may find it heavier than needed.

Standout: Supports TOML, JSON, YAML, RON, INI and environment sources

Pricing pointer

Free (open source), as listed by the vendor (config-rs (config crate) website). Confirm the current plan price before you buy.

Free plan. Plans change, so confirm on the vendor's pricing page before you buy.

Benefits

  • Supports TOML, JSON, YAML, RON, INI and environment sources
  • merges sources in a defined order

Drawbacks

  • API has changed across major versions
  • error messages can be indirect

Skip it if this limit matters to you: API has changed across major versions.

Verdict. A sensible pick for layered config from files and environment variables.

Alternatives in this guide: figment, confy, serde with the toml crate

02

figment

Best for provider-based config with profiles and metadata

Visit github.com
figment homepage
figment homepage, captured Nov 2026

What it is and where it fits

Figment is a configuration library built around providers. Each provider supplies values, and figment merges them in order. It ships providers for TOML, JSON, YAML and environment variables, and it has first-class support for profiles such as development and production. It also tracks where each value came from, which helps when debugging merged config.

It is maintained by the Rocket web framework author and is used by Rocket itself. The crate is MIT licensed and free to use. It runs on standard Rust targets. The tradeoff is a smaller set of third-party integrations than config-rs, and the docs expect you to understand the provider concept before you start. Teams already using Rocket will find it familiar.

Standout: Clear provider model with built-in profile support

Pricing pointer

Free (open source), as listed by the vendor (figment website). Confirm the current plan price before you buy.

Free plan. Plans change, so confirm on the vendor's pricing page before you buy.

Benefits

  • Clear provider model with built-in profile support
  • tracks value metadata and provenance

Drawbacks

  • Smaller ecosystem than config-rs
  • documentation assumes some familiarity

Skip it if this limit matters to you: smaller ecosystem than config-rs.

Verdict. A sensible pick for provider-based config with profiles and metadata.

Alternatives in this guide: config-rs (config crate), confy, serde with the toml crate

03

confy

Best for small apps that need a saved config file

Visit github.com
confy homepage
confy homepage, captured Nov 2026

What it is and where it fits

Confy manages a single configuration file for an application. It picks an appropriate location per platform, creates the file with defaults if it is missing, and loads or stores a serde-compatible struct. It uses TOML by default and supports other formats through features.

It suits desktop tools, CLI utilities and small services that need one settings file without a merge layer. The crate is dual licensed under MIT and Apache-2.0 and is free. It runs on Windows, macOS and Linux. If you need to combine environment variables, multiple files or profiles, confy is the wrong tool and config-rs or figment is a better fit.

Standout: Handles config file location and creation for you

Pricing pointer

Free (open source), as listed by the vendor (confy website). Confirm the current plan price before you buy.

Free plan. Plans change, so confirm on the vendor's pricing page before you buy.

Benefits

  • Handles config file location and creation for you
  • simple load and store API

Drawbacks

  • Limited to one file per app by default
  • fewer merging options than config-rs

Skip it if this limit matters to you: limited to one file per app by default.

Verdict. A sensible pick for small apps that need a saved config file.

Alternatives in this guide: config-rs (config crate), figment, serde with the toml crate

04

serde with the toml crate

Best for reading a single TOML file into typed structs

Visit github.com
serde with the toml crate homepage
serde with the toml crate homepage, captured Nov 2026

What it is and where it fits

The toml crate parses and serializes TOML, and serde maps the result to your structs. This pair is the simplest path when your configuration is one TOML file and you control where it lives. You read the file yourself, then call toml::from_str into a typed struct.

It is dual licensed under MIT and Apache-2.0 and free. It runs on any Rust target. The limit is scope: it does not merge sources, read environment variables or choose file paths. You add those yourself or pair it with another crate. Projects that want layered config should start with config-rs or figment instead of assembling the pieces by hand.

Standout: Precise TOML parsing with strong serde integration

Pricing pointer

Free (open source), as listed by the vendor (serde with the toml crate website). Confirm the current plan price before you buy.

Free plan. Plans change, so confirm on the vendor's pricing page before you buy.

Benefits

  • Precise TOML parsing with strong serde integration
  • widely used and well documented

Drawbacks

  • No environment variable or multi-file merging
  • you write the file handling

Skip it if this limit matters to you: no environment variable or multi-file merging.

Verdict. A sensible pick for reading a single TOML file into typed structs.

Alternatives in this guide: config-rs (config crate), figment, confy

05

envy

Best for deserializing environment variables into a struct

Visit github.com
envy homepage
envy homepage, captured Nov 2026

What it is and where it fits

Envy deserializes environment variables into a serde struct. It maps variable names to field names and respects serde attributes such as rename and default. It is useful in container and twelve-factor setups where configuration arrives as environment variables.

The crate is MIT licensed and free. It runs on standard Rust targets. Its scope is narrow by design: it does not read files, merge sources or handle profiles. For apps that combine env vars with a file, config-rs or figment covers both. Envy is a good fit when env vars are the only source and you want a small dependency.

Standout: Small focused API for env var to struct mapping

Pricing pointer

Free (open source), as listed by the vendor (envy website). Confirm the current plan price before you buy.

Free plan. Plans change, so confirm on the vendor's pricing page before you buy.

Benefits

  • Small focused API for env var to struct mapping
  • works well with serde attributes

Drawbacks

  • Only reads environment variables
  • no file support

Skip it if this limit matters to you: only reads environment variables.

Verdict. A sensible pick for deserializing environment variables into a struct.

Alternatives in this guide: config-rs (config crate), figment, confy

06

dotenvy

Best for loading .env files during development

Visit github.com
dotenvy homepage
dotenvy homepage, captured Nov 2026

What it is and where it fits

dotenvy loads key-value pairs from a .env file into the process environment. It is the maintained successor to the older dotenv crate, which is no longer recommended. It is typically used in local development so that tools reading environment variables find the expected values.

The crate is MIT licensed and free. It runs on standard Rust targets. It is not a configuration framework: it does not parse typed structs or merge files. Pair it with envy or config-rs when you need typed access. Keep .env files out of version control and do not treat them as a way to ship production secrets.

Standout: Maintained successor to the dotenv crate

Pricing pointer

Free (open source), as listed by the vendor (dotenvy website). Confirm the current plan price before you buy.

Free plan. Plans change, so confirm on the vendor's pricing page before you buy.

Benefits

  • Maintained successor to the dotenv crate
  • simple API for loading .env files

Drawbacks

  • Not a full config library
  • .env files should not hold production secrets

Skip it if this limit matters to you: not a full config library.

Verdict. A sensible pick for loading .env files during development.

Alternatives in this guide: config-rs (config crate), figment, confy

Who should use what

A service that reads a base config file plus environment overrides should use config-rs. A Rocket app or a project that wants profiles and value provenance should use figment. A small CLI or desktop tool that needs one saved settings file should use confy. A project with a single TOML file and no merging should use serde with the toml crate. Container deployments that pass everything through environment variables can use envy, with dotenvy for local development.

Questions to settle before you buy

What to check before you buy

  • Confirm which formats you need and whether the crate supports all of them.
  • Check the merge order if you combine files and environment variables.
  • Verify the crate is actively maintained and works with your Rust edition.
  • Decide whether you need typed structs or untyped key lookups.
  • Keep secrets out of committed files and prefer environment variables in production.

FAQ

Is config-rs the same as the config crate?

Yes. The crate is published as config and is often called config-rs. It is the same project, hosted at the rust-cli organization on GitHub.

Can I use serde with config-rs and figment?

Yes. Both crates deserialize into serde structs, so you define your config type once and derive Deserialize. This keeps typed access consistent across libraries.

Should I still use the dotenv crate?

No. The dotenv crate is unmaintained. Use dotenvy instead, which is the maintained successor with a similar API.

Do these libraries send my config anywhere?

No. They run inside your process and read local files or environment variables. Nothing is sent over the network by the libraries themselves.

Which crate is best for a single TOML file?

serde with the toml crate is the simplest choice. If you later need environment overrides or multiple files, move to config-rs or figment.

Sources we checked

Method: how we score · editorial policy.

  1. config-rs (config crate) (official site)
  2. figment (official site)
  3. confy (official site)
  4. serde with the toml crate (official site)
  5. envy (official site)
  6. dotenvy (official site)

Change log. First published 27 Nov 2026.