GoFr

一个用于加速微服务开发的有主见的 GoLang 框架。内置对数据库和可观察性的支持。「An opinionated GoLang framework for accelerated microservice development. Built in support for databases and observability.」

Github星跟踪图

Listed in CNCF Landscape.

🎯 Goal

Even though generic applications can be written using GoFr, our main focus is to simplify the development of microservices.
We will focus on deployment in Kubernetes and aspire to provide out-of-the-box observability.

💡 Key Features

  1. Simple API syntax
  2. REST Standards by default
  3. Configuration management
  4. Observability (Logs, Traces, Metrics)
  5. Inbuilt Auth Middleware & Support for Custom Middleware
  6. gRPC support
  7. HTTP service with support for Circuit Breaker
  8. Pub/Sub
  9. Health Check by default for all datasources.
  10. Database Migration
  11. Cron Jobs
  12. Support for changing Log Level without restarting the application.
  13. Swagger Rendering
  14. Abstracted File Systems
  15. Websockets

banner.gif

Getting started

Prerequisites

GoFr requires Go version 1.21 or above.

Getting GoFr

With Go's module support, go [build|run|test] automatically fetches the necessary dependencies when you add the import in your code:

import "gofr.dev/pkg/gofr"

Alternatively, use go get:

go get -u gofr.dev/pkg/gofr

Running GoFr

A basic example:

package main

import "gofr.dev/pkg/gofr"

func main() {
    app := gofr.New()

    app.GET("/greet", func(ctx *gofr.Context) (interface{}, error) {

        return "Hello World!", nil
    })

   app.Run() // listen and serve on localhost:8000 
}

To run the code, use the go run command, like:

$ go run main.go

Then visit localhost:8000/greet in your browser to see the response!

See more examples

A number of ready-to-run examples demonstrating various use cases of GoFr are available in the GoFr examples directory.

👩‍💻Documentation

See the godocs.

The documentation is also available on gofr.dev.

👍 Contribute

If you want to say thank you and/or support the active development of GoFr:

  1. Star the repo.
  2. Write a review or tutorial on Medium, Dev.to or personal blog.
  3. Visit CONTRIBUTING for details on submitting patches and the contribution workflow.

If your PR is merged or you have written an article or contributed in someway to development or spreading the word about GoFr, fill the Google Form, and we will send you a GoFr T-Shirt and Stickers as a token of appreciation.

主要指标

概览
名称与所有者gofr-dev/gofr
主编程语言Go
编程语言 (语言数: 4)
平台
许可证Apache License 2.0
所有者活动
创建于2023-10-24 10:14:48
推送于2025-04-24 15:46:48
最后一次提交
发布数101
最新版本名称v1.38.0 (发布于 2025-04-24 21:10:36)
第一版名称v0.0.1 (发布于 )
用户参与
星数9.5k
关注者数30
派生数1.7k
提交数2k
已启用问题?
问题数419
打开的问题数49
拉请求数954
打开的拉请求数5
关闭的拉请求数265
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?