Back to Gofr

README

README.md

1.56.45.4 KB
Original Source
<div align="center"> <h1 style="font-size: 100px; font-weight: 500;"> <i>Go</i>Fr </h1> <div align="center"> <p> <h2 style="font-size: 28px;"><b>GoFr: An Opinionated Microservice Development Framework</b></h2> </p> <a href="https://pkg.go.dev/gofr.dev"></a> <a href="https://gofr.dev/docs"></a> <a href="https://qlty.sh/gh/gofr-dev/projects/gofr"></a> <a href="https://qlty.sh/gh/gofr-dev/projects/gofr"></a> <a href="https://goreportcard.com/report/gofr.dev"></a> <a href="https://opensource.org/licenses/Apache-2.0"></a> <a href="https://discord.gg/wsaSkQTdgq"></a> <a href="https://gurubase.io/g/gofr"></a> </div> <h2>Listed in the <a href="https://landscape.cncf.io/?selected=go-fr">CNCF Landscape</a></h2> </div>

🎯 Goal

GoFr is designed to simplify microservice development, with a key focus on Kubernetes deployment and out-of-the-box observability. While capable of building generic applications, microservices remain at its core.


💡 Key Features

  1. Simple API Syntax
  2. REST Standards by Default
  3. Configuration Management
  4. Observability (Logs, Traces, Metrics)
  5. Inbuilt Auth Middleware & Custom Middleware Support
  6. gRPC Support
  7. HTTP Service with Circuit Breaker Support
  8. Pub/Sub
  9. Health Check for All Datasources
  10. Database Migration
  11. Cron Jobs
  12. Support for Changing Log Level Without Restarting
  13. Swagger Rendering
  14. Abstracted File Systems
  15. Websockets

🚀 Getting Started

Prerequisites

  • GoFr requires Go version 1.24 or above.

Installation

To get started with GoFr, add the following import to your code and use Go’s module support to automatically fetch dependencies:

go
import "gofr.dev/pkg/gofr"

Alternatively, use the command:

bash
go get -u gofr.dev/pkg/gofr

🏃 Running GoFr

Here's a simple example to get a GoFr application up and running:

go
package main

import "gofr.dev/pkg/gofr"

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

	app.GET("/greet", func(ctx *gofr.Context) (any, error) {
		return "Hello World!", nil
	})

	app.Run() // listens and serves on localhost:8000
}

To run this code:

bash
$ go run main.go

Visit localhost:8000/greet to see the result.


📂 More Examples

Explore a variety of ready-to-run examples in the GoFr examples directory.


👩‍💻 Documentation


👍 Contribute

Join Us in Making GoFr Better

Share your experience: If you’ve found GoFr helpful, consider writing a review or tutorial on platforms like Medium, Dev.to, or your personal blog. Your insights could help others get started faster!

Contribute to the project: Want to get involved? Check out our CONTRIBUTING.md guide to learn how you can contribute code, suggest improvements, or report issues.


🔒 Secure Cloning

To securely clone the GoFr repository, you can use HTTPS or SSH:

Cloning with HTTPS

bash
git clone https://github.com/gofr-dev/gofr.git

Cloning with SSH

bash
git clone [email protected]:gofr-dev/gofr.git

🎁 Get a GoFr T-Shirt & Stickers!

If your PR is merged, or if you contribute by writing articles or promoting GoFr, we invite you to fill out this form to claim your GoFr merchandise as a token of our appreciation!

Partners