Skip to content

charanpasham/Clean-Architecture

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›οΈ Ecommerce β€” Clean Architecture .NET Solution

The Ecommerce solution is a modular, full-stack web application built using ASP.NET Core, Razor Pages, and the Clean Architecture pattern. It demonstrates how to structure modern .NET applications with CQRS, MediatR, and Entity Framework Core, while maintaining separation of concerns, scalability, and testability.


🧩 Project Overview

This project is a sample e-commerce system that allows users to:

  • Register and authenticate securely
  • Browse available products
  • Manage a shopping cart
  • Place and view orders
  • (Admin) Create, edit, and delete products

The project follows Clean Architecture principles, keeping business logic independent of frameworks and infrastructure.



🧠 Architectural Overview

This solution uses Clean Architecture + CQRS (Command Query Responsibility Segregation) to achieve high maintainability and separation of concerns.

Layer Responsibility Depends On
Domain Core business entities and logic β€”
Application Use cases, CQRS (MediatR commands/queries), validation Domain
Infrastructure Database (EF Core), Identity, external services Application, Domain
Web Razor UI, authentication, presentation Application, Infrastructure

βš™οΈ Key Technologies

  • .NET 8 / ASP.NET Core Razor Pages
  • Entity Framework Core (SQL Server)
  • MediatR for CQRS request/response pattern
  • FluentValidation for business input validation
  • AutoMapper for object mapping
  • ASP.NET Core Identity for authentication and authorization
  • User Secrets for secure local configuration
  • Dependency Injection throughout all layers

πŸ” Configuration & User Secrets

Sensitive data like database credentials and license keys are managed using .NET User Secrets.

Run this in the Ecommerce.Web directory:

dotnet user-secrets init
dotnet user-secrets set "ConnectionStrings:EcommerceDatabase" "Server=localhost,1433;Database=ECommerce;User Id=sa;Password=YourStrongPassword;TrustServerCertificate=True;"
dotnet user-secrets set "AutoMapper:LicenseKey" ""


## 🧱 Solution Structure


src/
β”œβ”€β”€ Ecommerce.Domain/
β”‚   β”œβ”€β”€ Entities/
β”‚   └── Common/
β”‚
β”œβ”€β”€ Ecommerce.Application/
β”‚   β”œβ”€β”€ Product/
β”‚   β”‚   β”œβ”€β”€ Commands/
β”‚   β”‚   β”œβ”€β”€ Queries/
β”‚   β”‚   β”œβ”€β”€ Dtos/
β”‚   β”‚   └── Validators/
β”‚   └── Common/
β”‚
β”œβ”€β”€ Ecommerce.Infrastructure/
β”‚   β”œβ”€β”€ Identity/
β”‚   β”œβ”€β”€ Persistence/
β”‚   └── DependencyInjection.cs
β”‚
└── Ecommerce.Web/
    β”œβ”€β”€ Pages/
    β”œβ”€β”€ appsettings.json
    └── Program.cs

About

A sample project to demonstrate clean architecture design in .net

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published