Repolode
gin-gonic

gin-gonic/gin

A high-performance HTTP web framework for Go with a Martini-like API, built for REST APIs, web apps and microservices.

Stars
89,394
Forks
8,777
Open issues
806
Last commit
11 days ago

What is it?

Gin is an HTTP web framework written in Go. It offers a Martini-like API and uses httprouter for routing, which the project describes as up to 40 times faster than Martini-style frameworks. It targets REST APIs, web applications and microservices.

The framework includes a zero-allocation router, middleware support for authentication, logging and CORS, and a recovery middleware that stops panics from crashing the server. Routes can be grouped to share middleware, and request bodies can be bound and validated as JSON. Responses can be rendered as JSON, XML or HTML templates.

Gin requires Go 1.26 or later and is installed with a standard Go module import. Documentation is available in several languages on gin-gonic.com, and the project maintains a companion examples repository and a middleware collection under gin-contrib.

Key features

  • 01Zero-allocation router built on httprouter-style routing
  • 02Martini-like API with route grouping
  • 03Middleware system for authentication, logging and CORS
  • 04Built-in recovery middleware that prevents panics from crashing the server
  • 05JSON request binding and validation, plus JSON, XML and HTML rendering

Use cases

  • Building high-throughput REST APIs in Go
  • Writing microservices that handle many concurrent requests
  • Prototyping web services with minimal boilerplate

Quick start

  1. 1

    Install Go 1.26 or later

  2. 2

    Import Gin in your code; Go fetches it during build

    import "github.com/gin-gonic/gin"
  3. 3

    Save the example as main.go and run it

    go run main.go
  4. 4

    Visit http://localhost:8080/ping to see the response

Things to know

  • Requires Go 1.26 or above.

Topics

FAQ

What is gin?
A high-performance HTTP web framework for Go with a Martini-like API, built for REST APIs, web apps and microservices. Gin is an HTTP web framework written in Go. It offers a Martini-like API and uses httprouter for routing, which the project describes as up to 40 times faster than Martini-style frameworks. It targets REST APIs, web applications and microservices.
Is gin free to use? What license does it have?
gin is open source under the MIT license. Check the license terms before using it in commercial products.
Is gin still maintained?
Actively maintained. The last commit to gin was on Oct 10, 2026.
What can I use gin for?
Building high-throughput REST APIs in Go Writing microservices that handle many concurrent requests Prototyping web services with minimal boilerplate
How do I install gin?
Install Go 1.26 or later Import Gin in your code; Go fetches it during build: import "github.com/gin-gonic/gin" Save the example as main.go and run it: go run main.go Visit http://localhost:8080/ping to see the response
Where can I get gin?
The source code and installation instructions are on GitHub: https://github.com/gin-gonic/gin

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects