joho

    joho/godotenv

    A Go port of Ruby's dotenv library (Loads environment variables from .env files)

    10.7K stars
    468 forks
    42 GitHub watchers
    Updated Nov 10, 2026
    View on GitHub

    Build with Backblaze B2

    SDKs, agent skills, IDE extensions, and reference pipelines from Backblaze Labs. All open source.

    Explore Backblaze Labs

    Loading star history...

    Where it stands

    Rank, growth pace and release cadence relative to everything GStars tracks.

    No releases in the last 90 days; the most recent was 168 days ago, with 48 contributors on GitHub.

    Use Cases & Benefits

    • Loads environment variables from .env files into Go applications to simplify configuration management.
    • Enables seamless environment variable loading compatible with twelve-factor app principles, reducing manual setup across environments.
    • Use for managing environment-specific configurations in Go projects during local development and testing.
    • Use for injecting environment variables in continuous integration pipelines to maintain consistent build environments.
    • Use for writing and reading .env files programmatically to automate configuration workflows in Go-based tools.

    Should you depend on it?

    License terms, project hygiene and risks, from GitHub metadata and GStars' snapshots.

    License

    MIT

    Permissive: commercial use, modification and redistribution are allowed with attribution.

    Community files

    • README: present

    Watch-outs

    No watch-outs from GStars' checks.

    General guidance from repository metadata, not legal advice. How we score

    From the README

    A Go (golang) port of the Ruby dotenv project (which loads env vars from a .env file).

    Storing configuration in the environment is one of the tenets of a twelve-factor app. Anything that is likely to change between deployment environments–such as resource handles for databases or credentials for external services–should be extracted from the code into environment variables.

    But it is not always practical to set environment variables on development machines or continuous integration servers where multiple projects are run. Dotenv load variables from a .env file into ENV when the environment is bootstrapped.

    It can be used as a library (for loading in env for your own daemons etc.) or as a bin command.

    There is test coverage and CI for both linuxish and Windows environments, but I make no guarantees about the bin version working on Windows.

    As a library

    or if you want to use it as a bin command

    Add your application configuration to your .env file in the root of your project:

    Then in your Go app you can do something like

    If you're even lazier than that, you can just take advantage of the autoload package which will read in .env on import

    While .env in the project root is the default, you don't have to be constrained, both examples below are 100% legit

    If you want to be really fancy with your env file you can do comments and exports (below is a valid env file)

    Or finally you can do YAML(ish) style

    as a final aside, if you don't want godotenv munging your env you can just get a map back instead

    Excerpt from the joho/godotenv README on GitHub (MIT license). © its authors.Read the full README on GitHub

    Daily snapshots

    Stars gained per day, and how forks and open issues moved, from GStars' daily snapshots

    Forks

    468+9

    Open issues

    89+8

    Compared with peers in Backend

    Fastest-growing repositories GStars tracks in this cohort for the week of Nov 8, by 7-day star growth

    joho/godotenv compared with Backend repositories by stars, 7-day star growth, health score and last release
    RepositoryStars+7dHealthLast release
    anthropics/skills192.3K+5.2K75—
    zed-industries/zed94.7K+2.3K756 days ago
    google/skills23.8K+2.0K75—
    NationalSecurityAgency/ghidra99.4K+1.8K7519 days ago
    DuarteSantos8/openGym20.8K+1.7K757 days ago
    joho/godotenv10.7K—45168 days ago
    Category median94.7K+2.0K75—

    Discover Repositories

    Search across tracked repositories by name or description