Folder Structures in .NET Projects: A Comprehensive Guide

Tuan Do QuocTuan Do Quoc
1 min read
  1. Basic ASP.NET MVC Project

/Controllers/
    HomeController.cs
/Models/
    Product.cs
    Order.cs
/Views/
    /Home/
        Index.cshtml
    /Shared/
        _Layout.cshtml
/Services/
    OrderService.cs
/DataAccess/
    ProductRepository.cs
  1. Feature-Based Project

/Features/
    /Products/
        Models/
            Product.cs
        Controllers/
            ProductController.cs
        Views/
            ProductView.cshtml
        Services/
            ProductService.cs
    /Orders/
        Models/
            Order.cs
        Controllers/
            OrderController.cs
        Views/
            OrderView.cshtml
        Services/
            OrderService.cs
  1. DDD Project Structure

/Domain/
    /Products/
        Product.cs
        ProductService.cs
        ProductRepository.cs
    /Orders/
        Order.cs
        OrderService.cs
        OrderRepository.cs
/Infrastructure/
    /Persistence/
        DatabaseContext.cs
    /Repositories/
        ProductRepository.cs
/Application/
    /Commands/
        CreateProductCommand.cs
    /Queries/
        GetProductByIdQuery.cs
0
Subscribe to my newsletter

Read articles from Tuan Do Quoc directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Tuan Do Quoc
Tuan Do Quoc

I'm a software engineer with a strong enthusiasm for security. I possess more than 2 years of hands-on experience with the .NET ecosystem, complemented by an additional 6 months specializing in Spring Boot and ReactJS. Experienced in deploying small and medium-sized systems to the cloud as well as on-premises.