Clean Architecture is a software architectural pattern designed to create scalable, maintainable, and testable applications using the Go programming language. It enforces a clear separation of concerns, making it easier to develop and maintain complex software systems.
- A sample user module with 5 apis
- Send template mail using SMTP
- Dockerizing project by dockerfile and docker-compose
- Swagger API docs
- Unit test
- Integration tests for each use case
- Gin
- GORM
- Postgres
- JWT
- Docker
go install github.com/swaggo/swag/cmd/swag@latest
swag init -g cmd/main.go
- When you have successfully initiated the server, you can access the API documentation by visiting http://localhost:8888/docs/index.html.
make init_db
make rm_db
- Remember to download all dependencies before you start server
go mod download
go mod tidy
- Then you need to config your SMPT (gmail) in local.env and prod.env in config/env directory.
# MAIL CONFIG
MAIL_FROM=YOUR GMAIL
MAIL_PASS=YOUR GMAIL APP PASSWORD
MAIL_SERVER=smtp.gmail.com
MAIL_PORT=587
make local m=true
make local m=false
- When you initiate the server using docker-compose, you don't need to start the database separately, as it will already be set up within docker-compose.
- The only command you need to start the server.
- Remember to set up a prod.env file in the config/env directory before running the command. You can set up this file the same way as the local.env file, for example.
make compose_up
- Run this command if you want to clear everything, including images and containers of the application, and the database as well.
make compose_down