Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Go
  3. zerocfg

zerocfg

MITGo

A Go configuration library with a flag-like API that supports YAML, environment variables, and CLI arguments with zero boilerplate.

Visit WebsiteGitHubGitHub
200 stars10 forks0 contributors

What is zerocfg?

ZeroCfg is a Go configuration library that provides a flag-like API for managing application settings with support for YAML, environment variables, and command-line arguments. It solves the problem of configuration boilerplate by offering a declarative approach with automatic value resolution and early error detection.

Target Audience

Go developers building applications that require flexible configuration management across multiple environments without repetitive code.

Value Proposition

Developers choose ZeroCfg for its elegant API that mirrors Go's flag package while adding modern features like YAML support, secret protection, and multi-source priority resolution—all with zero boilerplate.

Overview

Zero-effort, concise configuration management that avoids boilerplate and repetitive actions.

Use Cases

Best For

  • Go applications needing YAML configuration with CLI overrides
  • Projects wanting flag-like simplicity with environment variable support
  • Teams requiring strict configuration validation and early error detection
  • Services that must protect sensitive configuration values in logs
  • Applications with hierarchical configuration structures
  • Developers tired of writing repetitive configuration parsing code

Not Ideal For

  • Applications that need to dynamically add or modify configuration options at runtime (e.g., plugin-based systems)
  • Projects requiring flexible, conditional priority overrides where lower sources might need to trump higher ones
  • Teams already invested in comprehensive configuration libraries like Viper that support JSON, TOML, or remote sources out-of-the-box

Pros & Cons

Pros

Flag-Like Simplicity

The API is directly inspired by Go's standard flag package, making it intuitive for developers familiar with Go's ecosystem and reducing the learning curve.

Multi-Source Priority

Automatically loads configuration from CLI, environment variables, and YAML files with a strict hierarchy (CLI highest, defaults lowest), ensuring predictable value resolution.

Early Error Detection

Catches mistyped configuration keys at parse time by default, preventing runtime issues from typos and enforcing clean configuration patterns.

Built-in Secret Protection

Masks sensitive values marked with zfg.Secret() when rendering configuration via zfg.Show(), reducing the risk of accidental exposure in logs.

Cons

No Dynamic Registration

Options must be registered at import time, prohibiting runtime addition—a limitation for modular applications or systems with plugin architectures.

Limited Format Support

Only YAML is supported for file-based configuration by default; adding JSON or TOML requires implementing custom providers, unlike more feature-rich alternatives.

Inflexible Error Handling

Unknown configuration keys cause errors by default, which can be overly strict for environments with optional or evolving configs, even though ignoring them is possible.

Frequently Asked Questions

Quick Stats

Stars200
Forks10
Contributors0
Open Issues2
Last commit5 days ago
CreatedSince 2025

Tags

#declarative-config#environment-variables#yaml#environment#go-library#zero-boilerplate#config#configuration#golang#cli#configuration-management#go#flag

Built With

G
Go

Links & Resources

Website

Included in

Go169.1k
Auto-fetched 16 hours ago

Related Projects

viperviper

Go configuration with fangs

Stars30,373
Forks2,173
Last commit6 months ago
godotenvgodotenv

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

Stars10,548
Forks456
Last commit8 days ago
sonicsonic

A blazingly fast JSON serializing & deserializing library

Stars9,554
Forks464
Last commit1 month ago
envenv

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

Stars6,271
Forks281
Last commit17 days ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub