Chatbotgang Go Clean Arch Save

Go Clean Architecture in Crescendo Lab

Project README

Go-Clean-Arch

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.

Overview

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.

Features

Our proposed clean architecture tries to provide the following features:

  • Testable. Critical logic is well protected and validated.
  • Ubiquitous language. No communication barrier between business and engineering people.
  • First-class-citizen errors. Handle errors throughout the application in handy.
  • Traceable requests. Internal behaviors of a request could be observed through API and system logs.
  • Product-ready. Teams could use the architecture template in their new projects directly.
  • Simple and straight. Any new member could pick up the architecture within days.

Architecture

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

Crescendo Barter is a second-hand goods exchange application in which people can post their old goods and exchange them with others.

User Stories

Account management:

  • As a client, I want to register a trader account.
  • As a client, I want to log in to the application through the registered trader account.

Second-hand Goods:

  • As a trader, I want to post my old goods to the application so that others can see what I have.
  • As a trader, I want to see all my posted goods.
  • As a trader, I want to see others’ posted goods.
  • As a trader, I want to remove some of my goods from the application.

Goods Exchange:

  • As a trader, I want to exchange my own goods with others.

Project Dependencies

Main application
Test usage

Development Guideline

See development guideline.

Open Source Agenda is not affiliated with "Chatbotgang Go Clean Arch" Project. README Source: chatbotgang/go-clean-arch
Stars
104
Open Issues
1
Last Commit
1 year ago
License
MIT

Open Source Agenda Badge

Open Source Agenda Rating