mail-server
An event-driven microservices social application has been written in Golang
Technical stack
- Infrastructure
- PostgreSQL
- RabbitMQ
- Docker and Docker-compose
- Redis
Design
Services
Clean Architecture
Explain Clean Architecture
- Clean Architecture is a multi-layered architecture.
- Isolate Business Rules. Similar to Hexagonal and Onion architecture.
- The concentric circles represent layers, the closer to the center
the more abstract (high level), and the further out the more detailed (low level).
- Dependency Inversion (DI) in SOLID
High level will not depend on low level, both depend on abstraction/interface.
Abstraction does not depend on details but vice versa.
Note
- ---> In Clean Architecture arrows is Dependency Direction , not call direction.
Clean Domain-driven Design
Development
Docker Desktop for Mac
TablePlus or pgAdmin4
Golang
Migrate
brew install golang-migrate
curl -L https://packagecloud.io/golang-migrate/migrate/gpgkey | apt-key add -
echo "deb https://packagecloud.io/golang-migrate/migrate/ubuntu/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/migrate.list
apt-get update
apt-get install -y migrate
DB Docs
npm install -g dbdocs
dbdocs login
DBML CLI
npm install -g @dbml/cli
dbml2sql --version
# or if you're using yarn
yarn global add @dbml/cli
dbml2sql --version
SQLC
brew install sqlc
sudo snap install sqlc
Go mock
go install github.com/golang/mock/mockgen@v1.6.0
How to generate code
Generate dependency injection instances with wire
make wire
Generate code with sqlc
make sqlc
Generate proto using protobuf
make proto
Documentation
Generate DB documentation
make db_docs
Access the DB Documentation at db go-microservice.Password: 123456789
How to run
Run using Docker
Start docker core include (postgres , redis, rabbitmq, etc)
make docker-core
Start docker multi-service (group,post,like, etc)
make docker
Run
make run
Run test
make test
Step By Step Create Service