GoFr is an opinionated microservice development framework.
Listed in CNCF Landscape.
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.
- Simple API syntax
- REST Standards by default
- Configuration management
- Observability (Logs, Traces, Metrics)
- Inbuilt Auth Middleware & Support for Custom Middleware
- gRPC support
- HTTP service with support for Circuit Breaker
- Pub/Sub
- Health Check by default for all datasources.
- Database Migration
- Cron Jobs
- Support for changing Log Level without restarting the application.
- Swagger Rendering
- Abstracted File Systems
- Websockets
GoFr requires Go version 1.21 or above.
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
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!
A number of ready-to-run examples demonstrating various use cases of GoFr are available in the GoFr examples directory.
See the godocs.
The documentation is also available on gofr.dev.
If you want to say thank you and/or support the active development of GoFr:
- Star the repo.
- Write a review or tutorial on Medium, Dev.to or personal blog.
- 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.