20
201R/golang_restapi_boilerplate
Golang boilerplate. Auth, Entgo, Postgres, Mailing, I18N, Docker.
Golang Restapi Boilerplate
Description
Golang REST API boilerplate for typical project, including interactive API documentation.
Table of Contents
- Interactive API documentation
- Features
- Quick run
- How to use it
- Comfortable development
- Links
- Database
- Tests
- License
Interactive API documentation
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 -dFor check status run
docker-compose logsHow 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 -iLinks
- Swagger: http://localhost:8090/swagger/index.html
- Adminer: http://localhost:8080/
Database
License
This project is licensed under the terms of the MIT license.
On this page
Languages
Go82.6%Shell15.3%Dockerfile1.8%Makefile0.3%
Contributors
MIT License
Created August 23, 2022
Updated August 26, 2023
