Home  >  Q&A  >  body text

Managing "user" entities between aggregates in DDD

I'm trying to rewrite a monolithic application onto a modular monolithic application using DDD and hexagonal architecture. First try to extract three modules (aggregations): "Shared", "User" and "Article".

As far as I understand correctly, no dependency should be created between "user" and "post". However, they can all use content from the Shared module.

So here’s the thing… The "Article" module has an Article entity, which is related to the User entity. From DDD's perspective, it's the creator of a specific article. There will be more similar modules related to the User entity as the author or owner of a resource.

How should it be implemented? Should it be moved to Shared? Unfortunately, no specific resources could be found. Github mainly contains projects with a single aggregate and there is no such thing as a User entity.

P粉775788723P粉775788723221 days ago584

reply all(1)I'll reply

  • P粉215292716

    P粉2152927162024-04-05 09:05:19

    I've been looking for different ways to solve this type of problem. You can create a shared aggregate and no one can say it's wrong. However, I think the best solution is that you create a Person (or People) aggregate where you can have a PersonEntity (or AuthorEntity) related to the ArticleEntity, there is no problem with the relationship between the aggregates, but I suggest you try to only Creates relationship roots between aggregates.

    This is a sample of the Eric Evans Blue Book

    Please note that Voyage is the AggregateRoot in Aggregate Voyage, which has a relationship with the AggregateRoot Location of the Location aggregate.

    reply
    0
  • Cancelreply