OSS TanbouSign in with GitHub

merge config files, environment variables, flags, and defaults with explicit precedence in Go

About these scores

OSS scale score is an unbounded metric that log-compresses and weights Stars, Watchers, Forks, and Contributors. Discovery score is the current OSS scale score minus the score at discovery. Update pace is commits in the last 30 days, growth momentum is the OSS scale score difference within the recent observation window, and OSS health is a 0–100 rating based on available recency, Community Health, and release data.

Stars
30,483
Primary language
Go
License
MIT
Repository last updated
Jan 12, 2026
On this page

Overview

Viper is a configuration library for Go applications. It combines JSON, TOML, YAML, HCL, INI, envfile, and Java properties files with environment variables, command-line flags, defaults, and remote key/value stores in one configuration registry.

Features and best fit

Based on official documentation; not hands-on tested · Content checked:

Key features

Read multiple configuration formats plus environment variables, flags, and defaults through one API

Viper can discover and read configuration files, unmarshal values, bind environment variables and pflag values, apply explicit Set calls and defaults, and optionally watch files for changes.

Sources: [2]

Resolve configuration sources through a documented precedence order

The precedence is explicit Set, flags, environment variables, config files, key/value stores, then defaults, enabling deployment-time overrides over file-based configuration.

Sources: [2]

Best fit

Fits CLIs and servers that assemble configuration from several sources

It is useful for Go command-line tools and backend services that combine local config files, environment variables, and flags while keeping format parsing and source resolution in one library.

Sources: [2]

Before adoption

v1.21.0 declares Go 1.23; keys are case-insensitive and Viper v2 is under discussion

The v1.21.0 go.mod declares Go 1.23. Viper keys are case-insensitive and a Viper instance generally handles one config file. Version 1.21.0 fixes config-type detection and adds BoolSlice, UintSlice, and Float64Slice flag support, while the README is collecting feedback for v2, so global behavior and upgrade assumptions should be pinned with tests.

Sources: [3][2][4]

Official sources

  1. [1]spf13/viper — GitHub repository(2026-10-06)
  2. [2]Viper v1.21.0 — README(2026-10-06)
  3. [3]Viper v1.21.0 — go.mod(2026-10-06)
  4. [4]Viper v1.21.0 release(2026-10-06)
  5. [5]Viper MIT license(2026-10-06)
Supplemental curator note

Viper can unify files, environment variables, flags, and defaults in one registry, but source precedence and case-insensitive keys become application-wide contracts. Prefer loading configuration at startup and unmarshalling into typed structs rather than spreading global lookups through the codebase.

Try it in 3 steps

  1. 1

    Get the source

    git clone --depth 1 https://github.com/spf13/viper.git
  2. 2

    Enter the repository

    cd viper
  3. 3

    Check the official steps

    Continue with the commands in the README Installation, Quick Start, or Getting Started section.

    find . -maxdepth 1 -iname 'README*' -exec sed -n '1,220p' {} \; -quit
Check the official README

Growth

Growth trends · Last 30 days

30,483 Stars

Trend data is still being collected.

Development activity

Last 90 days · weekly

Commits (last 30 days)
0
Open PRs
133

Development activity is still being collected.

Built with

Categories and tags

GitHub data

GitHub dataView detailed GitHub data
Stars
30,483
Forks
2,271
Watchers
272
Open issues
8
Contributors
170
Owner type
User
Primary language
Go
License
MIT
Repository last updated
Jan 12, 2026
Write a related article

Share a guide or use case for this OSS in Markdown. Articles are published after administrator approval.

Report incorrect information

Tell us if any listing information is incorrect or outdated.

After reading this page, do you know what to do next?