🌟 We are Open Source! Check out our repository on GitHub

ASP.NET Project Structure

A scalable and maintainable folder structure for ASP.NET applications

File Structure

  • src
    • MyWebApp.Web
      • Program.cs
      • Startup.cs
      • MyWebApp.Web.csproj
      • Controllers
        • HomeController.cs
        • ApiController.cs
      • Views
        • Home
        • Shared
      • wwwroot
        • css
        • js
    • MyWebApp.Core
      • MyWebApp.Core.csproj
      • Entities
        • User.cs
        • BaseEntity.cs
      • Interfaces
        • IRepository.cs
        • IUserService.cs
      • Services
        • UserService.cs
    • MyWebApp.Infrastructure
      • MyWebApp.Infrastructure.csproj
      • Data
        • ApplicationDbContext.cs
        • Repositories
      • Services
        • EmailService.cs
  • tests
    • MyWebApp.UnitTests
    • MyWebApp.IntegrationTests
  • MyWebApp.sln
  • Directory.Build.props
  • README.md

Directory Structure Explanation

src/

Source code directory organizing projects by architectural layers.

MyWebApp.Web/

Web layer containing controllers, views, and web-specific logic.

MyWebApp.Core/

Core business logic layer containing entities, interfaces, and services without external dependencies.

MyWebApp.Infrastructure/

Infrastructure layer containing data access, external services, and implementation details.

Directory.Build.props

MSBuild properties file that applies common settings across all projects in the solution.