6,923 questions
Best practices
0
votes
1
replies
26
views
Implementing ACID with Transactions in Modular Monolitic Backend
I've got a modular monolithic backend in golang. The project it's in the beginning but our plans for the backend is to migrate it to microservices WHEN it's necessary and do it gradually.
Here's how ...
1
vote
0
answers
20
views
Storing Domain Events directly in Outbox table vs mapping to Integration Events in Java/Spring (DDD based Microservices) [duplicate]
I have a Spring Boot / Java application following Domain-Driven Design and Event-Driven Architecture.
In my domain service, I create a ReservationCreatedEvent (a domain event) and publish it:
...
-1
votes
0
answers
44
views
Infrastructure storage exception handling in DDD-ish app [closed]
I have a DDD-ish application where a long-running business process is split into workflow steps.
Each step is idempotent and starts from a message handler.
Very simplified flow of a single step:
...
Best practices
1
vote
1
replies
35
views
How to enable cross-feature communication in Nuxt without breaking DDD boundaries
I'm building a Nuxt 3 application using a feature-based architecture inspired by Domain-Driven Design.
Each feature is meant to be fully isolated, with its own components, state, API layer, and ...
1
vote
1
answer
95
views
Should I create a separate Integration Event when using the Outbox Pattern in a DDD-based microservice? [closed]
I’m building a Java microservice using Spring Boot 3.5.7, Kafka, and the Outbox Pattern.
In my domain layer, I raise a domain event:
package com.turkcell.reservation_service.domain.event;
import com....
Best practices
0
votes
2
replies
121
views
How to model and persist entities whose state changes over time
I’m designing a domain model where some entities evolve over time, and I need to keep a historical record of their state that can be retrieved later.
A simplified example:
A Credit Line represents a ...
Advice
6
votes
7
replies
354
views
What are the kinds of practical difficulties you've run into when implementing Microfrontends?
Our current codebase exists as a monolithic .NET application. The many years of legacy has made it difficult for our engineers to make changes and we're looking to Strangler Fig our way out of a Big ...
0
votes
1
answer
53
views
Mapping request to comand to domain class in DDD [closed]
I am not sure what I should do, I am learning DDD + hexagonal architecture in a spring modulith project and our teacher has not given us any examples on how to do this
I have a restaurant aggregate:
...
3
votes
2
answers
218
views
How to log "who did what" without adding userId in every method?
I'm implementing a DDD app where my entities emit DomainEvents for auditing purposes. Every action that occurs in my board should log something to the DB. In the example bellow, I'm logging that ...
0
votes
0
answers
38
views
Python command/event registration pattern
I am working on my first service using ddd.
My domain layer looks simillar to:
/ domain
/A
/aggregateA.py -> fires an EventA
/aggregateARepository.py
/B
/aggregateB.py
/...
0
votes
1
answer
110
views
Why doesn't @TransactionalEventListener(AFTER_COMMIT) trigger when event is published from another AFTER_COMMIT listener?
I'm trying to chain Spring transaction events, but the second @TransactionalEventListener is not triggered when an event is published from within another AFTER_COMMIT listener. Here's a minimal ...
1
vote
1
answer
90
views
how to decide between entity and value object
I know that there are many articles on this subject and that entity has identity and equality is provided through this identity, while valueObject is provided through its values.
But I'm having a ...
0
votes
0
answers
65
views
Is it allowed to create inheritors from Aggregates in DDD?
There is a PHP project with DDD approach, i.e. class entities have AggregateRoot.
The main classes of entities inherit from AggregateRoot and are implemented in the logic of the object.
Is it allowed ...
0
votes
1
answer
47
views
Domain Driven Design Aggregate Pattern
In my bounded context we have User and webinar aggregate roots. The invariant is that a user can only be added to webinar once. To fulfill this, webinar aggregate has a list of participant Ids to ...
0
votes
0
answers
58
views
Commands and queries in DDD
I am trying to understand DDD and CQRS, but I am confused by the idea that commands and queries are part of the domain alongside domain events as messages. Others say that commands and queries are ...
0
votes
1
answer
88
views
How to return a domain entity with property on a navigation property included from a repository in DDD
I have an entity like this:
public class Article : Entity<ArticleId>
{
public ArticleTitle Title { private set; get; }
public ArticleMarkdownBody Body { private set; get; }
public ...
1
vote
1
answer
118
views
Would adding a CustomerId to the Order entity violate DDD or database design principles to improve lookup performance?
We are building a system using Domain-Driven Design (DDD) in C# (.NET), and we have a performance-related design concern.
Currently, in our domain model, a Customer creates OfferDetails, and each ...
0
votes
2
answers
132
views
DTOs for data access layer in Nestjs
I've recently started learning Nestjs and backend development in general. I got familiarized with the concept of DTO. Each and every tutorial/article on the Internet focuses on their usage for ...
0
votes
1
answer
53
views
How can the application layer get data from a DTO if the domain interfaces don't know about it?
The scenario:
- infrastructure/
├── dtos/
│ ├── note_dto
│ ├── todo_dto
│ └── note_preview_dto <-- includes 3-5 previewTodos from database
│ ...
0
votes
1
answer
93
views
trade-off of update method design of the domain entity
I would like to ask you a question about dividing the method into small units.
It hasn't been long since I learned about DDD(Domain Driven Design).
In both ways, branch logic is likely to increase ...
1
vote
2
answers
131
views
Dataclass/attrs based orm models and their relationships
I am building a small python application to learn Domain-Driven-Design (DDD) approaches. Therefore I am using a dataclass/attrs class as my domain model and also use this class to imperatively model ...
0
votes
1
answer
118
views
How to avoid N+1 or memory inefficiency when applying DDD Aggregate pattern?
I’m applying the DDD Aggregate pattern in a Spring Boot application.
For example, Order is the aggregate root of OrderItem, and they are mapped like this:
@Entity
public class Order {
@Id
...
0
votes
0
answers
70
views
Spring data jdbc and child entity equality
I’m studying Spring Data JDBC through Maciej Walkowiak’s video (https://www.youtube.com/watch?v=ccxBXDAPdmo), which presents a Movie aggregate root with a one-to-many relationship to Rental entities. ...
2
votes
2
answers
128
views
Where to manage access to an aggregate? Following domain-driven-design rules
Following the domain-driven-design principals,
let's say we are building B2B order management system. One of the requirement is that for each customer/order/order item we should be able to assign ...
0
votes
0
answers
52
views
Defining multiple index files in compilerOptions.paths in tsconfig.base.ts in an Angular NX project
In my Angular NX project I want to separate my app domains in folders with sub-folder for each feature/util/store etc. All exposed APIs are referenced in 'public-api.ts' barrel files in each of those ...
0
votes
0
answers
80
views
How to eliminate a dependency cycle
1.When an agent is created, a token is automatically generated.
2.When a token is created, a corresponding UI is also automatically generated.
3.Since the token and UI are tightly coupled, a combined ...
0
votes
1
answer
85
views
In DDD how to pass aggregate into methods of other aggregates, entirely or id?
I know that If one aggregate has reference to another, the first one has to have ID property of the second. For example:
FooId extends AbstractIdValueObject { }
Foo extends AggregateRoot { }
Bar ...
0
votes
1
answer
79
views
When Is Uniqueness Considered a Domain Invariant in DDD?
I'm working on a Domain-Driven Design (DDD) project and I'm trying to clarify when the uniqueness of an attribute should be treated as a domain invariant versus being a technical or infrastructure ...
0
votes
1
answer
74
views
DDD: Where to trigger creation of Aggregate root that need existing referenced Data
I am currently building an online course platform where you can create courses and assign them to users as mandatory trainings (creation of training and assigning them doesnt have to be done by the ...
3
votes
2
answers
269
views
Saving Domain Events on entity in Entity Framework (CosmosDB)
Following domain-driven design, I'm trying to implement an outbox pattern, that will save domain events on an AggregateRoot derived entity in the same "transaction" in CosmosDb.
I'm aware I ...
1
vote
2
answers
85
views
How to Apply Feature Flags in Domain Entities Without Adding Dependencies?
We use domain objects to encapsulate business logic. Sometimes, we need to change the behavior of an entity due to new system requirements. A common approach is to modify the method or property by ...
0
votes
1
answer
92
views
Missing Primary Key Definition in EF Core 8.0 with Strong Type ID and Generic Entity Base
I'm encountering two issues with Entity Framework Core 8.0 when using strong type IDs and a generic entity base class. When attempting to create a migration, I receive the error:
Unable to create a '...
0
votes
2
answers
74
views
Is it acceptable to remove domain events? [closed]
For example, I have the following code:
public void Update(string firstName,
string? middleName,
string lastName,
string emailAddress,
string phoneNumber,
...
0
votes
1
answer
106
views
How to avoid creating circular dependencies between Order, Bot, and Exchange?
I'm working on a cryptocurrency grid trading system where bots create Order entities. When an Order is created, it triggers a domain event to send the order to the corresponding Exchange. The issue is ...
0
votes
1
answer
82
views
A repository interface located in the Domain layer does not have access to DTOs, which belong to the Application layer
I searched Stack Overflow and didn't find an answer to a similar question.
In a query handler, which is in the Application layer, I want to retrieve only a subset of the properties from the Customer ...
1
vote
2
answers
46
views
Compliance Central Microservice
I have multiple microservices in my solution, let's call them salary processing, cards, kyc docs, and I need to enforce compliance so that if a kyc doc has expired, I block the card, and if salary ...
1
vote
0
answers
33
views
persisting presentation-infrastructure-specific data in a DDD application
I have a DDD application, with its Domain, Application and Presentation layers.
My presentation layer needs to persist some configuration that have nothing to do with the application but rather with ...
0
votes
0
answers
48
views
How to Handle Add, Update, and Delete Operations for an Entity Under an Entity Root in DDD?
I have an aggregate root named Building.
In the Building class, I have three methods for adding, updating, and deleting a building.
When adding a building, I create a new Building object.
When ...
3
votes
1
answer
97
views
aarch64/shared/vectors.s: Error: unaligned opcodes detected in executable segment after adding -g option in gnu as command
I added -g option in aarch64-none-elf-as command to compile a file vector.s. This file is the exception vector for arm64 machine (see Table 4 in https://developer.arm.com/documentation/102412/0103/...
0
votes
1
answer
19
views
Should an domain object Contain a Single Associated object or a Collection in DDD?
I am designing a DDD-based travel planning system in Java, following a layered architecture:
UI Layer → Handles user interactions.
Application Layer → Contains business logic and orchestrates domain ...
0
votes
1
answer
66
views
DDD. Correct class hierarchy and ensuring invariants
I wonder how to build correct hierarchy and where to cover invariants.
There are following entities:
Faculty, Course, Student, Teacher.
Faculty consists of Courses. Course cannot exist without Faculty....
0
votes
1
answer
125
views
Entity Framework Core foreign key relationship Guid to ValueObject type
Problem / Context
In my application, I have two entities where the Id of the entities as represented by the database are GUIDs. However, in code I represent these IDs as
readonly record struct ...
1
vote
1
answer
134
views
Decorator pattern with logging
I've recently been learning about the decorator pattern and want to use it in my code, but I see a challenge present itself when I want logging as well.
With an example from Zoran Horvat I have an ...
1
vote
1
answer
49
views
Should I check equity value in domain entity to prevent unnecessary events in DDD?
My domain entity often looks like this:
class {
rename(string $name): void {
if ($this->name === $name)
return;
$this->name = $name;
$this->...
0
votes
1
answer
202
views
DTOs in Hexagonal Architecture
I have a problem with the structure of my API.
My API includes the study domain class, which has an educationLevelId attribute; This attribute belongs to the academicLevel domain class.
Study Domain - ...
2
votes
0
answers
200
views
Deptrac uncovered dependency false negative
I have the following issue with an "uncovered" dependency while running deptrac:
App\Infrastructure\Service\ExternalServiceClient has uncovered dependency on
App\Infrastructure\Service\...
3
votes
1
answer
256
views
Service not found the container inside "\ServiceLocator" is a smaller service locator that only knows about the "kernel"
Because I want my applications to follow some kind of DDD structure, I want my Controller, Entity, Repository, Form etc to sit within a specific directory. For example: src/Appication/Dealer/...
0
votes
1
answer
101
views
How to update an entity when implementing DDD using the repository and unit of work patterns with ASP.NET MVC?
My current solution is as follows - I want to know whether this is correct.
Inside a HttpPost action method, I have the following code - Case type is an entity, case variable is passed as a parameter ...
0
votes
2
answers
135
views
How to properly ensure an aggregate exists in another bounded context DDD
I realize that there are a bunch of posts somewhat covering this topic already, but there I am yet to find an exact answer to the question that I have. Lets say that I'm developing an application for ...
0
votes
2
answers
95
views
Aggregate with many value objects
I've been reading "Implementing Domain-Driven Design" while looking at the code samples, but I'm not sure how to deal with aggregates containing a lot of value objects.
For example, this is ...