Skip to content

truongbo17/go-gin-boilerplate

Repository files navigation

Go Gin Base

A development boilerplate based on the Gin framework, quickly build and develop web applications.


Document


Introduction

So why I use choose Gin framework?

  • Based on benchmarks: https://gin-gonic.com/docs/benchmarks/
  • Gin doesn't build everything from scratch, but relies heavily on Go's standard net/http (also one reason why i don't use fiber, even though fiber has better stats).
  • Big community, really the biggest. With twice the stars and contributors of the second place competitor.
  • Suitable for building RESTFul API, microservices or realtime applications.
  • There is a full tutorial to build up a web server, even in Go Dev official blog!

Installation

Setup

  git clone https://github.com/truongbo17/go-base.git
  go mod download
  cp .env.example .env
  go run main.go migrate
  go clean -cache

Run the Application

Run with air(hot reload):

  go install github.com/air-verse/air@latest
  air server

Or simple:

  go run main.go server

Docs

  go install github.com/swaggo/swag/cmd/swag@latest
{{host}}/docs/swagger/index.html

Build

  make build

Feature

  • Config ✅
  • Command / Console ✅
  • Schedule / Cron ✅
  • Queue/Job ✅
  • Swagger ✅
  • Logger ✅
  • Database (DocumentDB(MongoDB), Relation DB(MYSQL)) ✅
  • Authentication (JWT access token, refresh token) ✅
  • Google auth ✅
  • Cache (local, redis) ✅
  • Redis ✅
  • Http call service ✅
  • Middleware ✅
  • Push notify to telegram ✅
  • Migration tool ✅
  • Mail
  • File upload (local, s3)
  • Kafka (producer, consumer)
  • GraphQL
  • I18N
  • ...

Overview


Struct