Managing "user" entities between aggregates in DDD
P粉775788723
P粉775788723 2024-04-04 09:54:15
0
1
599

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粉775788723
P粉775788723

reply all(1)
P粉215292716

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.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template