dotenvy

A well-maintained, actively developed fork of the dotenv crate for loading .env files in Rust

Library
Cargo
v0.15.7
1,258 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
56 /100 Fair
Development Activity 36
Maintenance 36
Community 56
Maturity 56
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
70 /100 Good
Architecture 68
Code Quality 70
Innovation 65
Learning Curve 78

dotenvy is a Rust library for loading environment variables from .env files, built as the actively maintained successor to the abandoned dotenv crate. It is the recommended replacement cited in security advisory RUSTSEC-2021-0141, and provides both a non-modifying API (returning an EnvMap without touching std::env) and a modifying API via the #[dotenvy::load] attribute macro for cases where the process environment itself must be populated before other code runs.

Beyond basic key-value loading, dotenvy supports multiline values, variable substitution, configurable load sequencing (file-then-env or env-then-file), reading from arbitrary io::Read sources, and a companion dotenvy_macro crate for compile-time .env inspection via a dotenv! macro. A small CLI binary is also included for loading an env file before executing another command.

What You Get

  • A non-modifying EnvLoader/EnvMap API that parses .env files without touching std::env
  • A modifying API via the #[dotenvy::load] attribute macro for populating the process environment before an async runtime starts
  • Support for multiline values and variable substitution within .env files
  • Configurable load sequencing (InputThenEnv / EnvThenInput) to control override precedence
  • Reader-based loading from any io::Read source, not just files
  • A dotenvy_macro crate providing a dotenv! compile-time macro for embedding values at build time
  • A small CLI binary that loads an env file before executing a specified command

Common Use Cases

  • Loading local development configuration (database URLs, API keys) from a .env file without committing secrets to source control
  • Supporting dev/prod configuration switching by loading different env files per environment
  • Populating environment variables for a spawned child process that reads from std::env
  • Compile-time embedding of configuration values via the dotenv! macro for values that never change at runtime

Under The Hood

Architecture - dotenvy is organized as a small Cargo workspace with a core dotenvy crate plus companion dotenvy-macros/dotenv_codegen crates and a thin CLI binary. The core crate splits parsing (parse.rs), iteration over key-value pairs (iter.rs), and error types (err.rs) from the public lib.rs surface, which exposes an EnvLoader builder that either returns a standalone EnvMap (non-modifying) or, via the #[dotenvy::load] attribute macro, writes directly into std::env before other code (including async runtimes) starts. Tech Stack - Pure Rust with minimal dependencies; the CLI binary and macro support are gated behind optional Cargo features (cli, macros) using clap for argument parsing, keeping the core library dependency-free for consumers who only need file parsing. Code Quality - The codebase is compact (~1,400 lines across four core source files) with #![deny(clippy::uninlined_format_args, clippy::wildcard_imports)] enforced at the crate root; unit tests exist in the parser and iterator modules but coverage is modest relative to the surface area, and error types are deliberately informative (carrying file path and variable name) rather than opaque. API Design - The library favors an ergonomic, builder-style EnvLoader with clear non-modifying vs. modifying entry points, sensible defaults (./​.env, non-overriding), and thorough README-level documentation of configuration options, making it easy to adopt with minimal boilerplate.

Used by 19 apps in this directory

TypeScript
78%
LGPL 3.0

Latitude

AI Agents · Monitoring

4,733

Open-source AI agent monitoring that catches what will break next before your users do.

View details
87
Repo Health
88
Technical
67
Dependency
Built with
TypeScript 78%
Python 11%
Rust 11%
Updated 6 days ago
JavaScript
55%
Other

Lokus

Knowledge Management · Note Taking

829

Local-first note-taking with graph view, canvas & AI plugins—your Markdown files, zero telemetry, blazing-fast Rust performance.

View details
75
Repo Health
75
Technical
64
Dependency
Built with
JavaScript 55%
HTML 21%
Rust 12%
Updated 2 months ago
Rust
85%
AGPL 3.0

ParadeDB

Analytics · Databases · Search

9,436

Born out of Y Combinator's S2023 batch, ParadeDB is a Postgres extension that delivers Elasticsearch-quality BM25 search and real-time analytics without a separate search cluster to manage.

View details
89
Repo Health
87
Technical
68
Dependency
Built with
Rust 85%
PLpgSQL 15%
Updated 5 days ago
Go
82%
AGPL 3.0

PeerDB

Data Engineering · Databases

3,309

Postgres-native ETL that streams change data capture in real time to Snowflake, BigQuery, ClickHouse, S3, and Kafka — up to 10x faster than general-purpose pipelines, managed through a familiar Postgres SQL interface.

View details
89
Repo Health
76
Technical
66
Dependency
Built with
Go 82%
TypeScript 12%
Updated 5 days ago
Rust
63%
MIT

Readur

Bookmarks Archiving · File Storage · Knowledge Management

804

A self-hosted document management system that OCRs, indexes, and makes every PDF, scan, and Office file instantly searchable.

View details
83
Repo Health
78
Technical
67
Dependency
Built with
Rust 63%
TypeScript 32%
Updated 5 days ago
TypeScript
61%
AGPL 3.0

Silex

Design Tools · No Code Platforms

3,015

Free, open-source visual website builder that exports clean HTML/CSS — no lock-in, no subscription, host anywhere

View details
89
Repo Health
68
Technical
67
Dependency
Built with
TypeScript 61%
Rust 15%
JavaScript 11%
Updated 6 days ago
Rust
46%
MIT

Svix

Automation · Developer Tools

3,463

Open source, self-hostable webhook infrastructure that handles delivery, retries, HMAC signing, and multi-tenant event management so you never have to build a webhooks system from scratch.

View details
91
Repo Health
77
Technical
67
Dependency
Built with
Rust 46%
C# 16%
Updated 6 days ago
Rust
93%
Other

Tabby

AI Code Assistants

33,924

Self-hosted AI coding assistant — run GitHub Copilot-grade code completion on your own hardware with no cloud dependency.

View details
55
Repo Health
78
Technical
61
Dependency
Built with
Rust 93%
Updated 4 months ago
Rust
71%
MIT

Trieve

AI Development · Developer Tools · Search

2,721

All-in-one self-hostable platform for hybrid search, RAG, recommendations, and analytics built on Rust and Qdrant.

View details
42
Repo Health
74
Technical
65
Dependency
Built with
Rust 71%
Updated 9 months ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers