When building enterprise-grade applications, following a well-defined architecture that separates concerns and promotes scalability, testability, and maintainability is crucial. One of the best practices in modern software development is applying Clean Architecture principles. This article breaks down a practical folder-by-folder structure inspired by Pedro Constantino’s approach, making Clean Architecture more accessible to developers working with frameworks like .NET.

The Clean Architecture Overview
Clean Architecture organizes code into concentric layers, each with a clear responsibility:
- Domain (Core Business Logic)
- Application (Use Cases)
- Infrastructure (External Concerns)
- Presentation (UI/Controllers)
These layers communicate inward, with dependencies pointing towards the domain, ensuring that the business logic remains isolated from frameworks and technologies.
Folder-by-Folder Breakdown
1. Domain Layer (Yellow Circle – Core)
This is the heart of your application. It defines what your system is rather than what it does.
Folders Inside:
DomainEvents
: Represents significant changes in the state.Entities
: Core business objects with identity.Enumerators
: Enums to categorize or classify values.Constants
: System-wide constant values.Exceptions
: Custom domain-level exceptions.Repositories
: Interfaces to abstract data access.Shared
: Common domain models/utilities.ValueObjects
: Objects defined by their value rather than identity.
2. Application Layer (Red Circle – Use Cases)
Defines what the system does via use cases and orchestrates domain logic.
Folders Inside:
Abstractions
: Interfaces for infrastructure dependencies (like email, logging, etc.)Data
,Email
,Messaging
abstractions.
Behaviors
: Middleware or pipeline behaviors (like validation or logging).Contracts
: DTOs and contracts used by use cases.User
,Order
: Each representing a feature area.Commands
(for write operations)Queries
(for read operations)UseCases
(optional grouping for clarity)
3. Infrastructure Layer (Blue Circle – External Services)
Handles communication with external systems like databases, file systems, third-party services.
Folders Inside:
Data
: Concrete implementations ofRepositories
.Migrations
,DataContext
,ApplicationDbContext.cs
Messaging
: Message brokers or event bus configurations.Services
: Implementation of infrastructure services.Jobs
: Scheduled or background jobs.
4. Presentation Layer (Green Circle – Entry Point)
Responsible for input/output and connecting the outside world to the application.
Folders Inside:
Controllers
: API or MVC controllers to handle HTTP requests.Middlewares
: Cross-cutting concerns like authentication or logging.Extensions
: Extension methods and service registrations.DTOs
: Data Transfer Objects used between client and server.Endpoints
: Minimal APIs or route handlers.ViewModels
: For UI rendering (optional if front-end is separate).
Benefits of This Structure
- Scalability: Easy to grow each layer independently.
- Testability: Domain and application logic can be tested without infrastructure.
- Maintainability: Clear boundaries reduce complexity.
- Flexibility: Swap infrastructure without touching business logic.

Final Thoughts
Adopting Clean Architecture in your project encourages better software practices and long-term maintainability. By structuring folders in a modular and meaningful way, developers can easily navigate and extend their applications.
If you’re building enterprise-level applications, especially in .NET, this structure is worth adopting. It reflects a mature understanding of system design and aligns with the SOLID principles and modern architectural trends.
React 19: Say Goodbye to useEffect for Data Fetching
React App Showing 404 Error on Refresh in Netlify – How to Fix It
Fix npm ERESOLVE Dependency Conflict
Arsalan Malik is a passionate Software Engineer and the Founder of Makemychance.com. A proud CDAC-qualified developer, Arsalan specializes in full-stack web development, with expertise in technologies like Node.js, PHP, WordPress, React, and modern CSS frameworks.
He actively shares his knowledge and insights with the developer community on platforms like Dev.to and engages with professionals worldwide through LinkedIn.
Arsalan believes in building real-world projects that not only solve problems but also educate and empower users. His mission is to make technology simple, accessible, and impactful for everyone.