Skip to content

dinhcanh303/mail-server

Repository files navigation

mail-server

An event-driven microservices social application has been written in Golang

Technical stack

  • Infrastructure
    • PostgreSQL
    • RabbitMQ
    • Docker and Docker-compose
    • Redis

Design

mail-server

Services

No. Service URL
1 gRPC Gateway http://localhost:5000
2 Mail Service http://localhost:5001
3 Web loading...

Clean Architecture

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

clean-ddd

Development

Install tools

Docker Desktop for Mac
TablePlus or pgAdmin4
Golang
Migrate

  • Mac OS
brew install golang-migrate
  • Linux
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

  • Mac OS
brew install sqlc
  • Linux
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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published