Skip to main content
OverflowAI is here! AI power for your Stack Overflow for Teams knowledge community. Learn more

Questions tagged [clean-architecture]

Clean Architecture is a book by Robert C. Martin that contains solutions to architecting software solutions. Collectively these concepts are referred to as "Clean Architecture".

Filter by
Sorted by
Tagged with
1 vote
2 answers
118 views

What value does the mediator pattern add beyond dependency injection?

Does the mediator pattern add any value beyond dependency injection? I am encountering the mediator pattern for the first time in context of this sample application, which is meant to demonstrate how ...
jpaugh's user avatar
  • 219
0 votes
0 answers
43 views

How handle foreign keys in bounded contexts inside a monolith?

in my company we have a Django monolithic application. To be clear, we are not looking into moving to micro-services. For the past few months, I have reading and implementing a DDD architecture inside ...
Antonio Gamiz Delgado's user avatar
1 vote
2 answers
172 views

CQRS: Multiple entry points for a single command

I’m trying to follow the Clean Architecture and CQRS within an application that, let’s say, create a product. To achieve this, the application has 3 adapters, one for reading a file, another for ...
Vithor Escames's user avatar
0 votes
0 answers
102 views

DDD - Managing Relationships between Domain Aggregates

To understand DDD better, I am trying to create the Domain Layer of an online class application. I have a concept of a Student, Tutor and Session. I thought of having one aggregate called Session and ...
Mush-A's user avatar
  • 109
5 votes
4 answers
635 views

Clean architecture and components

I'm reading the book "Clean Architecture" from Robert C. Martin and there is something that has been puzzling me in most parts of the book. When the author introduces the term "...
naggety's user avatar
  • 160
0 votes
1 answer
87 views

Where to put the reference to Application Insights in an application designed with the Clean Architecture template?

We are implementing an application by trying to follow the Clean Architecture template for C#. Our application is an ASP.NET core web api and we want to implement the observability for that ...
Enrico Massone's user avatar
1 vote
1 answer
171 views

Onion Architecture: Where to put Hangfire specific logic

We have a .net core app with the following folder / onion structure: WidgetApp -> Core -> Application -> JobAutoStarter -> JobAutoStarter.cs WidgetApp -> Core -> Domain -> ...
dot's user avatar
  • 571
1 vote
1 answer
96 views

Clean architecture in webapp : how to compose a page which needs to call many use cases?

I'm writing a pretty common Symfony web application, in which HTML is server side rendered (it's not an SPA application). To illustrate my question, let's take a pretty common fictional eshop ...
sgt-hartman's user avatar
-3 votes
1 answer
146 views

How should I architect a cricket scoring app?

Cricket scoring is complex and I want to build an app in part to practice good design principles/patterns and develop a clean solution. A few high level classes I have in mind are: Match | Innings | ...
zadane's user avatar
  • 387
0 votes
4 answers
286 views

Is validation part of presentation layer or business logic? [duplicate]

We're working on a new project (backend, API), following the "clean code" and "clean architecture" principles (described in Robert Martin's books), dividing our application into ...
LNK's user avatar
  • 109
1 vote
2 answers
105 views

Entities can move from one Clean Architecture use case to another using the controller?

I'm working on a project with the task of creating a route to checkout ticket purchases for events. In this scenario, I have a controller that receives the request with order data, client information, ...
Victor Antunes B.'s user avatar
0 votes
1 answer
133 views

How choose between Clean Arch and Hexagonal Arch(Ports And Adapters)?

I'm studying architecture patterns and I don't understand which type of scenario is more preferable to use clean architecture or hexagonal architecture. Is there something like that? For example, &...
CaioSousa's user avatar
0 votes
2 answers
341 views

Where to define the interfaces of the infrastructure in a clean architecture and DDD?

I have been reading about clean architecture and following Domain-Driven Design. In all the examples I have found, the interfaces of the repository are defined in the domain. However, it is in the ...
Álvaro García's user avatar
0 votes
2 answers
216 views

Should entities always be simple and mapped?

I am told everywhere that entities are only to represent the data structure, then entities should be mapped to a model and then the model possibly to a DTO. The other way is similar, DTO -> model -&...
Gersalom's user avatar
-1 votes
2 answers
346 views

Best Practice for Integrating Domain Services with Infrastructure Layer in Clean Architecture [closed]

I'm currently implementing clean architecture in my project. My application includes various types of communication protocols (TCP, HTTPS, etc.) implemented in the infrastructure layer. These ...
Shady Shahin's user avatar
1 vote
2 answers
250 views

Clean Arch: Where to put HTTP request inputs handling logic (dto) before calling the service layer

I'm refactoring a common web app (not spa but traditional server side html rendering). The design/code organization follows more or the less the Clean architecture concepts (ie: controller calls a use ...
sgt-hartman's user avatar
3 votes
2 answers
374 views

Components in Clean Architecture

I'm a novice in architecture. Now I’m reading Clean Architecture and I don’t understand one thing. I'm wondering at what stage should I create components? Before any design or when I already have some ...
Tiy's user avatar
  • 49
1 vote
3 answers
413 views

Is low code quality and lack of testing the norm in B2B software development?

I've been working at this company for about a year now. it's a growth company working in B2B. I'm one year out of university, with a major in computer science. I work in the web team, using an Angular ...
Jeremaia Scott's user avatar
0 votes
1 answer
73 views

How to balance "Draft capabilities" in Clean Architecture: handling Partial Models and Database Integration

I have an app with "clean architecture" classic layers: Ports (such as HTTP, GRPC, GRAPHQL resolvers) Services (CRUD methods and others) Adapters Domain My app has of course multiple &...
Fred Hors's user avatar
  • 139
2 votes
3 answers
383 views

Streams and clean architecture

I am pretty new to async programming and the whole stream stuff, since i have a web programming background with php, where async programming and streams isn't really a big topic most time. I try to ...
Jim Panse's user avatar
  • 398
0 votes
1 answer
102 views

Validation logic dependencies and separation of concerns

I am going back and forth on an aspect of our FluentValidation and MediatR pipeline behavior implementation. We receive requests which, in a Mediator pattern, are mapped to command or query objects, ...
BJ Safdie's user avatar
  • 103
-2 votes
1 answer
81 views

Clean code: formatting rules, dependent functions, multiple calls [closed]

About formatting Here are two scenarios in which the details of the formatting are described. How should in the clean code way, this be formatted Scenario 1: Dependent functions of dependent functions ...
user13047397's user avatar
12 votes
4 answers
5k views

Is there a clean way to model methods that only make sense depending on the current state of the object?

Let's say that I have a class called Mission. This class is intended to represent a mission requested by a professor working in a faculty. Mission has a private enum field representing whether the ...
Mehdi Charife's user avatar
0 votes
0 answers
73 views

Should input adapters receive the domain model?

This article on Medium addresses the scopes of the domain model in hexagonal architecture. I have sketched the following generic hexagonal architecture: On the one hand, the secondary/output adapter ...
user946822's user avatar
0 votes
2 answers
335 views

Clean Architecture with Microservices

I'm fairly new at system architecting and I'm looking for some advice. My company is revamping its order management system. Currently is a monolith system that scales very poorly and is difficult for ...
ArcSpark76's user avatar
1 vote
1 answer
450 views

Designing Clean Architecture(Hexagonal) for a Spring Boot Application : Project Layout and Class Organization

I'm currently in the process of integrating Clean Architecture into my Spring Boot project and I'm seeking advice on the ideal project structure and the types of classes and projects that should be ...
shiningStar's user avatar
1 vote
1 answer
93 views

UI or Application layer responsibility - retrieving additional data for display

I have an application service that retrieves Order data. The service is consumed in UI, where it can be edited by users. Additionally, the users wants to see related data such as ordered products' ...
Liero's user avatar
  • 140
1 vote
1 answer
303 views

Clean architecture for file upload in a flutter app

I have started a flutter app and want to apply clean architecture to it. The first use case i have is the following: A user provides file(s)via "open file" dialogue. The provided files ...
Jim Panse's user avatar
  • 398
6 votes
2 answers
2k views

Key difference between Hexagonal Architecture vs Clean Architecture?

I am trying to improve the architecture for my React app project that has grown in size lately. I'm looking at Hexagonal architecture and Clean architecture, and I couldn't really see the difference ...
rickvian's user avatar
1 vote
2 answers
553 views

Clean Architecture: Loading data for the domain layer

Let's say my domain has a User Entity that has a many to many relationship with itself representing "Friends" public class User { public int Id; public IEnumerable<User>? ...
MyUsername112358's user avatar
0 votes
3 answers
230 views

Can the application layer extend the domain models?

I write BFF (Backend For Frontend) and it's domain is to provide user info and microservices integration. The User domain model looks like below: public class User { public required Guid Id { get; ...
Szyszka947's user avatar
0 votes
2 answers
201 views

Domain Project and Identity Project circular dependency

I am currently working on implementing the Clean Architecture pattern using Entity Framework. However, I've encountered an issue related to the design of my Domain project. In this project, I need to ...
pakerinjo's user avatar
2 votes
1 answer
1k views

Clean architecture - how to manage use cases that depends on external apis

How to apply clean architecture concepts in a software that depends on External APIs. Example: A business that offers some kind of subscription to its users. Its convinient to store some subscription ...
Rafael Alencar's user avatar
0 votes
1 answer
76 views

Communicating unpredicted Failure from Repository implementation to Applicaiton Layer

My application follows Clean Architecture wherein the Application Layer wraps the Domain Layer. I try to adhere to DDD more-so as a "guiding light" than a strict rulebook. Within the Domain ...
John Hall's user avatar
  • 163
9 votes
4 answers
3k views

Is it okay to have misleading struct and function names for the sake of encapsulation?

I'm writing this library in which the user can provide custom code defining the algorithm used for finding an optimal solution. In the papers that I have read, the targeted user thinks in terms of ...
Mehdi Charife's user avatar
2 votes
3 answers
2k views

Clean Architecture and Access Control

I'm working on a .Net core API for product configuration and ordering. The ticket for Permissions has come up and I've been tasked with developing a solution, ideas of middleware have been mentioned. ...
Tod's user avatar
  • 123
-1 votes
1 answer
168 views

Split or join two use cases that are similar in Clean Architecture

In my working project I have a CustomerRegisterUseCase, that has following steps: validate email is already in use; hash password; save customer in temporary table(tranfered to customer table after ...
Caio Filus's user avatar
1 vote
1 answer
171 views

deciding where to put "formatting" logic - database or in application layer

We have an application that fetches user data from an Azure tenant via MS Graph. We need to distinguish between guests and regular members. Guests come back with Usernames that look like this: ...
dot's user avatar
  • 571
2 votes
2 answers
1k views

Where to place a common database connection in clean architecture?

I am currently trying to follow the clean architecture approach but i wonder where common things like a database connections should take place. Since i think a database connection usually will be ...
Jim Panse's user avatar
  • 398
0 votes
0 answers
91 views

Access one usecase into another usecase

I am working on machine learning project. I use jupyter for quick prototying. Now I am trying to convert it into concrete python project using clean architecture. entities/ - problem.py # ...
winter's user avatar
  • 101
2 votes
1 answer
2k views

Clean Architecture Use Case and db transactions/unit of work

I've started working on a LoB application (as a learning exercise) while trying to express business logic with use cases from Clean Architecture. First use case is customer onboarding where client can ...
milan's user avatar
  • 21
2 votes
1 answer
2k views

Build a Rust project using Clean architecture and DB transactions in the same DDD bounded context

This is just an example of an (still incomplete) real-world project written in Rust using a clean architecture: https://github.com/frederikhors/rust-clean-architecture-with-db-transactions. Goals My ...
Fred Hors's user avatar
  • 139
0 votes
1 answer
253 views

Decoupling modules of a monolith

As part of an migration from .NET Framework to .NET Core we're looking to decouple elements of our monolith into more manageable modules. Ideally following a clean architecture/DDD/microservice ...
Andy Cox's user avatar
  • 103
0 votes
1 answer
367 views

Separating Application (Business Logic) Layer to Multiple Module Layers in Clean Architecture

Currently, I'm designing the Project based on Clean Architecture composing with 4 layers: Domain Application Infrastructure Presentation Since the project is pretty huge, I'm now considering to ...
Steve.NayLinAung's user avatar
1 vote
1 answer
537 views

Is it normal to use multiple repositories in one viewmodel?

Does it violating any conventions? Is it acceptable by MVVM? I have to separate the local data repository and online repository, but for login I have to use multiple repositories for getting response ...
Бодя павук's user avatar
1 vote
1 answer
1k views

DDD - How to avoid validation rule duplication

From what I understand of DDD, my entities and value objects should be able to enforce its own invariants, meaning that its constructors will check for nulls, must contains numbers and letters, ...
Douglas Monteiro's user avatar
0 votes
2 answers
388 views

How to restrict the construction of a domain object to an external service?

I have this object RelativeFoo{int relativeCode, Origin relativeTo} And I want to map it to this other object AbsoluteFoo{int absoluteCode} In order to do this, I need to use a service whose ...
Douglas Monteiro's user avatar
0 votes
1 answer
303 views

Domain Modeling / Architecture

I'm experimenting with some projects at the moment and I am stuck trying to decide on the correct approach to this question. Given a simple architecture like this consisting of Domain - (Person and ...
Justim Odendaal's user avatar
2 votes
1 answer
630 views

How much logic can the infrastructure level hold in Clean Architecture

I am trying to wrap my head around the concepts of Clean Architecture, and specifically about the responsibility of the Infrastructure layer. Its purpose is often described as "to provide ...
lemerek759's user avatar
2 votes
1 answer
2k views

In Clean Architecture, how do we name UseCases that get more and more specific without the names becoming too long?

All the examples of Clean Architecture that I see have very simple use cases, such as: OpenAccountUseCase DepositMoneyUseCase However, real world applications have much more complex logic. Let's say ...
MSOACC's user avatar
  • 935

1
2 3 4 5