Skip to content

Golang boilerplate. Auth, Entgo, Postgres, Mailing, I18N, Docker.

License

Notifications You must be signed in to change notification settings

201R/golang_restapi_boilerplate

Repository files navigation

Go Reference License: MIT

Golang Restapi Boilerplate

Description

Golang REST API boilerplate for typical project, including interactive API documentation.

Table of Contents

Interactive API documentation

API docs

Features

  • Database (entgo).
  • Migration (atlas).
  • Config
  • Admin and User roles. (Casbin Rbac)
  • Mailing
  • Sign in and sign up via email.
  • Redis
  • Social sign in (Apple, Facebook, Google, Twitter).
  • I18N
  • File uploads. Support local and Amazon S3 drivers.
  • Swagger.
  • nginx.
  • Adminer(Adminer)
  • Docker.
  • CI (Github Actions).
  • Monitoring (Grafana)
  • Unit Test(Testify)

Quick run

git clone --depth 1 https://github.com/201R/golang_restapi_boilerplate.git my-app
cd my-app/
cp .ini.exemple .ini
docker-compose up -d

For check status run

docker-compose logs

How to use it

Comfortable development

  • Install Gin Hot reload

Assuming you have a working Go environment and GOPATH/bin is in your PATH, gin is a breeze to install:

go get github.com/codegangsta/gin
  • Pull code
git clone --depth 1 https://github.com/201R/golang_restapi_boilerplate.git my-app
cd my-app/
cp .ini.exemple .ini
  • Update .ini file

change Host=postgres to Host=localhost

  • Run additional container
docker-compose up -d postgres adminer redis
  • Start App
go mod download

go run -mod=mod ariga.io/atlas/cmd/atlas@master migrate apply \
  --dir "file://migrations"
  --url "postgres://postgres:password@localhost:6001/db?sslmode=disable"

gin -a 3000 -p 8090 -i

Links

Database

License

This project is licensed under the terms of the MIT license.