gin-gonic / gin
git clone https://github.com/gin-gonic/gin.git
v1.12.0 · 7mo ago
🔥 on GitHub Trending today
Gin is a high-performance HTTP web framework written in Go. It provides a Martini-like API but with significantly better performance—up to 40 times faster—thanks to httprouter. Gin is designed for building REST APIs, web applications, and microservices.
+19
stars, 24h · #316
—
stars, 7 days
—
stars, 30 days
89k
★ total
8.8k
forks · 806 open issues
Star history starts 2026-10-20; the chart appears after the second daily snapshot.
LanguageGo
LicenseMIT
Created2014-06-16 (12y ago)
Last push10d ago
Watchers1.4k
OwnerOrganization
Seen on GitHub Trending
- 2026-10-20 — #17 daily in go · +19 ★
GitHub topics
Links
- GitHub: github.com/gin-gonic/gin
- Homepage: https://gin-gonic.com/
- Releases · Issues · Hacker News mentions
README excerpt
# Gin Web Framework
## 📰 Gin 1.12.0 is now available!
We're excited to announce the release of **Gin 1.12.0**! This release brings new features, performance improvements, and important bug fixes. Check out the release announcement on our official blog for the full details.
---
Gin is a high-performance HTTP web framework written in Go. It provides a Martini-like API but with significantly better performance—up to 40 times faster—thanks to httprouter. Gin is designed for building REST APIs, web applications, and microservices where speed and developer productivity are essential.
**Why choose Gin?**
Gin combines the simplicity of Express.js-style routing with Go's performance characteristics, making it ideal for:
- Building high-throughput REST APIs
- Developing microservices that need to handle many concurrent requests
- Creating web applications that require fast response times
- Prototyping web services quickly with minimal boilerplate
**Gin's key features:**
- **Zero allocation router** - Extremely memory-efficient routing with no heap allocations
- **High performance** - Benchmarks show superior speed compared to other Go web frameworks
- **Middleware support** - Extensible middleware system for authentication, logging, CORS, etc.
- **Crash-free** - Built-in recovery middleware prevents panics from crashing your server
- **JSON validation** - Automatic request/response JSON binding and validation
- **Route grouping** - Organize related routes and apply common middleware
- **Error management** - Centralized error handling and logging
- **Built-in rendering** - Support for JSON, XML, HTML templates, and more
- **Extensible** - Large ecosystem of community middleware and plugins
## Getting Started
### Prerequisites
- **Go version**: Gin requires Go version 1.26 or above
- **Basic Go knowledge**: Familiarity with Go syntax and package management is helpful
### Installation
With Go's module support, simply import Gin in your code and Go will automatically fetch it during build:
[code]
### Your First Gin Application
Here's a complete example that demonstrates Gin's simplicity:
[code]
**Running the application:**
1. Save the code above as `main.go`
2. Run the application:
[code]
3. Open your browser and visit `http://localhost:8080/ping`
4. You should see: `{"message":"pong"}`
**What this example demonstrates:**
- Creating a Gin router with default middleware
- Defining HTTP endpoints with simple handler functions
- Returning JSON responses
- Starting an HTTP server
### Next Steps
After running your first Gin application, explore these resources to learn more:
#### 📚 Learning Resources
- **Gin Quick Start Guide** - Comprehensive tutorial with API examples and build configurations
- **Example Repository** - Ready-to-run examples demonstrating various Gin use cases:
- REST API development
- Authentication & middleware
- File uploads and downloads
- WebSocket connections
- Template rendering
## 📖 Documentation
### API Reference
- **Go.dev API