/gofr

An opinionated GoLang framework for accelerated microservice development. Built in support for databases and observability.

Primary LanguageGoApache License 2.0Apache-2.0

logo

GoFr is an opinionated microservice development framework.

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.