Go Clean Architecture in Crescendo Lab
Go-Clean-Arch gives a Clean Architecture template that is commonly used in Crescendo's Go projects. We will introduce the proposed architecture and related designs through a tutorial on building a sample application - Crescendo Barter.
The proposed clean architecture is inspired by DDD (Domain-Driven Design), Uncle Bob's Clean Architecture, and a Go Clean Architecture project Wild Workouts, trying to balance feature development speed and maintenance efforts.
Our proposed clean architecture tries to provide the following features:
The proposed architecture can be separated into 4 layers, including Domain
, Application
, Router
, and Adapter
.
Domain
handles domain models and critical business logic.Application
handles use cases (orchestration of business rules), compositing functionalities of Domain
and Adapter
.Router
handles input request things, such as HTTP request routing, authentication, access control, and parameter validation.Adapter
handle output requests, such as accessing DB, communicate with other services, emit events.Its dependency rules are:
More at https://slides.com/jalex-chang/go-clean-arch-cresclab.
Crescendo Barter is a second-hand goods exchange application in which people can post their old goods and exchange them with others.
Account management:
Second-hand Goods:
Goods Exchange: