DEV Community

Discussion on: Clean Boilerplate of Go, Domain-Driven Design, Clean Architecture, Gin and GORM.

varunvs profile image

Hi, I have two queries with respect to this boilerplate:

  1. The 'entities' in domain package, how to distinguish the root entity from the rest? Considering that there may be multiple aggregates in a bounded context, if there's a single domain package, they are all mixed together. Doesn't this result lack of cohesion within an aggregate?
  2. Where should be the domain services?
resotto profile image
resotto Author • Edited on

Hi Varun. Thank you for your comment.

If you have subdomains, please create them under app like app/{SUBDOMAIN}/ and place domain/application/adapter packages under it.
Moreover, if you have multiple entities in one subdomain, the problem you pointed out may exist, which I don't think it is problem because the number of entities might not be so much.
Package name should show clearly what is in there, I think. So I don't create more sub package in the domain.

If you have domain services, please create the package domain/service like application/service and place them there.