Giter Club home page Giter Club logo

gofr's Introduction

GoFr

logo


Gofr is an opinionated microservice development framework. Listed in CNCF Landscape.

Visit https://gofr.dev for more details and documentation.

๐ŸŽฏ Goal

Even though generic applications can be written using Gofr, our main focus is to simplify the development of microservices. We will focus ourselves towards deployment in kubernetes and aspire to provide out-of-the-box observability.

โšก๏ธ Quick Start Guide

If you already have a go project with go module, you can get gofr by calling: go get gofr.dev. Follow the instructions below, if you are starting afresh.

The latest version of go in your system should be installed. If you have not already done that, install it from here. This can be tested by opening a terminal and trying go version. One should also be familiar with golang syntax. Official golang website has an excellent tour of go and is highly recommended.

Writing an API service using Gofr is very simple.

  1. In an empty folder, initialise your go module using: go mod init test-service. If you intend to push your code to github, it is recommended to name your module like this: go mod init github.com/{USERNAME}/{REPO}
  2. Create main.go file with following content:
package main

import "gofr.dev/pkg/gofr"

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

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

    app.Start()
}
  1. Get all the dependencies using go get ./.... It will download gofr along with every other package it requires.
  2. Start the server: go run main.go It will start the server on default port 8000. If this port is already in use, you can override the default port by mentioning an environment variable like this: HTTP_PORT=9000 go run main.go

๐Ÿ’ก Advantages/Features

  1. Simple API syntax
  2. REST Standards by default
  3. Battle Tested at Enterprise Scale
  4. Configuration management
  5. Database state management using migrations
  6. Inbuilt Middlewares along with support for custom middlewares
  7. Error Management
  8. Inbuilt Datastore, File System, Pub/Sub
  9. gRPC support
  10. Chained timeout control
  11. Serve Static Files
  12. Websocket
  13. Support for Surge Protection
  14. Inbuilt Traces, Metrics and Logs

๐Ÿ‘ Contribute

If you want to say thank you and/or support the active development of GoFr:

  1. Add a GitHub Star to the project.
  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.

gofr's People

Contributors

vikash avatar dependabot[bot] avatar umang01-hash avatar vipul-rawat avatar stella551 avatar aryanmehrotra avatar onyx2406 avatar nithinputhenveettil avatar go-coder-go avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.