New Go framework gaining momentum: what developers need to know

Online Python Trainer for Beginners

Learn Python easily without overwhelming theory. Solve practical tasks with automatic checking, get hints in Russian, and write code directly in your browser — no installation required.

Start Course

New Go (Golang) framework gaining popularity: overview and prospects



The Go (Golang) ecosystem continues to actively develop, and in 2024 the community has turned its attention to a new framework that promises to change the approach to building web applications. Despite the fact that Go is traditionally renowned for its simplicity and built-in standard library, the need for more structured solutions for microservices and REST APIs has led to the emergence of several frameworks. The latest one — Huma — is rapidly gaining stars on GitHub and attracting the attention of both beginners and experienced developers.



What is Huma and how is it different?



Huma is a modern HTTP framework for Go, focused on creating APIs with automatic generation of OpenAPI (Swagger) specifications. Unlike classic solutions such as Gin or Echo, Huma is focused on strong typing and declarative endpoint description.



Main features of the framework:



  • Automatic documentation — just describe the data structures, and Huma will independently generate a complete OpenAPI 3.1 specification.
  • Type-level validation — all incoming and outgoing data is validated at compile time and runtime.
  • Middleware support — easily integrates with existing libraries for logging, authentication, and CORS.
  • Lightweight — the framework does not impose heavy dependencies and works practically with the standard net/http.


Why is this important for the Go community?



Go (Golang) is often chosen for high-load systems and microservice architecture. However, until recently, developers were forced to manually write documentation or use cumbersome generators. Huma solves this problem: the code becomes self-documenting, which is especially valuable in teamwork and when maintaining legacy projects.



Additionally, the framework actively uses the capabilities of generics, added in Go 1.18. This allows writing more flexible and reusable components without sacrificing performance.



Basic usage example



To create a simple endpoint in Huma, just a few lines of code are enough:



package main

import ( "github.com/danielgtaylor/huma/v2" "github.com/danielgtaylor/huma/v2/adapters/humachi")

type GreetingInput struct { Name string `path:"name" maxLength:"50"`}

type GreetingOutput struct { Message string `json:"message"`}

func main() { app := humachi.NewRouter() huma.Get(app, "/greeting/{name}", func(ctx huma.Context, input *GreetingInput) (*GreetingOutput, error) { return &GreetingOutput{Message: "Hello, " + input.Name + "!"}, nil }) app.Run()}


As can be seen from the example, the developer does not need to write separate code for validation or documentation generation — everything happens automatically based on annotated structures.



Prospects and criticism



Currently, Huma is in active development, but has already received support from large commercial projects. The community notes that the framework could become the de facto standard for creating APIs in Go if its team continues to improve documentation and stability.



However, there are also critical remarks: some developers believe that Huma unnecessarily complicates simple tasks, and its magic with automatic generation can lead to unexpected errors in complex scenarios.



Z

Recommended Libraries