dotenvy

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

Library
Cargo
v0.15.7
1,252 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
60 /100 Good
Development Activity 48
Maintenance 40
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

Rust
54%
Other

Cap

Team Chat · Video Conferencing

22,884

Open source Loom alternative with GPU-accelerated recording, instant share links, AI summaries, and full self-hosting via Docker Compose.

View details
89
Repo Health
81
Technical
64
Dependency
Built with
Rust 54%
TypeScript 42%
Updated 4 days ago
Rust
95%
MIT

claw-code

AI Agents · AI Code Assistants

195,291

A Rust-built CLI agent harness for Claude AI with persistent sessions, MCP tool integration, plugin hooks, and multi-provider support — designed to run autonomous coding workflows without human babysitting.

View details
51
Repo Health
71
Technical
77
Dependency
Built with
Rust 95%
Updated 1 months ago
Rust
52%
Apache 2.0

cocoindex

AI Development · Data Engineering

11,607

An incremental data indexing engine that keeps AI agent context perpetually fresh by reprocessing only what changed.

View details
87
Repo Health
85
Technical
65
Dependency
Built with
Rust 52%
Python 48%
Updated 4 days ago
Go
32%
Apache 2.0

CubeSandbox

AI Agents · Developer Tools · Security

12,728

Instant, concurrent, hardware-isolated MicroVM sandboxes for AI agents — E2B-API compatible, sub-60ms cold starts, and a built-in zero-trust egress proxy, all self-hostable at scale.

View details
82
Repo Health
88
Technical
63
Dependency
Built with
Go 32%
Rust 26%
C 22%
Updated 1 weeks ago
Rust
67%
Other

DefGuard

Authentication · Networking · Security

2,849

Self-hosted secure remote access that unifies WireGuard VPN, identity management, and connection-level MFA in one open-source platform.

View details
84
Repo Health
82
Technical
72
Dependency
Built with
Rust 67%
TypeScript 31%
Updated 1 weeks ago
TypeScript
90%
Other

FastGPT

AI Agents · AI Development

29,758

Build, debug, and deploy knowledge-based AI agents with a visual workflow editor, RAG retrieval, and support for any OpenAI-compatible LLM.

View details
93
Repo Health
84
Technical
66
Dependency
Built with
TypeScript 90%
Updated 4 days ago
TypeScript
75%
Apache 2.0

Fern

Developer Tools

3,787

Fern turns a single OpenAPI, AsyncAPI, or Protobuf definition into type-safe SDKs for nine languages and a hosted API documentation site, all from one CLI and one source of truth.

View details
90
Repo Health
86
Technical
66
Dependency
Built with
TypeScript 75%
Updated 4 days ago
Rust
93%
Apache 2.0

helix-db

Databases

6,102

A graph-vector database built from scratch in Rust that unifies graph traversal, vector search, key-value, and relational storage into a single platform for AI applications.

View details
86
Repo Health
80
Technical
80
Dependency
Built with
Rust 93%
Updated 5 days ago
Rust
96%
Apache 2.0

InfluxDB

Analytics · Databases

31,758

Open-source time-series database built for real-time ingest, fast SQL queries, and embedded Python automation — powered by Apache Arrow and Parquet.

View details
82
Repo Health
76
Technical
72
Dependency
Built with
Rust 96%
Updated 1 weeks 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