WIP
A platform for Gophers similar to the awesome Golang News.
Droplets is built to showcase:
- Application of CodeReviewComments and EffectiveGo
- Usage of Clean Architecture
- Testing practices such as Table-driven tests
Droplets uses go mod
(available from go 1.11
) for dependency management.
To test and build, run make all
.
Directory structure is based on Clean Architecture.
- represents the
entities
layer from the Clean Architecture - contains different core entity definitions and core validation logic
- this package strictly cannot have direct dependency on external packages
- represents the
usecases
layer from the Clean Architecture - Usecases layer builds different business oriented usecases using the entities provided by
entities
layer - Any real use case would also need external entities such as persistence, external service integration etc. But this layer also strictly cannot have direct dependency on external packages. This crossing of boundaries is done through interfaces.
- represents the
interface-adapter
layer from the Clean Architecture - This is the layer that cares about the external world (i.e, external dependencies).
- Interfacing includes:
- Exposing
usecases
as API (e.g., RPC, GraphQL, REST etc.) - Presenting
usecases
to end-user (e.g., GUI, WebApp etc.) - Persistence logic (e.g., cache, datastores etc.)
- Integrating an external service required by
usecases
- Exposing
- Packages inside this are organized in 2 ways:
- Based on the medium they use (e.g.,
rest
,web
etc.) - Based on the external dependency they use (e.g.,
mongo
,redis
etc.)
- Based on the medium they use (e.g.,
- contains re-usable packages that is safe to be imported in other projects
- this package should not import anything from
domain
,interfaces
,usecases
or their sub-packages
web/
is NOT a Go package- contains web assets such as css, images, templates etc.