gofr README

The project's README from github.com/gofr-dev/gofr. As one markdown file: README.md.

GoFr

logo

GoFr: An Opinionated Microservice Development Framework

godoc gofr-docs Maintainability Code Coverage Go Report Card Apache 2.0 License discord

Listed in the CNCF Landscape

🎯 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

Installation

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

import "gofr.dev/pkg/gofr"

Alternatively, use the command:

go get -u gofr.dev/pkg/gofr

🏃 Running GoFr

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

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:

$ 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

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

Cloning with SSH

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

JetBrains logo

gofr (gofr-dev/gofr)

Searching Database…

20.8K ·GitHub
What is this?An opinionated Go framework for building microservices fast — database support and observability (logs, traces, metrics) come built in, so you write service code instead of infrastructure glue.
Is GoFr a framework my whole service is built on, or a library I call here and there?A framework, and a deliberately opinionated one: you structure the service around GoFr's APIs, and it takes over routing, config, middleware, datasources and observability for you.
How do I get my first service running?Install Go 1.26 or above, add the GoFr import to your code — Go modules fetches the dependency automatically — then run the sample app and open localhost:8000/greet to see the result.
Do I need to install anything else besides Go?No separate installs: databases and pub/sub systems plug in through GoFr's built-in datasource integrations, and each datasource gets an automatic health check.
What's the trade-off with an opinionated framework like this?You accept its conventions and defaults rather than assembling your own stack, and while generic applications are possible, GoFr is really tuned for microservices.
Who is GoFr meant for?Go developers building microservices, especially ones deployed on Kubernetes, who want logging, tracing and metrics wired up from the first line of code.
Where can I run services built with it?The README sets no OS limits: as Go source it compiles wherever Go runs — a laptop for development, a Linux server or container in production.
What does it give me out of the box beyond URL routing?Quite a lot: REST standards by default, config management, logs/traces/metrics, built-in auth plus custom middleware, gRPC, an HTTP circuit breaker, pub/sub, database migrations, cron jobs, Swagger rendering, websockets and abstracted file systems — and log levels can be changed without a restart.
Why an opinionated framework instead of assembling Go libraries yourself?The stated goal is to simplify microservice development: instead of wiring logging, tracing, metrics, config and database clients by hand, GoFr bundles them with sane defaults so a service is Kubernetes-ready and observable from day one.
How mature and active is the project?It's an established open-source project (Apache-2.0) started in October 2023 with roughly 20.9k GitHub stars, actively developed and taking part in Hacktoberfest to onboard contributors.
Where can I see working example code and documentation?The repo has an examples directory with ready-to-run samples, plus GoDoc for the API reference and a dedicated GoFr documentation site with comprehensive guides.
What are similar projects?gf, kratos, go-zero, serve, encore, traefik, echo, apisix
Creator
gofr-dev
Size
30.7 MB
Stars
20.8K
Age
2y
Commits · 90 Days