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.
Official sources
- [1]spf13/viper — GitHub repository(2026-10-06)
- [2]Viper v1.21.0 — README(2026-10-06)
- [3]Viper v1.21.0 — go.mod(2026-10-06)
- [4]Viper v1.21.0 release(2026-10-06)
- [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
Get the source
git clone --depth 1 https://github.com/spf13/viper.git - 2
Enter the repository
cd viper - 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
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
Categories
GitHub data
GitHub dataView detailed GitHub data
Related information
Write a related articleShare a guide or use case for this OSS in Markdown. Articles are published after administrator approval.
Explore next
- minikube32,180 Stars
1 shared tag(s) · 1 shared category(s) · Same language
create a workstation Kubernetes cluster for pre-deployment testing
Go - OpenTofu30,393 Stars
1 shared tag(s) · 1 shared category(s) · Same language
review declarative infrastructure changes with a plan before applying them
Go - Helm30,309 Stars
1 shared tag(s) · 1 shared category(s) · Same language
package Kubernetes applications as Charts and manage install, upgrade, and rollback as releases
Go - Gitleaks29,723 Stars
1 shared tag(s) · 1 shared category(s) · Same language
detect passwords, API keys, tokens, and other secrets in Git history, files, directories, and stdin
Go - Kustomize12,178 Stars
2 shared tag(s) · 1 shared category(s) · Same language
Declaratively layer environment-specific changes while keeping original Kubernetes YAML intact
Go - Lazygit82,894 Stars
1 shared tag(s) · 2 shared category(s) · Same language
Bring staging, commits, branches, rebases, worktrees, and reflog operations into a keyboard-driven terminal Git UI
Go
Report incorrect information
Tell us if any listing information is incorrect or outdated.