gofr.dev

module
v1.24.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 22, 2024 License: Apache-2.0

README

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.

Directories

Path Synopsis
cli
gofr Module
examples
pkg
gofr/container
Package container provides a centralized structure to manage common application-level concerns such as logging, connection pools, and service management.
Package container provides a centralized structure to manage common application-level concerns such as logging, connection pools, and service management.
gofr/datasource/file
Package file is a generated GoMock package.
Package file is a generated GoMock package.
gofr/datasource/pubsub
Package pubsub provides a foundation for implementing pub/sub clients for various message brokers such as google pub-sub, kafka and MQTT.
Package pubsub provides a foundation for implementing pub/sub clients for various message brokers such as google pub-sub, kafka and MQTT.
gofr/datasource/pubsub/google
Package google provides a client for interacting with Google Cloud Pub/Sub.This package facilitates interaction with Google Cloud Pub/Sub, allowing publishing and subscribing to topics, managing subscriptions, and handling messages.
Package google provides a client for interacting with Google Cloud Pub/Sub.This package facilitates interaction with Google Cloud Pub/Sub, allowing publishing and subscribing to topics, managing subscriptions, and handling messages.
gofr/datasource/pubsub/kafka
Package kafka provides a client for interacting with Apache Kafka message queues.This package facilitates interaction with Apache Kafka, allowing publishing and subscribing to topics, managing consumer groups, and handling messages.
Package kafka provides a client for interacting with Apache Kafka message queues.This package facilitates interaction with Apache Kafka, allowing publishing and subscribing to topics, managing consumer groups, and handling messages.
gofr/datasource/pubsub/mqtt
Package mqtt provides a client for interacting with MQTT message brokers.This package facilitates interaction with MQTT brokers, allowing publishing and subscribing to topics, managing subscriptions, and handling messages.
Package mqtt provides a client for interacting with MQTT message brokers.This package facilitates interaction with MQTT brokers, allowing publishing and subscribing to topics, managing subscriptions, and handling messages.
gofr/datasource/redis
Package redis provides a client for interacting with Redis key-value stores.This package allows creating and managing Redis clients, executing Redis commands, and handling connections to Redis databases.
Package redis provides a client for interacting with Redis key-value stores.This package allows creating and managing Redis clients, executing Redis commands, and handling connections to Redis databases.
gofr/datasource/sql
Package sql provides functionalities to interact with SQL databases using the database/sql package.This package includes a wrapper around sql.DB and sql.Tx to provide additional features such as query logging, metrics recording, and error handling.
Package sql provides functionalities to interact with SQL databases using the database/sql package.This package includes a wrapper around sql.DB and sql.Tx to provide additional features such as query logging, metrics recording, and error handling.
gofr/http
Package http provides a set of utilities for handling HTTP requests and responses within the GoFr framework.
Package http provides a set of utilities for handling HTTP requests and responses within the GoFr framework.
gofr/http/middleware
Package middleware provides a collection of middleware functions that handles various aspects of request handling, such as authentication, logging, tracing, and metrics collection.
Package middleware provides a collection of middleware functions that handles various aspects of request handling, such as authentication, logging, tracing, and metrics collection.
gofr/logging
Package logging provides logging functionalities for GoFr applications.
Package logging provides logging functionalities for GoFr applications.
gofr/metrics
Package metrics provides functionalities for instrumenting GoFr applications with metrics.
Package metrics provides functionalities for instrumenting GoFr applications with metrics.
gofr/migration
Package migration is a generated GoMock package.
Package migration is a generated GoMock package.
gofr/service
Package service provides an HTTP client with features for logging, metrics, and resilience.It supports various functionalities like health checks, circuit-breaker and various authentication.
Package service provides an HTTP client with features for logging, metrics, and resilience.It supports various functionalities like health checks, circuit-breaker and various authentication.
gofr/websocket
Package websocket is a generated GoMock package.
Package websocket is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL