go-cqrs-microservices

Golang CQRS Kafka gRPC Postgresql MongoDB Redis microservices with clean architecture example 👋

👨‍💻 Full list what has been used:

Kafka as messages broker gRPC Go implementation of gRPC PostgreSQL as database Prometheus monitoring and alerting Grafana for to compose observability dashboards with everything from Prometheus MongoDB Web and API based SMTP testing Redis Type-safe Redis client for Golang swag Swagger for Go Beego framework fro Go

CQRS Architecture

golang clean architecture

Clean Architecture

This project has 4 Domain layer :

  • Models Layer
  • Repository Layer
  • Usecase Layer
  • Delivery Layer

The diagram:

golang clean architecture

The explanation about this project’s structure can read from this medium’s post : https://medium.com/@imantumorang/golang-clean-archithecture-efd6d7c43047

How To Run This Project

#move to directory
cd $GOPATH/src/github.com/radyatamaa

# Clone into YOUR $GOPATH/src
git clone https://github.com/radyatamaa/go-cqrs-microservices.git

#move to project
cd go-cqrs-microservices

# Run app writer service
go run write_service/cmd/main.go

# Run app reader service
go run reader_service/cmd/main.go

# Run app api gateway service
go run api_gateway_service/cmd/main.go

Or with docker-compose

#move to directory
cd $GOPATH/src/github.com/radyatamaa

# Clone into YOUR $GOPATH/src
git clone https://github.com/radyatamaa/go-cqrs-microservices.git

#move to project
cd go-cqrs-microservices

# Run the application
make run  OR  docker compose -f "docker-compose.yml" up -d --build


# Open at browser this url
http://localhost:8082/swagger/index.html

Prometheus UI:

http://localhost:9090

Grafana UI:

http://localhost:3000

Swagger UI:

http://localhost:8082/swagger/index.html

GitHub

View Github