backend-microservices
backend-microservices copied to clipboard
Monorepo for backend microservices golang
Backend Microservices
Made with
This repository explain implementation of Go for building multiple microservices using a single codebase. Using Standard Golang Project Layout and Clean Architecture
Create new service (for new project)
Please install latest candi CLI first, and then:
$ candi -init
If include GRPC handler, run this command (must install protoc
compiler min version libprotoc 3.14.0
):
$ make proto service={{service_name}}
If using SQL database, run this command for migration:
$ make migration service={{service_name}} dbconn="{{YOUR DATABASE URL CONNECTION}}"
Run all services
$ candi -run
Run specific service or multiple services
$ candi -run -service {{service_a}},{{service_b}}
Add module(s) in specific service (project)
$ candi -add-module -service {{service_name}}
Run unit test and calculate code coverage
- Generate mocks first (using mockery):
$ make mocks service={{service_name}}
- Run test:
$ make test service={{service_name}}
Run sonar scanner
$ make sonar level={{level}} service={{service_name}}
{{level}}
is service environment, example: dev
, staging
, or prod
Create docker image a service
$ make docker service={{service_name}}