Complete solution template which is built on Clean Architecture with all essential feature using go!
Explore the docs »
Report Bug
·
Request Feature
If you like or are using this project to learn or start your solution, please give it a star. Thanks!
If you have found this project helpful, either as a library that you use or as a learning tool, please consider buying me a coffee:
- go - 1.18 or later, to use generics
- wire - Dependency injection
- fiber - Web framework
- sqlx - Extensions to database/sql.
- pgx - PostgreSQL driver and toolkit for Go
- viper - Go configuration with fangs
- go-redis - Type-safe Redis client for Golang
- go-mongo Golang driver for MongoDB
- zap - Logger
- validator - Go Struct and Field validation
- migrate - Database migrations. CLI and Golang library.
- swag - Swagger
- testify - Testing toolkit
- gomock - Mocking framework
- Docker - Docker
Design Pattern
- CQRS design pattern
- Repository design pattern
- Mediator design pattern
- Unit of work
Service
- Web API (Restful service)
- gRPC
- Graphql
- Message Broker (Nats, Kafka)
Feature
- Custom Exceptionn Handler
- Swagger UI
- Advanced Pagination
Monitoring
- Health check
Testing
- Unit testing
- Integration testing
Caching
- In memory Caching
- Redis Caching
Database
- MongoDb
- Mysql
- PostgresSQL
As a web client, I want to be able to
- Get all available crags.
- Get a crag by ID.
- Add a crag by providing a name, country, and description.
- Update a crag by providing a name, country, and description.
- Remove a crag by ID.
As an application administrator
- When a new crag is added, I want to receive a notification at a pre-agreed channel.
- Operations should be exposed via an HTTP restful interface.
- For simplicity purposes,
- The crags should be stored in memory; no need for persistence storage.
- Notifications should be sent in a console application.
Project Structure
-
cmd
contains themain.go
file, the entry point of the application -
docs
contains documentation about the application -
internal
contains the main implementation of our application. It consists of the three layers of clean architecture + server- api
- app
- common
- domain
- infrastructure
- middleware
- probes
- router
-
pkg
shared utility codeEach of these directories contains its corresponding components, following the group-by-feature approach.
-
vendor
contains the dependencies of our project
make local ## Run the application in local
make setup ## go tidy, install wire and swag
make test ## Run unit tests
make build ## Build the app executable
make swag ## generate api document
make clean ## # remove binary
See the contents of the LICENSE file for details
Having any issues or troubles getting started? Drop a mail to truanguyenvan@gmail.com or Raise a Bug or Feature Request. Always happy to help.