Skip to content

Introduction

Fox is a powerful web framework built on top of Gin, providing automatic parameter binding, flexible response rendering, and enhanced features while maintaining full Gin compatibility.

Fox extends Gin with modern conveniences that reduce boilerplate code and improve developer productivity. It automatically handles common tasks like:

  • Parameter binding from URI paths, query strings, and JSON bodies
  • Response rendering with automatic serialization
  • Request validation through struct tags and custom validators
  • Structured logging with TraceID and contextual fields

With Fox, you can write handlers that focus purely on business logic:

// Traditional Gin handler
func CreateUser(c *gin.Context) {
var req UserRequest
if err := c.ShouldBindJSON(&req); err != nil {
c.JSON(400, gin.H{"error": err.Error()})
return
}
// Business logic...
c.JSON(200, gin.H{"message": "success"})
}
// Fox handler - cleaner and more focused
func CreateUser(req *UserRequest) (any, error) {
// Business logic only
return map[string]string{"message": "success"}, nil
}

Fox is 100% compatible with Gin. You can:

  • Use any existing Gin middleware
  • Mix Fox and Gin handlers in the same application
  • Gradually migrate from Gin to Fox
  • Access the underlying gin.Context when needed

Fox includes production-ready features:

  • Multi-domain routing for microservices
  • Structured logging with rotation
  • Graceful error handling
  • High performance with minimal overhead

Fox is ideal for:

  • Building REST APIs with many endpoints
  • Projects that need automatic parameter validation
  • Applications requiring clean, maintainable handler code
  • Systems handling JSON request/response bodies