# caarlos0/env

A simple, zero-dependencies library to parse environment variables into structs

Repository: https://github.com/caarlos0/env
Canonical: https://ross.abutalabs.com/products/env
Homepage: https://pkg.go.dev/github.com/caarlos0/env/v11
Language: Go
License: MIT
License Family: permissive
Topics: golang, environment-variables, configuration, environment, config, go, hacktoberfest
Last push: 2026-08-03T16:32:49+00:00

## Health v2 (maintenance only)
Score: 87/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 95, release rhythm 69, longevity 100
- inputs: {"age_days": 4055, "days_push": 30, "days_rel": 124, "gap_med": 67, "n_releases_24m": 4}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 6299, forks 282 (observed 2026-08-28T04:09:41.530568+00:00)

## What it is
A simple, zero-dependency Go library that parses environment variables into struct fields using struct tags. It supports built-in types, pointers, slices, maps, defaults, required fields, file contents, and custom parsers.

## Use cases
- parse environment variables into a Go config struct
- load app configuration from env vars with defaults
- require certain environment variables to be set
- read a secret from a file path given in an env var
- parse env vars into slices and maps
- expand environment variables inside env var values

## When to choose
- you want a tiny, dependency-free config loader for a Go app or service
- you prefer struct-tag-driven configuration over manual parsing
- you need defaults, required validation, or file-based env values

## When to avoid
- you need config files (YAML/TOML/JSON) rather than environment variables
- you want a full-featured config framework with hot reloading or remote sources

## Facets
- artifact type: library
- maturity: stable
- function: configuration-management, developer-tools
- domain: developer-tools, backend
- platform: go, cross-platform
- tags: environment-variables, struct-tags, zero-dependencies, config-parsing, generics, automation

## Member repositories
- caarlos0/env (main) score 87

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:09:41.530568+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T17:46:15.974313+00:00, confidence not recorded.
  - readme: https://github.com/caarlos0/env (fetched 2026-08-28T04:09:41.530568+00:00, sha 6b991ba770b9)
  - homepage: https://pkg.go.dev/github.com/caarlos0/env/v11 (fetched 2026-08-29T08:42:48.944565+00:00, sha 2a88ec24d97c)
  - site_page: https://pkg.go.dev/about (fetched 2026-08-29T08:42:48.949050+00:00, sha 757852027879)
  - site_page: https://go.dev/about (fetched 2026-08-29T08:42:48.951126+00:00, sha 8b6453863a90)
  - site_page: https://go.dev/project (fetched 2026-08-29T08:42:48.963252+00:00, sha d5ca00bb378b)
- Data as of 2026-08-30T08:39:29.467469+00:00.
