viper VS Gin

Compare viper vs Gin and see what are their differences.

viper

Go configuration with fangs (by spf13)

Gin

Gin is a HTTP web framework written in Go (Golang). It features a Martini-like API with much better performance -- up to 40 times faster. If you need smashing performance, get yourself some Gin. (by gin-gonic)
Our great sponsors
  • SonarLint - Clean code begins in your IDE with SonarLint
  • Mergify - Updating dependencies is time-consuming.
  • InfluxDB - Collect and Analyze Billions of Data Points in Real Time
viper Gin
69 145
24,110 71,684
- 1.9%
8.4 8.0
3 days ago 3 days ago
Go Go
MIT License MIT License
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.

viper

Posts with mentions or reviews of viper. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2023-09-27.
  • Building RESTful API with Hexagonal Architecture in Go
    21 projects | dev.to | 27 Sep 2023
    Instead of directly accessing environment variables with os.Getenv(), integrating a configuration handler like viper might make it maintainable.
  • What is the most common approach to configure a backend app?
    4 projects | /r/golang | 5 Jun 2023
    I guess most people are using https://github.com/spf13/viper but I don't know if I should read everything from
  • Could I get a code review?
    11 projects | /r/golang | 1 Jun 2023
    Use Viper for config file or environmental variable configuration -- it's going to save you a whole lot of time.
  • Which packages do you recommend for building cli tools?
    10 projects | /r/golang | 17 Apr 2023
    Cobra and Viper.
  • Library for Python similar to Go's Viper / 12 Factor
    2 projects | /r/learnpython | 5 Apr 2023
    I've mostly been using https://github.com/spf13/viper of late for my go projects. It supports the standard config formats, (json, yaml, toml etc) and lets you override any value with a ENV value.
  • Two ways to provide configuration: command-line, yaml file.
    3 projects | /r/golang | 30 Mar 2023
    Not only that, the "unmarshall to struct" method doesn't work at all for environment variables. https://github.com/spf13/viper/issues/188
  • Tools besides Go for a newbie
    36 projects | /r/golang | 26 Mar 2023
    IDE: use whatever make you productive. I personally use vscode. VCS: git, as golang communities use github heavily as base for many libraries. AFAIK Linter: use staticcheck for linting as it looks like mostly used linting tool in go, supported by many also. In Vscode it will be recommended once you install go plugin. Libraries/Framework: actually the standard libraries already included many things you need, decent enough for your day-to-day development cycles(e.g. `net/http`). But here are things for extra: - Struct fields validator: validator - Http server lib: chi router , httprouter , fasthttp (for non standard http implementations, but fast) - Web Framework: echo , gin , fiber , beego , etc - Http client lib: most already covered by stdlib(net/http), so you rarely need extra lib for this, but if you really need some are: resty - CLI: cobra - Config: godotenv , viper - DB Drivers: sqlx , postgre , sqlite , mysql - nosql: redis , mongodb , elasticsearch - ORM: gorm , entgo , sqlc(codegen) - JS Transpiler: gopherjs - GUI: fyne - grpc: grpc - logging: zerolog - test: testify , gomock , dockertest - and many others you can find here
  • Ultimate config for Go applications
    3 projects | /r/golang | 24 Mar 2023
    Is this sufficiently better than https://github.com/spf13/viper to warrant a switch?
  • [QUESTION] - How would I Read from multiple config files and environment variables?
    2 projects | /r/golang | 15 Mar 2023
    I'm using https://github.com/spf13/viper for configuration manager.
    2 projects | /r/golang | 15 Mar 2023
    Ya, I think this issue explains one of the problems: https://github.com/spf13/viper/issues/761

Gin

Posts with mentions or reviews of Gin. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2023-09-27.
  • Building RESTful API with Hexagonal Architecture in Go
    21 projects | dev.to | 27 Sep 2023
    For building the RESTful Point of Sale service API, I've considered and selected a combination of technologies that would work seamlessly together. For handling HTTP requests and responses, using the Gin HTTP web framework would make sense because I think it seems complete and popular among Go community too. To ensure data integrity and persistence, I'm using PostgreSQL database with pgx as the database driver, the reason I choose PostgreSQL because it is the most popular relational database to use in production and offers efficient Go integration. I'm also implementing caching using Redis with go-redis client library, which provides powerful in-memory data storage capabilities.
    21 projects | dev.to | 27 Sep 2023
    It uses Gin as the HTTP framework and PostgreSQL as the database with pgx as the driver and Squirrel as the query builder. It also utilizes Redis as the caching layer with go-redis as the client.
  • Different CORS settings for different paths?
    5 projects | /r/golang | 6 Sep 2023
    I have created an application with Go in Gin-Gonic. In my frontend (Nuxt3/TypeScript) I always get a CORS error:
  • Rapid Prototyping of Design-First APIs in Go
    3 projects | dev.to | 20 Aug 2023
    We use Gin web framework https://gin-gonic.com for the routing, Gin provides a balance between performance, ease of use and extensibility making it a preferred choice for building and running web applications in Go.
  • Goravel, Web framework inspired from Laravel in Golang
    5 projects | news.ycombinator.com | 5 Jul 2023
    That's not a problem with Go, it's a problem with frameworks: they give you some abstractions, e.g. the Laravel query builder, but they don't cover all the use cases, so you quickly find yourself using "raw" queries anyway.

    There are some well-established web frameworks for Go (e.g. https://github.com/gin-gonic/gin), but they are controversial too, as most Go developers seem to prefer libraries (that your code calls) instead of frameworks (that call your code and impose their structure upon it). So I don't think just cramming a framework from a completely different language into Go will fly...

  • 30 Best Web Development Frameworks for 2023: A Comprehensive Guide
    5 projects | dev.to | 4 Jul 2023
    Gin
  • PHP to Golang
    9 projects | /r/golang | 3 Jun 2023
  • Could I get a code review?
    11 projects | /r/golang | 1 Jun 2023
    Use a library for HTTP serving, such as Gin, Chi, or Echo. I personally use Chi, as it's just the right level of abstraction for how I like to work. Despite what others say here, don't try to re-implement everything in a modern serving library using the standard library.
  • From Golang Beginner to Building Basic Web Server in 4 Days!
    5 projects | /r/golang | 21 May 2023
    For building my web server, I chose to use the Gin framework as the foundation of my app. It was incredibly easy to understand and work with, and I was pleasantly surprised by how seamlessly it integrated with writing unit tests for the server. To handle the database, I leveraged the power of go-sqlite and migrate for efficient SQL queries and migrations. These libraries proved to be both powerful and user-friendly, making the development process a breeze.
  • Dumb question about APIs, Mux and Go
    3 projects | /r/learngolang | 27 Apr 2023
    Popular with a ton of features: https://gin-gonic.com/

What are some alternatives?

When comparing viper and Gin you can also consider the following projects:

Fiber - ⚡️ Express inspired web framework written in Go

mux - A powerful HTTP router and URL matcher for building Go web servers with 🦍

Echo - High performance, minimalist Go web framework

chi - lightweight, idiomatic and composable router for building Go HTTP services

Beego - beego is an open-source, high-performance web framework for the Go programming language.

Iris - The fastest HTTP/2 Go Web Framework. New, modern and easy to learn. Fast development with Code you control. Unbeatable cost-performance ratio :rocket:

go-kit - A standard library for microservices.

Revel - A high productivity, full-stack web framework for the Go language.

fasthttp - Fast HTTP package for Go. Tuned for high performance. Zero memory allocations in hot paths. Up to 10x faster than net/http

fasthttprouter - A high performance fasthttp request router that scales well

httprouter - A high performance HTTP request router that scales well

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