# Viper

> Configuration for Go applications from files, environment variables, flags and remote stores

Source: https://talira.ai/catalog/viper-mtps383e
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: Library
- Categories: [libraries / configuration](https://talira.ai/categories/libraries/configuration), [languages / go](https://talira.ai/categories/languages/go)
- Licence: MIT[^1]
- Pricing: Free and open source[^1]
- Pricing notes: Free and open source under the MIT licence.
- Free tier: yes[^1]
- Backed by: [Steve Francia](https://talira.ai/orgs/spf13.md)

Viper is a configuration library for Go applications, including 12-factor apps. It reads settings from JSON, TOML, YAML, INI, envfile and Java properties files (finding them across several locations), environment variables, command-line flags, buffers and remote key/value stores such as etcd and Consul, applies defaults and explicit overrides in a fixed order of precedence, and can watch a config file and reload it live. It pairs with [Cobra](https://talira.ai/catalog/cobra-f5ka9qes.md) for flags, and supports key aliases and unmarshalling into structs. Its README names Hugo, doctl, Docker Notary, Coder and Vitess among the projects built with it. A v2 is being planned.

## Links

- GitHub: https://github.com/spf13/viper
- Docs: https://pkg.go.dev/github.com/spf13/viper

## Problems it solves

- load my Go service's settings from a config file but let environment variables override them in production
- read config from YAML, TOML or JSON in Go without writing my own parsing and merging code
- reload configuration when the file changes without restarting the Go process
- combine command-line flags, environment variables and a config file with a clear order of precedence in a Go CLI

## Features

- reads JSON, TOML, YAML, INI, envfile and Java properties config files
- finds config files across multiple search paths
- environment variable binding with prefixes
- command-line flag binding, including Cobra and pflag
- remote key/value stores such as etcd and Consul
- defaults and explicit overrides with a fixed precedence order
- watches config files and reloads them live
- key aliases for refactoring
- unmarshals configuration into Go structs

## Trust

Overall: 0.41 out of 1.
Signals: maintenance 0.06, adoption 0.90, momentum 0.70, community 0.91, backing 0.30, extensibility 0.00.

- latest release v1.21.0 14 months ago
- 30.5k GitHub stars
- 191 contributors
- backed by Steve Francia

Warnings:

- last commit 13 months ago

## Alternatives

- [godotenv](https://talira.ai/catalog/godotenv-1xnh3749.md): Loads environment variables from .env files in Go

## Sources

[^1]: https://github.com/spf13/viper/blob/master/LICENSE (checked 24 Nov 2026)
