GitRead 中文社区
首页趋势排行榜原创文章严选周刊
更多资源
新手训练营
精选专题热门话题GitHub 文档资源精选实战指南

fuego

Golang Fuego - Web framework generating OpenAPI 3 spec from source code - Pluggable to existing Gin & Echo APIs

  • 语言Go
  • 默认分支main
  • 大小12.4 MB
  • 更新3 天前
  • Issues14
在 GitHub 打开
avatargo-fuego

项目介绍

go-fuego/fuego 是一个托管在 GitHub 上的开源项目,主要使用 Go 编写,采用 MIT License 许可证,目前获得 1.8k 个 Star、126 次 Fork。

仓库全名
go-fuego/fuego

README 摘要

Fuego 🔥 The framework for busy Go developers 🚀 Explore and contribute to our 2025 Roadmap! 🚀 Production-ready Go API framework generating OpenAPI documentation from code. Inspired by Nest, built for Go developers. Also empowers templating with html/template, a-h/templ and maragudk/gomponents: see the example running live. Why Fuego? Chi, Gin, Fiber and Echo are great frameworks. But since they were designed a…

完整内容见 GitHub 原始 README 或本页 。

常见问题

fuego 用什么语言开发?

主要使用 Go 编写,采用 MIT License 许可证,目前有 1.8k 个 Star。

fuego 可以免费商用吗?

仓库采用 MIT License 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 fuego 的源码?

可以直接克隆仓库:git clone https://github.com/go-fuego/fuego.git,默认分支为 main;安装与运行步骤见仓库 README。

fuego 最近还在维护吗?

仓库最近一次更新为 3 天前,当前有 14 个未关闭 Issue;Star 数为 1.8k,可作为社区活跃度的参考。

本页面展示项目元数据与原始 README,GitRead 中文社区 编辑团队负责选题收录。

相关仓库

avelino/awesome-go avatar
awesome-goavelino
9 小时前
193.3k
13.3k
6

一份精选的 Go 框架、库和软件列表

golanggolang-librarygo+3
Go
12.8 MB
0
详情
ollama/ollama avatar
ollamaollama
1 小时前
186.7k
19.0k
4.6k

快速上手并运行 Kimi、GLM、MiniMax、DeepSeek、gpt-oss、Qwen、Gemma 及其他模型。

deepseekgemmaglm+11
Go
95.4 MB
1
详情
golang/go avatar
gogolang
14 小时前
139.8k
20.3k
9.9k

Go 编程语言

gogolanglanguage+1
Go
457.4 MB
0
详情
kubernetes/kubernetes avatar
kuberneteskubernetes
4 小时前
128.9k
45.1k
3.3k

生产级容器调度与管理

cncfcontainersgo+1
Go
1.5 GB
0
详情
JuliusBrussee/caveman avatar
cavemanJuliusBrussee
23 小时前
119.1k
6.9k
81

为什么几个 token 能搞定却要用很多 token。一个爆火的技能 + 编码代理的代理,像穴居人那样说话,可削减 65% 的 token。

aianthropiccaveman+7
Go
21.3 MB
0
详情
fatedier/frp avatar
frpfatedier
1 天前
110.5k
15.0k
34

一个快速的反向代理,帮助你将 NAT 或防火墙后的本地服务器暴露到互联网。

proxyreverse-proxytunnel+7
Go
32.4 MB
0
详情
infiniflow/ragflow avatar
ragflowinfiniflow
6 小时前
94.0k
11.3k
1.3k

RAGFlow 是一款领先的开源检索增强生成(RAG)引擎,将前沿 RAG 与 Agent 能力融合,为 LLM 构建卓越的上下文层

agent-harnessagent-native-databaseagentic-ai+13
Go
188.0 MB
0
详情
gohugoio/hugo avatar
hugogohugoio
1 小时前
90.5k
8.3k
176

世界上用于构建网站的最快框架。

gohugostatic-site-generator+4
Go
150.3 MB
0
详情

关于

echofuegogin-gonicgolanghttp-serveropenapiopenapi3
  • MIT License
  • 1.8k Stars
  • 126 Forks
  • 9 Watching

简要分析

热度分
2037
价值分
1103
活跃状态
活跃
GitHub

语言占比

Go
Makefile
Shell

Release

  • v0.18.0: Echo+Gin compatibility and many more2025年2月5日
  • v0.17.0: 🎄 Experimental Gin support2024年12月24日
  • v0.16.2: More options, Error with detail, preparing for gin compatibility2024年12月14日
  • v0.16.1: Composable Options everywhere!2024年12月7日
  • v0.15.0: Variadic options2024年11月21日

贡献者

EwenQuimEwenQuimdylanhittdylanhittdependabot[bot]dependabot[bot]rizerkrofrizerkrofHinne1Hinne1ccoVeilleccoVeillehugoleborsohugoleborsoJeremie-ChauvelJeremie-Chauvelsimonemastellasimonemastella0-don0-donevilenzoevilenzojwtly10jwtly10

Fuego Logo

Fuego 🔥

Go Reference Go Report Card Coverage Status CodSpeed Badge Discord Gophers

The framework for busy Go developers

🚀 Explore and contribute to our 2025 Roadmap! 🚀

Production-ready Go API framework generating OpenAPI documentation from code. Inspired by Nest, built for Go developers.

Also empowers templating with html/template, a-h/templ and maragudk/gomponents: see the example running live.

Why Fuego?

Chi, Gin, Fiber and Echo are great frameworks. But since they were designed a long time ago, their current API does not allow them to deduce OpenAPI types from signatures, things that are now possible with generics. Fuego offers a lot of “modern Go based” features that make it easy to develop APIs and web applications.

Features

  • OpenAPI: Fuego automatically generates OpenAPI documentation from code - not from comments nor YAML files!
  • 100% net/http compatible (no lock-in): Fuego is built on top of net/http, so you can use any http.Handler middleware or handler! Fuego also supports log/slog, context and html/template.
  • Routing: Fuego router is based on Go 1.22 net/http, with grouping and middleware support
  • Serialization/Deserialization: Fuego automatically serializes and deserializes JSON, XML and HTML Forms based on user-provided structs (or not, if you want to do it yourself)
  • Validation: Fuego provides a simple and fast validator based on go-playground/validator
  • Transformation: easily transform your data by implementing the fuego.InTransform and fuego.OutTransform interfaces - also useful for custom validation
  • Middlewares: easily add a custom net/http middleware or use the provided middlewares.
  • Error handling: Fuego provides centralized error handling with the standard RFC 9457.
  • Rendering: Fuego provides a simple and fast rendering system based on html/template - you can still also use your own template system like templ or gomponents
  • Adaptors: Fuego can be plugged to an existing Gin or Echo server to generate OpenAPI documentation

Examples

Hello World

package main

import "github.com/go-fuego/fuego"

func main() {
	s := fuego.NewServer()

	fuego.Get(s, "/", func(c fuego.ContextNoBody) (string, error) {
		return "Hello, World!", nil
	})

	s.Run()
}

Simple POST

package main

import "github.com/go-fuego/fuego"

type MyInput struct {
	Name string `json:"name" validate:"required"`
}

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

func main() {
	s := fuego.NewServer()

	// Automatically generates OpenAPI documentation for this route
	fuego.Post(s, "/user/{user}", myController)

	s.Run()
}

func myController(c fuego.ContextWithBody[MyInput]) (*MyOutput, error) {
	body, err := c.Body()
	if err != nil {
		return nil, err
	}

	return &MyOutput{Message: "Hello, " + body.Name}, nil
}

With transformation & custom validation

type MyInput struct {
	Name string `json:"name" validate:"required"`
}

// Will be called just before returning c.Body()
func (r *MyInput) InTransform(context.Context) error {
	r.Name = strings.ToLower(r.Name)

	if r.Name == "fuego" {
		return errors.New("fuego is not a valid name for this input")
	}

	return nil
}

More OpenAPI documentation

package main

import (
	"github.com/go-fuego/fuego"
	"github.com/go-fuego/fuego/option"
	"github.com/go-fuego/fuego/param"
)

func main() {
	s := fuego.NewServer()

	// Custom OpenAPI options
	fuego.Post(s, "/", myController,
		option.Description("This route does something..."),
		option.Summary("This is my summary"),
		option.Tags("MyTag"), // A tag is set by default according to the return type (can be deactivated)
		option.Deprecated(),  // Marks the route as deprecated in the OpenAPI spec

		option.Query("name", "Declares a query parameter with default value", param.Default("Carmack")),
		option.Header("Authorization", "Bearer token", param.Required()),
		optionPagination,
		optionCustomBehavior,
	)

	s.Run()
}

var optionPagination = option.Group(
	option.QueryInt("page", "Page number", param.Default(1), param.Example("1st page", 1), param.Example("42nd page", 42)),
	option.QueryInt("perPage", "Number of items per page"),
)

var optionCustomBehavior = func(r *fuego.BaseRoute) {
	r.XXX = "YYY"
}

Std lib compatibility

package main

import (
	"net/http"

	"github.com/go-fuego/fuego"
)

func main() {
	s := fuego.NewServer()

	// Standard net/http middleware
	fuego.Use(s, func(next http.Handler) http.Handler {
		return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
			w.Header().Set("X-Hello", "World")
			next.ServeHTTP(w, r)
		})
	})

	// Standard net/http handler with automatic OpenAPI route declaration
	fuego.GetStd(s, "/std", func(w http.ResponseWriter, r *http.Request) {
		w.Write([]byte("Hello, World!"))
	})

	s.Run()
}

Real-world examples

Please see the /examples folder for more examples.

  • Simple CRUD with OpenAPI
  • Full app with HTML rendering
All features
package main

import (
	"context"
	"errors"
	"net/http"
	"strings"

	chiMiddleware "github.com/go-chi/chi/v5/middleware"
	"github.com/go-fuego/fuego"
	"github.com/rs/cors"
)

type Received struct {
	Name string `json:"name" validate:"required"`
}

type MyResponse struct {
	Message       string `json:"message"`
	BestFramework string `json:"best"`
}

func main() {
	s := fuego.NewServer(
		fuego.WithAddr("localhost:8088"),
	)

	fuego.Use(s, cors.Default().Handler)
	fuego.Use(s, chiMiddleware.Compress(5, "text/html", "text/css"))

	// Fuego 🔥 handler with automatic OpenAPI generation, validation, (de)serialization and error handling
	fuego.Post(s, "/", func(c fuego.ContextWithBody[Received]) (MyResponse, error) {
		data, err := c.Body()
		if err != nil {
			return MyResponse{}, err
		}

		c.Response().Header().Set("X-Hello", "World")

		return MyResponse{
			Message:       "Hello, " + data.Name,
			BestFramework: "Fuego!",
		}, nil
	})

	// Standard net/http handler with automatic OpenAPI route declaration
	fuego.GetStd(s, "/std", func(w http.ResponseWriter, r *http.Request) {
		w.Write([]byte("Hello, World!"))
	})

	s.Run()
}

// InTransform will be called when using c.Body().
// It can be used to transform the entity and raise custom errors
func (r *Received) InTransform(context.Context) error {
	r.Name = strings.ToLower(r.Name)
	if r.Name == "fuego" {
		return errors.New("fuego is not a name")
	}
	return nil
}

// OutTransform will be called before sending data
func (r *MyResponse) OutTransform(context.Context) error {
	r.Message = strings.ToUpper(r.Message)
	return nil
}
curl http://localhost:8088/std
# Hello, World!
curl http://localhost:8088 -X POST -d '{"name": "Your Name"}' -H 'Content-Type: application/json'
# {"message":"HELLO, YOUR NAME","best":"Fuego!"}
curl http://localhost:8088 -X POST -d '{"name": "Fuego"}' -H 'Content-Type: application/json'
# {"error":"cannot transform request body: cannot transform request body: fuego is not a name"}

From net/http to Fuego in 10s

https://github.com/go-fuego/fuego/assets/46993939/7438a71c-75a4-4e88-a584-71da6362c575

Views

Before

image
After
image
Diff
image
Benefits of using Fuego views (controllers returning HTML)
  • Never forget to return after an error
  • OpenAPI schema generated, listing all the routes
  • Deserialization and validation are easier
  • Transition to Fuego is easy and fast

Contributing

See the contributing guide. Thanks to everyone who has contributed to this project! ❤️

Graph of contributors

Made with contrib.rocks

Roadmap

See the board.

Disclaimer for experienced gophers

I know you might prefer to use net/http directly, but if having a frame can convince my company to use Go instead of Node, I’m happy to use it.

License

MIT

评论

登录 后发表评论
暂无评论
GitRead 中文社区
深度解读 · 趋势洞察 · 价值精选

关于

关于我们联系我们编辑准则收录标准赞赏人员

发现

技术趋势新手训练营资源精选实战指南精选专题热门话题GitHub 文档

条款

隐私政策服务条款网站地图
26.9万收录项目
6.4万中文话题
155精选专题
发现技术价值,连接开源智慧
© 2026 GitRead · GitHub 中文社区 本站与 GitHub, Inc. 无隶属关系;GitHub 是 GitHub, Inc. 的商标。