Awesome Open Source
Awesome Open Source

Golang Microservices Boilerplate

issues forks stars license CodeFactor

Example structure to start a microservices project with golang. Using a MySQL databaseSQL.

Manual Installation

If you would still prefer to do the installation manually, follow these steps:

Clone the repo:

git clone https://github.com/gbrayhan/microservices-go

If you need, configure the environment variables in file config.json, if you use docker-compose leave the variables set in the file config.json.example

cp config.json.example config.json

TL;DR command list

git clone https://github.com/gbrayhan/microservices-go
cd microservices-go
cp config.json.example config.json
docker-compose up  --build  -d

Table of Contents

Features

  • Golang v1.14: Stable version of go
  • Framework: A stable version of gin-go
  • SQL databaseSQL: MariaDB using internal sql package of go sql
  • Testing: unit and integration tests using package of go testing
  • API documentation: with swaggo a go implementation of swagger
  • Dependency management: with go modules
  • Environment variables: using viper
  • Docker support
  • Code quality: with CodeFactor
  • Linting: with ESLint

Commands

Build and run image of docker

docker-compose up  --build  -d

Swagger Implementation

swag init -g routes/ApplicationV1.go

To visualize the swagger documentation on local use

http://localhost:8080/v1/swagger/index.html

Unit test command

# run recursive test
go test  ./test/unitgo/...
# clean go test results in cache
go clean -testcache

Lint inspection of go

golangci-lint run ./...
Alternatives To Microservices Go
Select To Compare


Alternative Project Comparisons
Related Awesome Lists
Top Programming Languages
Top Projects

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Go (156,038
Golang (156,038
Docker (97,002
Database (93,060
Mysql (30,923
Rest Api (15,934
Microservice (11,957
Structure (10,195
Swagger (7,951
Mysql Database (2,411
Gin (1,613
Gorm (985
Golang Application (531
Golang Tools (229
Golang Examples (143
Golang Server (60
Gorm Orm (38