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.
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.
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 |
- .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
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