Example of Clean Architecture implementation with Golang. Read more information about Clean Architecture.
This project has 4 layers and each layer has a role as following:
Directory | Layer |
---|---|
domain | Entities |
infrastructure | Frameworks & Drivers |
interface | Interface Adapters |
usecase | Use Cases |
- Echo (Web Framework)
- PostgreSQL (RDBMS)
- Testify (Testing)
- Viper (Configuration)
- Docker (Containerization)
This repository requires Docker to run.
# move to directory
cd workspace
# clone repository
git clone /~https://github.com/fikriyusrihan/golang-clean-arch.git
# move to project
cd golang-clean-arch
# build and run container
docker compose up
# call an endpoint
curl -X GET http://localhost:8000/v1/books -i
# stop container
docker compose down
I learn a lot about Clean Architecture with Golang from Manakuro's Repository and Iman Tumorang's repository. Kindly check their repository and article on Medium.